Exemple #1
0
  public Client(final String ip, final int nodeId, MessageManager messageManager) {
    this.ip = ip;
    this.nodeId = nodeId;
    this.messageManager = messageManager;

    final String message =
        messageBuilder.constructMessage(ip, Messages.clientConnectionRequest, "");
    messageManager.sendMessage(message, nodeId);
  }
Exemple #2
0
 public void releaseLock(final String lock) {
   System.out.println("Client with IP " + ip + " is releasing lock named " + lock);
   obtainedLocks.put(lock, new Boolean(false));
   final String message = messageBuilder.constructMessage(ip, Messages.clientReleaseLock, lock);
   messageManager.sendMessage(message, nodeId);
 }
Exemple #3
0
 public void requestLock(final String lock) {
   System.out.println("Client with IP " + ip + " is requesting lock named \"" + lock + "\"");
   final String message = messageBuilder.constructMessage(ip, Messages.clientRequestLock, lock);
   messageManager.sendMessage(message, nodeId);
 }