コード例 #1
0
ファイル: Client.java プロジェクト: zackhariton/Hackalock
  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);
  }
コード例 #2
0
ファイル: Client.java プロジェクト: zackhariton/Hackalock
 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);
 }
コード例 #3
0
ファイル: Client.java プロジェクト: zackhariton/Hackalock
 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);
 }