@Override protected Operation prepareOperation() { return new InitializeDistributedObjectOperation(parameters.serviceName, parameters.name); }
@Override public void run() throws Exception { ProxyServiceImpl proxyService = getService(); proxyService.destroyLocalDistributedObject(serviceName, name, false); }
@Override public void run() throws Exception { if (proxies == null || proxies.size() <= 0) { return; } NodeEngine nodeEngine = getNodeEngine(); ProxyServiceImpl proxyService = getService(); ExecutionService executionService = nodeEngine.getExecutionService(); for (final ProxyInfo proxy : proxies) { final ProxyRegistry registry = proxyService.getOrCreateRegistry(proxy.getServiceName()); try { executionService.execute(ExecutionService.SYSTEM_EXECUTOR, new CreateProxyTask(registry, proxy)); } catch (Throwable t) { logProxyCreationFailure(proxy, t); } } }
return new SendEventOperation(); case DIST_OBJECT_INIT: return new InitializeDistributedObjectOperation(); case DIST_OBJECT_DESTROY: return new DistributedObjectDestroyOperation(); case POST_JOIN_PROXY: return new PostJoinProxyOperation(); case TRUE_EVENT_FILTER: return new TrueEventFilter();
@Override public Operation get() { List<ProxyInfo> proxyInfos = new ArrayList<ProxyInfo>(parameters.proxies.size()); for (Map.Entry<String, String> proxy : parameters.proxies) { proxyInfos.add(new ProxyInfo(proxy.getValue(), proxy.getKey())); } return new PostJoinProxyOperation(proxyInfos); }
@Override public void run() throws Exception { ProxyService proxyService = getNodeEngine().getProxyService(); proxyService.initializeDistributedObject(serviceName, name); }
private void logProxyCreationFailure(ProxyInfo proxy, Throwable t) { getLogger().severe("Cannot create proxy [" + proxy.getServiceName() + ":" + proxy.getObjectName() + "]!", t); }
@Override public void destroyDistributedObject(String serviceName, String name) { checkServiceNameNotNull(serviceName); checkObjectNameNotNull(name); OperationService operationService = nodeEngine.getOperationService(); Collection<Member> members = nodeEngine.getClusterService().getMembers(); Collection<Future> calls = new ArrayList<Future>(members.size()); for (Member member : members) { if (member.localMember()) { continue; } DistributedObjectDestroyOperation operation = new DistributedObjectDestroyOperation(serviceName, name); Future f = operationService.createInvocationBuilder(SERVICE_NAME, operation, member.getAddress()) .setTryCount(TRY_COUNT).invoke(); calls.add(f); } destroyLocalDistributedObject(serviceName, name, true); waitWithDeadline(calls, DESTROY_TIMEOUT_SECONDS, TimeUnit.SECONDS, destroyProxyExceptionHandler); }
@Override public void run() throws Exception { if (proxies == null || proxies.size() <= 0) { return; } NodeEngine nodeEngine = getNodeEngine(); ProxyServiceImpl proxyService = getService(); ExecutionService executionService = nodeEngine.getExecutionService(); for (final ProxyInfo proxy : proxies) { final ProxyRegistry registry = proxyService.getOrCreateRegistry(proxy.getServiceName()); try { executionService.execute(ExecutionService.SYSTEM_EXECUTOR, new CreateProxyTask(registry, proxy)); } catch (Throwable t) { logProxyCreationFailure(proxy, t); } } }
return new SendEventOperation(); case DIST_OBJECT_INIT: return new InitializeDistributedObjectOperation(); case DIST_OBJECT_DESTROY: return new DistributedObjectDestroyOperation(); case POST_JOIN_PROXY: return new PostJoinProxyOperation(); case TRUE_EVENT_FILTER: return new TrueEventFilter();
@Override public Operation getPostJoinOperation() { Collection<ProxyInfo> proxies = new LinkedList<ProxyInfo>(); for (ProxyRegistry registry : registries.values()) { registry.getProxyInfos(proxies); } return proxies.isEmpty() ? null : new PostJoinProxyOperation(proxies); }
@Override protected Operation prepareOperation() { return new InitializeDistributedObjectOperation(parameters.serviceName, parameters.name); }
@Override public void run() throws Exception { ProxyServiceImpl proxyService = getService(); proxyService.destroyLocalDistributedObject(serviceName, name, false); }
@Override public void run() throws Exception { ProxyService proxyService = getNodeEngine().getProxyService(); proxyService.initializeDistributedObject(serviceName, name); }
private void logProxyCreationFailure(ProxyInfo proxy, Throwable t) { getLogger().severe("Cannot create proxy [" + proxy.getServiceName() + ":" + proxy.getObjectName() + "]!", t); }
@Override public void destroyDistributedObject(String serviceName, String name) { checkServiceNameNotNull(serviceName); checkObjectNameNotNull(name); OperationService operationService = nodeEngine.getOperationService(); Collection<Member> members = nodeEngine.getClusterService().getMembers(); Collection<Future> calls = new ArrayList<Future>(members.size()); for (Member member : members) { if (member.localMember()) { continue; } DistributedObjectDestroyOperation operation = new DistributedObjectDestroyOperation(serviceName, name); Future f = operationService.createInvocationBuilder(SERVICE_NAME, operation, member.getAddress()) .setTryCount(TRY_COUNT).invoke(); calls.add(f); } destroyLocalDistributedObject(serviceName, name, true); waitWithDeadline(calls, DESTROY_TIMEOUT_SECONDS, TimeUnit.SECONDS, destroyProxyExceptionHandler); }
@Override public Operation getPostJoinOperation() { Collection<ProxyInfo> proxies = new LinkedList<ProxyInfo>(); for (ProxyRegistry registry : registries.values()) { registry.getProxyInfos(proxies); } return proxies.isEmpty() ? null : new PostJoinProxyOperation(proxies); }
@Override public Operation get() { List<ProxyInfo> proxyInfos = new ArrayList<ProxyInfo>(parameters.proxies.size()); for (Map.Entry<String, String> proxy : parameters.proxies) { proxyInfos.add(new ProxyInfo(proxy.getValue(), proxy.getKey())); } return new PostJoinProxyOperation(proxyInfos); }