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); }
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); }
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); }