/** * Handle the actual remote object method calls. */ protected Object invokeLocal( short objectId, short procId, Object[] args ) { // Actually could use a regular concurrent map for this // Only lock the local registry during lookup and // not invocation. It prevents a deadlock if the invoked method // tries to share an object. It should be safe. SharedObject share = local.byId.get(objectId); local.lock.readLock().lock(); try { share = local.byId.get(objectId); } finally { local.lock.readLock().unlock(); } try { RmiContext.setRmiConnection(context); return share.invoke(procId, args); } finally { RmiContext.setRmiConnection(null); } }
/** * Handle the actual remote object method calls. */ protected Object invokeLocal( short objectId, short procId, Object[] args ) { // Actually could use a regular concurrent map for this // Only lock the local registry during lookup and // not invocation. It prevents a deadlock if the invoked method // tries to share an object. It should be safe. SharedObject share = local.byId.get(objectId); local.lock.readLock().lock(); try { share = local.byId.get(objectId); } finally { local.lock.readLock().unlock(); } try { RmiContext.setRmiConnection(context); return share.invoke(procId, args); } finally { RmiContext.setRmiConnection(null); } }