public static void remoteUnlockRequest(GlobalObject key) { if (key == null) return; try { Logger.debug("Remote Lock release for " + key + " sent to " + key.getHome()); CommunicationManager.getManager().send(key.getHome(), new LockRequest(key, false, 0)); } catch (IOException e) { e.printStackTrace(); } }
public static void remoteLockRequest(AbstractContext context, GlobalObject key) { int hashCode = context.hashCode(); pendingLocks.put(hashCode, context); synchronized (context) { try { Logger.debug( "Request remote lock for " + key + " hashcode is " + hashCode + " for " + context); CommunicationManager.getManager().send(key.getHome(), new LockRequest(key, true, hashCode)); context.wait(); Logger.debug("Request remote lock come back..."); } catch (InterruptedException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } pendingLocks.remove(hashCode); }