public void destroy() { for (ClientProxyFuture future : proxies.values()) { future.get().onShutdown(); } proxies.clear(); }
proxy.getDistributedObjectName()); ClientProxyFuture registeredProxyFuture = proxies.remove(objectNamespace); ClientProxy registeredProxy = registeredProxyFuture == null ? null : registeredProxyFuture.get();
proxy.getDistributedObjectName()); ClientProxyFuture registeredProxyFuture = proxies.remove(objectNamespace); ClientProxy registeredProxy = registeredProxyFuture == null ? null : registeredProxyFuture.get();
public ClientProxy getOrCreateProxy(String service, String id) { final ObjectNamespace ns = new DistributedObjectNamespace(service, id); ClientProxyFuture proxyFuture = proxies.get(ns); if (proxyFuture != null) { return proxyFuture.get(); } ClientProxyFactory factory = proxyFactories.get(service); if (factory == null) { throw new ClientServiceNotFoundException("No factory registered for service: " + service); } proxyFuture = new ClientProxyFuture(); ClientProxyFuture current = proxies.putIfAbsent(ns, proxyFuture); if (current != null) { return current.get(); } try { ClientProxy clientProxy = createClientProxy(id, factory); initializeWithRetry(clientProxy); proxyFuture.set(clientProxy); return clientProxy; } catch (Throwable e) { proxies.remove(ns); proxyFuture.set(e); throw rethrow(e); } }
public ClientProxy getOrCreateProxy(String service, String id) { final ObjectNamespace ns = new DistributedObjectNamespace(service, id); ClientProxyFuture proxyFuture = proxies.get(ns); if (proxyFuture != null) { return proxyFuture.get(); } ClientProxyFactory factory = proxyFactories.get(service); if (factory == null) { throw new ClientServiceNotFoundException("No factory registered for service: " + service); } proxyFuture = new ClientProxyFuture(); ClientProxyFuture current = proxies.putIfAbsent(ns, proxyFuture); if (current != null) { return current.get(); } try { ClientProxy clientProxy = createClientProxy(id, factory); initializeWithRetry(clientProxy); proxyFuture.set(clientProxy); return clientProxy; } catch (Throwable e) { proxies.remove(ns); proxyFuture.set(e); throw rethrow(e); } }
/** * Locally destroys the proxy identified by the given service and object ID. * <p> * Upon successful completion the proxy is unregistered in this proxy * manager and all local resources associated with the proxy are released. * * @param service the service associated with the proxy. * @param id the ID of the object to destroy the proxy of. */ public void destroyProxyLocally(String service, String id) { ObjectNamespace objectNamespace = new DistributedObjectNamespace(service, id); ClientProxyFuture clientProxyFuture = proxies.remove(objectNamespace); if (clientProxyFuture != null) { ClientProxy clientProxy = clientProxyFuture.get(); clientProxy.destroyLocally(); } }
/** * Locally destroys the proxy identified by the given service and object ID. * <p> * Upon successful completion the proxy is unregistered in this proxy * manager and all local resources associated with the proxy are released. * * @param service the service associated with the proxy. * @param id the ID of the object to destroy the proxy of. */ public void destroyProxyLocally(String service, String id) { ObjectNamespace objectNamespace = new DistributedObjectNamespace(service, id); ClientProxyFuture clientProxyFuture = proxies.remove(objectNamespace); if (clientProxyFuture != null) { ClientProxy clientProxy = clientProxyFuture.get(); clientProxy.destroyLocally(); } }
@Override public void handleDistributedObjectEventV10(String name, String serviceName, String eventTypeName) { final ObjectNamespace ns = new DistributedObjectNamespace(serviceName, name); ClientProxyFuture future = proxies.get(ns); ClientProxy proxy = future == null ? null : future.get(); DistributedObjectEvent.EventType eventType = DistributedObjectEvent.EventType.valueOf(eventTypeName); LazyDistributedObjectEvent event = new LazyDistributedObjectEvent(eventType, serviceName, name, proxy, proxyManager); if (DistributedObjectEvent.EventType.CREATED.equals(eventType)) { listener.distributedObjectCreated(event); } else if (DistributedObjectEvent.EventType.DESTROYED.equals(eventType)) { listener.distributedObjectDestroyed(event); } }
@Override public void handleDistributedObjectEventV10(String name, String serviceName, String eventTypeName) { final ObjectNamespace ns = new DistributedObjectNamespace(serviceName, name); ClientProxyFuture future = proxies.get(ns); ClientProxy proxy = future == null ? null : future.get(); DistributedObjectEvent.EventType eventType = DistributedObjectEvent.EventType.valueOf(eventTypeName); LazyDistributedObjectEvent event = new LazyDistributedObjectEvent(eventType, serviceName, name, proxy, proxyManager); if (DistributedObjectEvent.EventType.CREATED.equals(eventType)) { listener.distributedObjectCreated(event); } else if (DistributedObjectEvent.EventType.DESTROYED.equals(eventType)) { listener.distributedObjectDestroyed(event); } }
public Collection<? extends DistributedObject> getDistributedObjects() { Collection<DistributedObject> objects = new LinkedList<DistributedObject>(); for (ClientProxyFuture future : proxies.values()) { objects.add(future.get()); } return objects; }
public void destroy() { for (ClientProxyFuture future : proxies.values()) { future.get().onShutdown(); } proxies.clear(); }
public Collection<? extends DistributedObject> getDistributedObjects() { Collection<DistributedObject> objects = new LinkedList<DistributedObject>(); for (ClientProxyFuture future : proxies.values()) { objects.add(future.get()); } return objects; }