@Override public ModelNode execute(EmbeddedCacheManager manager) { Address address = manager.getCoordinator(); return (address != null) ? new ModelNode(address.toString()) : null; } },
/** * {@inheritDoc} * @see org.infinispan.manager.EmbeddedCacheManager#getCoordinator() */ @Override public Address getCoordinator() { return this.container.getCoordinator(); }
@Override public ModelNode execute(EmbeddedCacheManager manager) { Address address = manager.getCoordinator(); return (address != null) ? new ModelNode(address.toString()) : null; } },
@Override public InetAddress getActiveAddress() { EmbeddedCacheManager manager = this.cm; if (manager == null) { // In case we cannot fetch the information, lets assume we // are standby, so to have less responsibility. return null; } return addressToInetAddress(manager.getCoordinator()); }
@Test public void getCoordinator() { Address expected = mock(Address.class); when(this.manager.getCoordinator()).thenReturn(expected); Address result = this.subject.getCoordinator(); assertSame(expected, result); }
if (cacheManager.getCoordinator() instanceof JGroupsAddress && cacheManager.getTransport() instanceof JGroupsTransport) org.jgroups.Address jgAddress = ((JGroupsAddress)cacheManager.getCoordinator()).getJGroupsAddress(); + cacheManager.getCoordinator().getClass().getName());
@CacheStarted public void logCacheManagerStart(final CacheStartedEvent event) { Logger log = LogManager.getLogger("MAIN"); EmbeddedCacheManager cacheManager = event.getCacheManager(); if (!cacheManager.getCacheManagerConfiguration().isClustered()) { // Local Infinispan (no cluster) log.info("[CM8008] Infinispan clustering: not configured"); } else if (clusterInfoLogged.compareAndSet(false, true)) { // Clustered Infinispan, log cluster conf for the first start cache event only // to prevent duplicate log lines with same cluster info log.info("[CM8007] Infinispan status: {}", cacheManager.getStatus()); log.info("[CM8009] Infinispan cluster name: {}", cacheManager.getCacheManagerConfiguration().transport().clusterName()); log.info("[CM8010] Infinispan cluster local node logical address: {}", cacheManager.getAddress()); log.info("[CM8019] Infinispan cluster local node physical address(es): {}", cacheManager.getCacheManagerConfiguration().transport().transport().getPhysicalAddresses()); log.info("[CM8011] Infinispan cluster coordinator logical address: {}", cacheManager.getCoordinator()); log.info("[CM8016] Infinispan cluster local node is coordinator: {}", cacheManager.isCoordinator()); log.info("[CM8012] Infinispan cluster members: {}", cacheManager.getMembers()); log.info("[CM8013] Infinispan cluster distributed sync timeout: {}", cacheManager.getCacheManagerConfiguration().transport().distributedSyncTimeout()); log.info("[CM8014] Infinispan cluster JGroups configuration file: {}", cacheManager.getCacheManagerConfiguration().transport().properties().getProperty("configurationFile")); } final Date now = new Date(); log.info("[CM8006] Started Infinispan {} cache {} in {} ms", cacheManager.getCacheConfiguration(event.getCacheName()).clustering().cacheModeString(), event.getCacheName(), now.getTime() - initiationTimestamp.getTime()); } }
@Test(dependsOnMethods = "testLargeClusterStart") public void testLargeClusterStop() { for (int i = 0; i < NUM_NODES - 1; i++) { int killIndex = -1; for (int j = 0; j < cacheManagers.size(); j++) { if (address(j).equals(manager(0).getCoordinator())) { killIndex = j; break; } } log.debugf("Killing coordinator %s", address(killIndex)); manager(killIndex).stop(); cacheManagers.remove(killIndex); if (cacheManagers.size() > 0) { TestingUtil.blockUntilViewsReceived(60000, false, cacheManagers); for (int j = 0; j < NUM_CACHES/2; j++) { TestingUtil.waitForNoRebalance(caches("repl-cache-" + j)); TestingUtil.waitForNoRebalance(caches("dist-cache-" + j)); } } } }
@Test(dependsOnMethods = "testLargeClusterStart") public void testLargeClusterStop() { for (int i = 0; i < NUM_NODES - 1; i++) { int killIndex = -1; for (int j = 0; j < cacheManagers.size(); j++) { if (address(j).equals(manager(0).getCoordinator())) { killIndex = j; break; } } log.debugf("Killing coordinator %s", address(killIndex)); manager(killIndex).stop(); cacheManagers.remove(killIndex); if (cacheManagers.size() > 0) { TestingUtil.blockUntilViewsReceived(60000, false, cacheManagers); for (int j = 0; j < NUM_CACHES/2; j++) { TestingUtil.waitForNoRebalance(caches("repl-cache-" + j)); TestingUtil.waitForNoRebalance(caches("dist-cache-" + j)); } } } }
blockRebalanceConfirmation(primaryOwnerCache.getCacheManager(), checkPoint, rebalanceTopologyId); assertEquals(primaryOwnerCache.getCacheManager().getCoordinator(), primaryOwnerCache.getCacheManager().getAddress()); eventuallyEquals(2, () -> nonOwnerCache.getRpcManager().getMembers().size()); assertEquals(primaryOwnerCache.getCacheManager().getCoordinator(), primaryOwnerCache.getCacheManager().getAddress());