public static void disconnect() { try { if (ds != null) { ds.disconnect(); } } finally { cache = null; ds = null; } }
public static void disconnectDSIfAny() { DistributedSystem ds = InternalDistributedSystem.getConnectedInstance(); if (ds != null) { ds.disconnect(); } }
private static void cleanupOffline() { if (offlineCache != null) { offlineCache.close(); offlineCache = null; } if (offlineDS != null) { offlineDS.disconnect(); offlineDS = null; } }
private void tearDown() { this.ds.disconnect(); }
protected void disconnect(Cache cache) { DistributedSystem dsys = cache.getDistributedSystem(); cache.close(); dsys.disconnect(); }
/** * Closes the "loner" <code>DistributedSystem</code> */ @After public void tearDown() throws Exception { if (this.system != null) { this.system.disconnect(); } this.system = null; }
@After public void teardown() { if (system != null) { system.disconnect(); } }
public static void closeCache() { if (expected != null) { expected.remove(); expected = null; } if (cache != null && !cache.isClosed()) { cache.close(); cache.getDistributedSystem().disconnect(); } }
public static void closeCache(boolean keepalive) { if (expected != null) { expected.remove(); expected = null; } if (cache != null && !cache.isClosed()) { cache.close(keepalive); cache.getDistributedSystem().disconnect(); } }
/** * Disconnects this VM from the distributed system */ public static void disconnectFromDS() { GemFireCacheImpl.testCacheXml = null; for (;;) { DistributedSystem ds = InternalDistributedSystem.getConnectedInstance(); if (ds == null) { break; } try { ds.disconnect(); } catch (Exception ignore) { } } AdminDistributedSystemImpl ads = AdminDistributedSystemImpl.getConnectedInstance(); if (ads != null) { ads.disconnect(); } } }
public static Boolean killAsyncEventQueue(String asyncQueueId) { Set<AsyncEventQueue> queues = cache.getAsyncEventQueues(); AsyncEventQueueImpl queue = null; for (AsyncEventQueue q : queues) { if (q.getId().equals(asyncQueueId)) { queue = (AsyncEventQueueImpl) q; break; } } if (queue.isPrimary()) { LogWriterUtils.getLogWriter().info("AsyncEventQueue is killed by a test"); cache.getDistributedSystem().disconnect(); return Boolean.TRUE; } return Boolean.FALSE; }
@Override public void afterCreate(EntryEvent event) { if ((Long) event.getKey() == 900) { cache.getLogger().fine(" Gateway sender is killed by a test"); cache.close(); cache.getDistributedSystem().disconnect(); } } };
private Cache createCacheV(Properties props) { DistributedSystem ds = getSystem(props); assertNotNull(ds); ds.disconnect(); ds = getSystem(props); Cache cache = getCache(); assertNotNull(cache); return cache; }
private void createCache(Properties props) throws Exception { DistributedSystem ds = getSystem(props); assertNotNull(ds); ds.disconnect(); ds = getSystem(props); cache = CacheFactory.create(ds); assertNotNull(cache); }
protected static void closeCache() { removeExpectedExceptions(ignoredExceptions); if (cache != null && !cache.isClosed()) { DistributedSystem sys = cache.getDistributedSystem(); cache.close(); sys.disconnect(); cache = null; } disconnectFromDS(); }
protected static void closeCache(final Boolean keepAlive) { removeExpectedExceptions(ignoredExceptions); if (cache != null && !cache.isClosed()) { DistributedSystem sys = cache.getDistributedSystem(); cache.close(keepAlive); sys.disconnect(); cache = null; } disconnectFromDS(); }
public static void killSender() { LogWriterUtils.getLogWriter().info("Gateway sender is going to be killed by a test"); cache.close(); cache.getDistributedSystem().disconnect(); LogWriterUtils.getLogWriter().info("Gateway sender is killed by a test"); }
private void createClientCache(Properties props, ClientCacheFactory ccf) throws Exception { DistributedSystem ds = getSystem(props); assertNotNull(ds); ds.disconnect(); ClientCache cc = ccf.create(); setSystem(props, cc.getDistributedSystem()); cache = (Cache) cc; assertNotNull(cache); expected = IgnoredException .addIgnoredException("java.net.ConnectionException||java.net.SocketException"); }
public static void closeCache() throws IOException { if (cache != null && !cache.isClosed()) { cache.close(); cache.getDistributedSystem().disconnect(); cache = null; } else { AsyncEventQueueTestBase test = new AsyncEventQueueTestBase(); if (test.isConnectedToDS()) { test.getSystem().disconnect(); } } }
public static Boolean killSender(String senderId) { final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect"); IgnoredException exp = IgnoredException.addIgnoredException(CacheClosedException.class.getName()); IgnoredException exp1 = IgnoredException.addIgnoredException(ForceReattemptException.class.getName()); try { Set<GatewaySender> senders = cache.getGatewaySenders(); AbstractGatewaySender sender = null; for (GatewaySender s : senders) { if (s.getId().equals(senderId)) { sender = (AbstractGatewaySender) s; break; } } if (sender.isPrimary()) { LogWriterUtils.getLogWriter().info("Gateway sender is killed by a test"); cache.getDistributedSystem().disconnect(); return Boolean.TRUE; } return Boolean.FALSE; } finally { exp.remove(); exp1.remove(); exln.remove(); } }