public <T> T getExposedObject(String name, Class<T> type, boolean waitFor) throws InterruptedException{ RemoteObject ro = remoteObjects.get(name); if (ro == null){ if (!waitFor) throw new RuntimeException("Cannot find remote object named: " + name); else{ do { synchronized (receiveObjectLock){ receiveObjectLock.wait(); } } while ( (ro = remoteObjects.get(name)) == null ); } } Object proxy = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{ type }, ro); ro.loadMethods(type); return (T) proxy; }
public <T> T getExposedObject(String name, Class<T> type, boolean waitFor) throws InterruptedException{ RemoteObject ro = remoteObjects.get(name); if (ro == null){ if (!waitFor) throw new RuntimeException("Cannot find remote object named: " + name); else{ do { synchronized (receiveObjectLock){ receiveObjectLock.wait(); } } while ( (ro = remoteObjects.get(name)) == null ); } } Object proxy = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{ type }, ro); ro.loadMethods(type); return (T) proxy; }
public <T> T getExposedObject(String name, Class<T> type, boolean waitFor) throws InterruptedException{ RemoteObject ro = remoteObjects.get(name); if (ro == null){ if (!waitFor) throw new RuntimeException("Cannot find remote object named: " + name); else{ do { synchronized (receiveObjectLock){ receiveObjectLock.wait(); } } while ( (ro = remoteObjects.get(name)) == null ); } } Object proxy = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{ type }, ro); ro.loadMethods(type); return (T) proxy; }