If a session is found in the distributed cache, it is added to the collection of those being managed locally.
null
179180181182183184185186187188189
// Failover request setHandler = new SetAttributesRequestHandler(getAttributeMap(), false); log.info("failover request"); SessionTestUtil.invokeRequest(jbcm1, setHandler, sessionId); WeakReference<Session> session1A = new WeakReference<Session>(jbcm1.findSession(sessionId)); SessionTestUtil.cleanupPipeline(jbcm1); assertNotNull(session1A.get()); assertEquals(1, Attribute.attributeCount()); // Passivate
203204205206207208209210211212213
// Reactivate BasicRequestHandler getHandler = new BasicRequestHandler(KEYS, false); log.info("activate node 1"); SessionTestUtil.invokeRequest(jbcm1, getHandler, sessionId); WeakReference<Session> session1B = new WeakReference<Session>(jbcm1.findSession(sessionId)); SessionTestUtil.cleanupPipeline(jbcm1); assertNotNull(session1B.get()); assertEquals(1, Attribute.attributeCount()); // Fail back
260261262263264265266267268269270
log.info("fail over request"); SessionTestUtil.invokeRequest(jbcm1, setHandler, sessionId); assertNotNull(setHandler.getCheckedAttributes().get(KEY)); assertEquals(Attribute.COUNT -1, ((Attribute) setHandler.getCheckedAttributes().get(KEY)).getCount()); WeakReference<Session> session1A = new WeakReference<Session>(jbcm1.findSession(sessionId)); SessionTestUtil.cleanupPipeline(jbcm1); System.gc(); System.runFinalization(); assertNotNull(session1A.get());