protected void addRemoteObject( byte channel, short objectId, String name, ClassInfo typeInfo ) { if( log.isLoggable(Level.FINEST) ) { log.finest("addRemoveObject(" + objectId + ", " + name + ", " + typeInfo + ")"); } remote.lock.writeLock().lock(); try { Object existing = remote.byName.get(name); if( existing != null ) { throw new RuntimeException("Object already registered for:" + name); } RemoteObjectHandler remoteHandler = new RemoteObjectHandler(this, channel, objectId, typeInfo); Object remoteObject = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {typeInfo.getType()}, remoteHandler); remote.byName.put(name, remoteObject); remote.byId.put(objectId, remoteObject); } finally { remote.lock.writeLock().unlock(); } }
@Override public Object invoke(Object o, Method method, Object[] os) throws Throwable { MethodInfo mi = getMethodInfo(method); if( mi == null ) { // Try to invoke locally return method.invoke(this, os); } return rmi.invokeRemote(channel, objectId, mi.getId(), mi.getCallType(), os); }
@Override public Object invoke(Object o, Method method, Object[] os) throws Throwable { MethodInfo mi = getMethodInfo(method); if( mi == null ) { // Try to invoke locally return method.invoke(this, os); } return rmi.invokeRemote(channel, objectId, mi.getId(), mi.getCallType(), os); }
protected void addRemoteObject( byte channel, short objectId, String name, ClassInfo typeInfo ) { if( log.isLoggable(Level.FINEST) ) { log.finest("addRemoveObject(" + objectId + ", " + name + ", " + typeInfo + ")"); } remote.lock.writeLock().lock(); try { Object existing = remote.byName.get(name); if( existing != null ) { throw new RuntimeException("Object already registered for:" + name); } RemoteObjectHandler remoteHandler = new RemoteObjectHandler(this, channel, objectId, typeInfo); Object remoteObject = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {typeInfo.getType()}, remoteHandler); remote.byName.put(name, remoteObject); remote.byId.put(objectId, remoteObject); } finally { remote.lock.writeLock().unlock(); } }