@Override public Collection<DistributedObject> getDistributedObjects() { return delegatedInstance.getDistributedObjects(); }
@Override public Collection<DistributedObject> getDistributedObjects() { return delegatedInstance.getDistributedObjects(); }
@Override public Collection<DistributedObject> getDistributedObjects() { return delegate.getDistributedObjects(); }
protected void handleInstances(String[] args) { Collection<DistributedObject> distributedObjects = hazelcast.getDistributedObjects(); for (DistributedObject distributedObject : distributedObjects) { println(distributedObject); } }
@Override public Collection<String> getCacheNames() { Set<String> cacheNames = new HashSet<String>(); Collection<DistributedObject> distributedObjects = hazelcastInstance.getDistributedObjects(); for (DistributedObject distributedObject : distributedObjects) { if (distributedObject instanceof IMap) { IMap<?, ?> map = (IMap) distributedObject; cacheNames.add(map.getName()); } } return cacheNames; }
protected void handleInstances(String[] args) { Collection<DistributedObject> distributedObjects = hazelcast.getDistributedObjects(); for (DistributedObject distributedObject : distributedObjects) { println(distributedObject); } }
@Override public Collection<String> getCacheNames() { Set<String> cacheNames = new HashSet<String>(); Collection<DistributedObject> distributedObjects = hazelcastInstance.getDistributedObjects(); for (DistributedObject distributedObject : distributedObjects) { if (distributedObject instanceof IMap) { IMap<?, ?> map = (IMap) distributedObject; cacheNames.add(map.getName()); } } return cacheNames; }
protected void handleInstances(String[] args) { Collection<DistributedObject> distributedObjects = hazelcast.getDistributedObjects(); for (DistributedObject distributedObject : distributedObjects) { println(distributedObject); } }
protected void handleInstances(String[] args) { Collection<DistributedObject> distributedObjects = hazelcast.getDistributedObjects(); for (DistributedObject distributedObject : distributedObjects) { println(distributedObject); } }
@Override public Collection<String> getCacheNames() { Set<String> cacheNames = new HashSet<String>(); Collection<DistributedObject> distributedObjects = hazelcastInstance.getDistributedObjects(); for (DistributedObject distributedObject : distributedObjects) { if (distributedObject instanceof IMap) { IMap<?, ?> map = (IMap) distributedObject; cacheNames.add(map.getName()); } } return cacheNames; }
@Override public Collection<DistributedObject> getDistributedObjects() { return getHazelcastInstance().getDistributedObjects(); }
@Override public Iterable<String> getCacheNames() { if (this.hcInstance != null) { Collection<DistributedObject> distributedObjects = hcInstance.getDistributedObjects(); ArrayList<String> names = new ArrayList<String>(distributedObjects.size()); for (DistributedObject distributedObject : distributedObjects) { names.add(distributedObject.getName()); } return names; } else { return new ArrayList<String>(0); } }
private boolean removeClient(String clientId) { String qName = "client:" + clientId; boolean removed = false; java.util.Collection<DistributedObject> all = hzInstance.getDistributedObjects(); int sizeBefore = all.size(); for (DistributedObject obj: all) { if (qName.equals(obj.getName()) && QueueService.SERVICE_NAME.equals(obj.getServiceName())) { // remove queue obj.destroy(); removed = true; break; } } int sizeAfter = hzInstance.getDistributedObjects().size(); boolean r2 = repo.removeXQProcessor(clientId); logger.debug("removeClient.exit; queue {} {} for client: {}; size before: {}, after: {}; processor removed: {}", qName, removed ? "destroyed" : "skipped", clientId, sizeBefore, sizeAfter, r2); return removed; }
@Override public void resetCachers() { if (!getSecurityService().isSuperUser()) { throw new SecurityException("Only super admin can reset cachers, current user not super admin"); } if (this.hcInstance != null) { Collection<DistributedObject> distributedObjects = hcInstance.getDistributedObjects(); for (DistributedObject distributedObject : distributedObjects) { if (distributedObject instanceof IMap) { ((IMap)distributedObject).clear(); } } } }
@AfterEach void afterEach() { hz.getDistributedObjects().forEach(DistributedObject::destroy); }
@AfterEach void afterEach() { hz.getDistributedObjects().forEach(DistributedObject::destroy); }
@AfterEach void afterEach() { hz.getDistributedObjects().forEach(DistributedObject::destroy); }
@Override public void run() throws Exception { // hack to prevent overloading the system with get calls, else it is done many times a second sleepSeconds(10); long actual = 0; for (DistributedObject distributedObject : targetInstance.getDistributedObjects()) { String key = distributedObject.getName(); if (serviceName.equals(distributedObject.getServiceName()) && key.startsWith(name)) { actual += targetInstance.getAtomicLong(key).get(); } } assertEquals(expected, actual); } }, assertEventuallySeconds);
public static void main(String[] args) { Config config = new Config().addCacheConfig(createCacheSimpleConfig(BASE_CACHE_NAME + "_1")); HazelcastInstance instance = Hazelcast.newHazelcastInstance(config); CachingProvider cachingProvider = HazelcastServerCachingProvider.createCachingProvider(instance); CacheManager cacheManager = cachingProvider.getCacheManager(); // ICacheManager is Hazelcast-specific interface, not to be confused with JCache's CacheManager. // An instance of the ICacheManager can be obtained from a HazelcastInstance and used to get // a reference to an existing cache. ICacheManager hazelcastCacheManager = instance.getCacheManager(); ICache cache1 = hazelcastCacheManager.getCache(BASE_CACHE_NAME + "_1"); ICache cache2a = (ICache) cacheManager.createCache(BASE_CACHE_NAME + "_2", new CacheConfig(BASE_CACHE_NAME + "_2")); ICache cache2b = hazelcastCacheManager.getCache(BASE_CACHE_NAME + "_2"); System.out.println("cache2a (through CacheManager) == cache2b (through HazelcastInstance): " + (cache2a == cache2b)); System.out.println("Distributed objects before destroy:"); for (DistributedObject distributedObject : instance.getDistributedObjects()) { System.out.println("\t- Distributed object with name " + distributedObject.getName()); } cache1.destroy(); cache2a.destroy(); System.out.println("Distributed objects after destroy:"); for (DistributedObject distributedObject : instance.getDistributedObjects()) { System.out.println("\tDistributed object with name " + distributedObject.getName()); } instance.shutdown(); }
@Verify public void verify() { String serviceName = totalCounter.getServiceName(); String totalName = totalCounter.getName(); long actual = 0; for (DistributedObject distributedObject : targetInstance.getDistributedObjects()) { String key = distributedObject.getName(); if (serviceName.equals(distributedObject.getServiceName()) && key.startsWith(name) && !key.equals(totalName)) { actual += targetInstance.getAtomicLong(key).get(); } } assertEquals(totalCounter.get(), actual); }