@Override public DistributedObject getDistributedObject(String serviceName, String name) { checkServiceNameNotNull(serviceName); checkObjectNameNotNull(name); ProxyRegistry registry = getOrCreateRegistry(serviceName); return registry.getOrCreateProxy(name, true); }
@Override public void run() throws Exception { ProxyServiceImpl proxyService = getService(); proxyService.destroyLocalDistributedObject(serviceName, name, false); }
@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 Collection<String> getDistributedObjectNames(String serviceName) { checkServiceNameNotNull(serviceName); ProxyRegistry registry = registries.get(serviceName); if (registry == null) { return Collections.emptySet(); } else { return registry.getDistributedObjectNames(); } }
@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); } } }
public void start() { RuntimeMetricSet.register(metricsRegistry); GarbageCollectionMetricSet.register(metricsRegistry); OperatingSystemMetricSet.register(metricsRegistry); ThreadMetricSet.register(metricsRegistry); ClassLoadingMetricSet.register(metricsRegistry); FileMetricSet.register(metricsRegistry); if (node.getProperties().getBoolean(METRICS_DISTRIBUTED_DATASTRUCTURES)) { new StatisticsAwareMetricsSet(serviceManager, this).register(metricsRegistry); } metricsRegistry.scanAndRegister(node.getNodeExtension().getMemoryStats(), "memory"); metricsRegistry.collectMetrics(operationService, proxyService, eventService, operationParker); serviceManager.start(); proxyService.init(); operationService.start(); quorumService.start(); diagnostics.start(); node.getNodeExtension().registerPlugins(diagnostics); }
proxyService.shutdown();
this.logger = node.getLogger(NodeEngine.class.getName()); this.metricsRegistry = newMetricRegistry(node); this.proxyService = new ProxyServiceImpl(this); this.serviceManager = new ServiceManagerImpl(this); this.executionService = new ExecutionServiceImpl(this);
if (listener instanceof DistributedObjectListener) { final ProxyServiceImpl proxyService = (ProxyServiceImpl) nodeEngine.getProxyService(); proxyService.addProxyListener((DistributedObjectListener) listener); known = true;
@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 Collection<DistributedObject> getDistributedObjects(String serviceName) { checkServiceNameNotNull(serviceName); Collection<DistributedObject> result = new LinkedList<DistributedObject>(); ProxyRegistry registry = registries.get(serviceName); if (registry != null) { registry.getDistributedObjects(result); } return result; }
@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); } } }
public void start() { RuntimeMetricSet.register(metricsRegistry); GarbageCollectionMetricSet.register(metricsRegistry); OperatingSystemMetricSet.register(metricsRegistry); ThreadMetricSet.register(metricsRegistry); ClassLoadingMetricSet.register(metricsRegistry); FileMetricSet.register(metricsRegistry); if (node.getProperties().getBoolean(METRICS_DISTRIBUTED_DATASTRUCTURES)) { new StatisticsAwareMetricsSet(serviceManager, this).register(metricsRegistry); } metricsRegistry.scanAndRegister(node.getNodeExtension().getMemoryStats(), "memory"); metricsRegistry.collectMetrics(operationService, proxyService, eventService, operationParker); serviceManager.start(); proxyService.init(); operationService.start(); quorumService.start(); diagnostics.start(); node.getNodeExtension().registerPlugins(diagnostics); }
proxyService.shutdown();
this.logger = node.getLogger(NodeEngine.class.getName()); this.metricsRegistry = newMetricRegistry(node); this.proxyService = new ProxyServiceImpl(this); this.serviceManager = new ServiceManagerImpl(this); this.executionService = new ExecutionServiceImpl(this);
if (listener instanceof DistributedObjectListener) { final ProxyServiceImpl proxyService = (ProxyServiceImpl) nodeEngine.getProxyService(); proxyService.addProxyListener((DistributedObjectListener) listener); known = true;
@Override public DistributedObject getDistributedObject(String serviceName, String name) { checkServiceNameNotNull(serviceName); checkObjectNameNotNull(name); ProxyRegistry registry = getOrCreateRegistry(serviceName); return registry.getOrCreateProxy(name, true); }
@Override public Collection<DistributedObject> getDistributedObjects(String serviceName) { checkServiceNameNotNull(serviceName); Collection<DistributedObject> result = new LinkedList<DistributedObject>(); ProxyRegistry registry = registries.get(serviceName); if (registry != null) { registry.getDistributedObjects(result); } return result; }
@Override public void dispatchEvent(final DistributedObjectEventPacket eventPacket, Object ignore) { String serviceName = eventPacket.getServiceName(); if (eventPacket.getEventType() == CREATED) { try { final ProxyRegistry registry = getOrCreateRegistry(serviceName); if (!registry.contains(eventPacket.getName())) { registry.createProxy(eventPacket.getName(), false, true); // listeners will be called if proxy is created here. } } catch (HazelcastInstanceNotActiveException ignored) { ignore(ignored); } } else { final ProxyRegistry registry = registries.get(serviceName); if (registry != null) { registry.destroyProxy(eventPacket.getName(), false); } } }
@Override public void run() throws Exception { ProxyServiceImpl proxyService = getService(); proxyService.destroyLocalDistributedObject(serviceName, name, false); }