public static boolean existsDistributedObject(NodeEngine nodeEngine, String serviceName, String objectName) { return nodeEngine.getProxyService() .getDistributedObjectNames(serviceName) .contains(objectName); }
public MapPartitionAwareService(MapServiceContext mapServiceContext) { this.mapServiceContext = mapServiceContext; this.nodeEngine = mapServiceContext.getNodeEngine(); this.proxyService = this.nodeEngine.getProxyService(); }
public MapPartitionAwareService(MapServiceContext mapServiceContext) { this.mapServiceContext = mapServiceContext; this.nodeEngine = mapServiceContext.getNodeEngine(); this.proxyService = this.nodeEngine.getProxyService(); }
/** * Some maps may have a proxy but no data has been put yet. Think of one created a proxy but not put any data in it. * By calling this method we are returning an empty stats object for those maps. This is helpful to monitor those kind * of maps. */ private void addStatsOfNoDataIncludedMaps(Map statsPerMap) { ProxyService proxyService = nodeEngine.getProxyService(); Collection<String> mapNames = proxyService.getDistributedObjectNames(SERVICE_NAME); for (String mapName : mapNames) { if (!statsPerMap.containsKey(mapName)) { statsPerMap.put(mapName, EMPTY_LOCAL_MAP_STATS); } } }
/** * Some maps may have a proxy but no data has been put yet. Think of one created a proxy but not put any data in it. * By calling this method we are returning an empty stats object for those maps. This is helpful to monitor those kind * of maps. */ private void addStatsOfNoDataIncludedMaps(Map statsPerMap) { ProxyService proxyService = nodeEngine.getProxyService(); Collection<String> mapNames = proxyService.getDistributedObjectNames(SERVICE_NAME); for (String mapName : mapNames) { if (!statsPerMap.containsKey(mapName)) { statsPerMap.put(mapName, EMPTY_LOCAL_MAP_STATS); } } }
@Override public Map<String, LocalReplicatedMapStats> getStats() { Collection<String> maps = getNodeEngine().getProxyService().getDistributedObjectNames(SERVICE_NAME); Map<String, LocalReplicatedMapStats> mapStats = new HashMap<String, LocalReplicatedMapStats>(maps.size()); for (String map : maps) { mapStats.put(map, createReplicatedMapStats(map)); } return mapStats; }
@Override public Map<String, LocalReplicatedMapStats> getStats() { Collection<String> maps = getNodeEngine().getProxyService().getDistributedObjectNames(SERVICE_NAME); Map<String, LocalReplicatedMapStats> mapStats = new HashMap<String, LocalReplicatedMapStats>(maps.size()); for (String map : maps) { mapStats.put(map, createReplicatedMapStats(map)); } return mapStats; }
@Override public void run() throws Exception { ProxyService proxyService = getNodeEngine().getProxyService(); proxyService.initializeDistributedObject(serviceName, name); }
@Override public void run() throws Exception { ProxyService proxyService = getNodeEngine().getProxyService(); proxyService.initializeDistributedObject(serviceName, name); }
/** * Schedules the queue for destruction if the queue is empty. Destroys the queue immediately the queue is empty and the * {@link QueueConfig#getEmptyQueueTtl()} is 0. Upon scheduled execution, the queue will be checked if it is still empty. */ private void scheduleEvictionIfEmpty() { int emptyQueueTtl = config.getEmptyQueueTtl(); if (emptyQueueTtl < 0) { return; } if (getItemQueue().isEmpty() && txMap.isEmpty() && !isEvictionScheduled) { if (emptyQueueTtl == 0) { nodeEngine.getProxyService().destroyDistributedObject(QueueService.SERVICE_NAME, name); } else { service.scheduleEviction(name, TimeUnit.SECONDS.toMillis(emptyQueueTtl)); isEvictionScheduled = true; } } }
@Override protected Object call() { final MapService mapService = getService(MapService.SERVICE_NAME); final DistributedObject distributedObject = mapService.getMapServiceContext().getNodeEngine().getProxyService() .getDistributedObject(MapService.SERVICE_NAME, parameters.name); final MapProxyImpl mapProxy = (MapProxyImpl) distributedObject; mapProxy.loadAll(parameters.replaceExistingValues); return null; }
@Override protected Object call() throws Exception { MapService mapService = getService(SERVICE_NAME); MapServiceContext mapServiceContext = mapService.getMapServiceContext(); NodeEngine nodeEngine = mapServiceContext.getNodeEngine(); ProxyService proxyService = nodeEngine.getProxyService(); DistributedObject distributedObject = proxyService.getDistributedObject(SERVICE_NAME, parameters.name); MapProxyImpl mapProxy = (MapProxyImpl) distributedObject; mapProxy.flush(); return null; }
@Override protected Object call() { final MapService mapService = getService(MapService.SERVICE_NAME); final DistributedObject distributedObject = mapService.getMapServiceContext().getNodeEngine().getProxyService() .getDistributedObject(MapService.SERVICE_NAME, parameters.name); final MapProxyImpl mapProxy = (MapProxyImpl) distributedObject; mapProxy.loadAll(parameters.replaceExistingValues); return null; }
@Override protected Object call() throws Exception { MapService mapService = getService(SERVICE_NAME); MapServiceContext mapServiceContext = mapService.getMapServiceContext(); NodeEngine nodeEngine = mapServiceContext.getNodeEngine(); ProxyService proxyService = nodeEngine.getProxyService(); DistributedObject distributedObject = proxyService.getDistributedObject(SERVICE_NAME, parameters.name); MapProxyImpl mapProxy = (MapProxyImpl) distributedObject; mapProxy.flush(); return null; }
@Override public void run() throws Exception { final QueueContainer queueContainer = getContainer(); if (queueContainer.isEvictable()) { ProxyService proxyService = getNodeEngine().getProxyService(); proxyService.destroyDistributedObject(getServiceName(), name); } }
@Override public void run() throws Exception { final QueueContainer queueContainer = getContainer(); if (queueContainer.isEvictable()) { ProxyService proxyService = getNodeEngine().getProxyService(); proxyService.destroyDistributedObject(getServiceName(), name); } }
@Override public final void destroy() { if (preDestroy()) { NodeEngine engine = getNodeEngine(); ProxyService proxyService = engine.getProxyService(); proxyService.destroyDistributedObject(getServiceName(), getDistributedObjectName()); postDestroy(); } }
@Override public final void destroy() { if (preDestroy()) { NodeEngine engine = getNodeEngine(); ProxyService proxyService = engine.getProxyService(); proxyService.destroyDistributedObject(getServiceName(), getDistributedObjectName()); postDestroy(); } }
@Override public void run() throws Exception { FlakeIdGeneratorProxy proxy = (FlakeIdGeneratorProxy) getNodeEngine().getProxyService() .getDistributedObject(getServiceName(), flakeIdGenName); final IdBatchAndWaitTime result = proxy.newIdBaseLocal(batchSize); if (result.waitTimeMillis == 0) { sendResponse(result.idBatch.base()); } else { getNodeEngine().getExecutionService().schedule(new Runnable() { @Override public void run() { sendResponse(result.idBatch.base()); } }, result.waitTimeMillis, TimeUnit.MILLISECONDS); } }
@Override public void run() throws Exception { FlakeIdGeneratorProxy proxy = (FlakeIdGeneratorProxy) getNodeEngine().getProxyService() .getDistributedObject(getServiceName(), flakeIdGenName); final IdBatchAndWaitTime result = proxy.newIdBaseLocal(batchSize); if (result.waitTimeMillis == 0) { sendResponse(result.idBatch.base()); } else { getNodeEngine().getExecutionService().schedule(new Runnable() { @Override public void run() { sendResponse(result.idBatch.base()); } }, result.waitTimeMillis, TimeUnit.MILLISECONDS); } }