@Override public int hashCode() { return this.cache.getCacheManager().getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName().hashCode() ^ this.cache.getName().hashCode(); }
@Override public boolean equals(Object object) { if ((object == null) || !(object instanceof InfinispanXAResourceRecovery)) return false; InfinispanXAResourceRecovery recovery = (InfinispanXAResourceRecovery) object; return this.cache.getCacheManager().getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName().equals(recovery.cache.getCacheManager().getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName()) && this.cache.getName().equals(recovery.cache.getName()); }
@Override public String toString() { return this.cache.getCacheManager().getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName() + "." + this.cache.getName(); } }
ClusteringServerLogger.ROOT_LOGGER.registryListenerFailed(e, this.cache.getCacheManager().getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName(), this.cache.getName(), type, entries);
@CacheEntryCreated @CacheEntryModified public void modified(CacheEntryEvent<T, Set<Address>> event) { if (event.isPre()) return; Map.Entry<Listener, ExecutorService> entry = this.listeners.get(event.getKey()); if (entry != null) { Listener listener = entry.getKey(); if (listener != null) { ExecutorService executor = entry.getValue(); Set<Node> members = new TreeSet<>(); for (Address address : event.getValue()) { members.add(this.group.createNode(address)); } try { executor.submit(() -> { try { listener.providersChanged(members); } catch (Throwable e) { ClusteringServerLogger.ROOT_LOGGER.serviceProviderRegistrationListenerFailed(e, this.cache.getCacheManager().getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName(), this.cache.getName(), members); } }); } catch (RejectedExecutionException e) { // Executor was shutdown } } } } }
@Override public String getName() { GlobalConfiguration global = this.cache.getCacheManager().getCacheManagerConfiguration(); TransportConfiguration transport = global.transport(); return transport.transport() != null ? transport.clusterName() : global.globalJmxStatistics().cacheManagerName(); }
/** * {@inheritDoc} * @see java.lang.Object#toString() */ @Override public String toString() { return this.cm.getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName(); }
private Result cacheManagerInfo(Session session) { EmbeddedCacheManager cacheManager = session.getCacheManager(); GlobalConfiguration globalConfiguration = cacheManager.getCacheManagerConfiguration(); return new StringResult(globalConfiguration.toString()); }
private GlobalConfiguration getGlobalConfiguration() { GlobalConfigurationBuilder builder = new GlobalConfigurationBuilder(); return builder.read(getWebCacheManager().getCacheManagerConfiguration()) .classLoader(Thread.currentThread().getContextClassLoader()) .transport().clusterName("wboss") .build(); } }
@Test public void getCacheManagerConfiguration() { GlobalConfiguration global = new GlobalConfigurationBuilder().build(); when(this.manager.getCacheManagerConfiguration()).thenReturn(global); GlobalConfiguration result = this.subject.getCacheManagerConfiguration(); assertSame(global, result); }
@Test(dataProvider = "params") public void runTest(ClusterExecutionPolicy policy, int site, int rack, int machine, int invocationCount) throws InterruptedException, ExecutionException, TimeoutException { actualInvocations.set(0); EmbeddedCacheManager cacheManager = cacheManagers.stream().filter(cm -> { TransportConfiguration tc = cm.getCacheManagerConfiguration().transport(); return Integer.valueOf(tc.siteId()) == site && Integer.valueOf(tc.rackId()) == rack && Integer.valueOf(tc.machineId()) == machine; }).findFirst().orElseThrow(() -> new AssertionError("No cache manager matches site: " + site + " rack: " + rack + " machine: " + machine)); cacheManager.executor().filterTargets(policy).submit(() -> actualInvocations.incrementAndGet()).get(10, TimeUnit.SECONDS); assertEquals(invocationCount, actualInvocations.get()); } }
public static Set<String> getInternalAndUserCacheNames(EmbeddedCacheManager cacheManager) { Set<String> testCaches = new HashSet<>(cacheManager.getCacheNames()); if (cacheManager.isDefaultRunning()) { String defaultCacheName = cacheManager.getCacheManagerConfiguration().defaultCacheName().orElse(CacheContainer.DEFAULT_CACHE_NAME); testCaches.add(defaultCacheName); } testCaches.addAll(getInternalCacheNames(cacheManager)); return testCaches; }
@Override public void call() { GlobalConfiguration globalCfg = cm.getCacheManagerConfiguration(); assertFalse(globalCfg.defaultCacheName().isPresent()); assertNull(cm.getDefaultCacheConfiguration()); assertEquals(CacheMode.REPL_SYNC, cm.getCacheConfiguration("default").clustering().cacheMode()); }
@Override public ClusterRoleMapper run() throws Exception { cacheManager = createCacheManager(); cpm = (ClusterRoleMapper) cacheManager.getCacheManagerConfiguration().security().authorization().principalRoleMapper(); cpm.grant("admin", "admin"); cache = cacheManager.getCache(); return cpm; } });
private void withClusteredServer(HotRodServerConfigurationBuilder builder, BiConsumer<Configuration, Long> consumer) { Stoppable.useCacheManager(TestCacheManagerFactory.createClusteredCacheManager(hotRodCacheConfiguration()), cm -> Stoppable.useServer(startHotRodServer(cm, serverPort(), builder), server -> { Configuration cfg = cm.getCacheConfiguration(server.getConfiguration().topologyCacheName()); consumer.accept(cfg, cm.getCacheManagerConfiguration().transport().distributedSyncTimeout()); })); }
@Override public void init(InitializationContext ctx) { this.configuration = ctx.getConfiguration(); this.cacheName = ctx.getCache().getName(); this.globalConfiguration = ctx.getCache().getCacheManager().getCacheManagerConfiguration(); this.marshalledEntryFactory = ctx.getMarshalledEntryFactory(); this.marshaller = ctx.getMarshaller(); this.timeService = ctx.getTimeService(); this.keyPartitioner = configuration.segmented() ? ctx.getKeyPartitioner() : null; this.isDistributedCache = ctx.getCache().getCacheConfiguration() != null && ctx.getCache().getCacheConfiguration().clustering().cacheMode().isDistributed(); }
public void testNoRecoveryManager() throws Exception { assert cache.getCacheConfiguration().transaction().transactionMode().isTransactional(); String jmxDomain = cacheManager.getCacheManagerConfiguration().globalJmxStatistics().domain(); assert !existsObject(getCacheObjectName(jmxDomain, cache.getName(), "RecoveryManager")); }
public void testRecoveryManagerInJmx() throws Exception { assert cache.getCacheConfiguration().transaction().transactionMode().isTransactional(); String jmxDomain = cacheManager.getCacheManagerConfiguration().globalJmxStatistics().domain(); assert !existsObject(getCacheObjectName(jmxDomain, cache.getName(), "RecoveryManager")); }
@Override public void call() { GlobalConfiguration globalCfg = cm.getCacheManagerConfiguration(); assertTrue(globalCfg.transport().transport() instanceof JGroupsTransport); assertEquals("demoCluster", globalCfg.transport().clusterName()); Configuration cfg = cm.getDefaultCacheConfiguration(); assertEquals(CacheMode.REPL_SYNC, cfg.clustering().cacheMode()); }
public void testDifferentDomain() throws Exception { GlobalConfigurationBuilder globalConfiguration = GlobalConfigurationBuilder.defaultClusteredBuilder(); globalConfiguration.globalJmxStatistics().enable().mBeanServerLookup(new PerThreadMBeanServerLookup()); cm = TestCacheManagerFactory.createClusteredCacheManager(globalConfiguration, new ConfigurationBuilder()); String jmxDomain = cm.getCacheManagerConfiguration().globalJmxStatistics().domain(); ConfigurationBuilder localCache = config();//local by default cm.defineConfiguration("local_cache", localCache.build()); cm.getCache("local_cache"); assert existsObject(getCacheObjectName(jmxDomain, "local_cache(local)", "Statistics")); }