Package org.jboss.web.tomcat.service.session

Examples of org.jboss.web.tomcat.service.session.JBossCacheManager


   }
  
   protected JBossCacheManager[] getCacheManagers(String warname, int maxInactive, int maxIdle)
      throws Exception
   {
      JBossCacheManager jbcm0 = SessionTestUtil.createManager(warname, maxInactive, pojoCaches[0], null);
      JBossWebMetaData metadata = SessionTestUtil.createWebMetaData(getReplicationGranularity(), getReplicationTrigger(), -1, maxIdle > 0, maxIdle, -1 ,false, 0);
      jbcm0.init(warname, metadata);
      this.managers.add(jbcm0);
      jbcm0.start();
     
      JBossCacheManager jbcm1 = SessionTestUtil.createManager(warname, maxInactive, pojoCaches[1], null);
      metadata = SessionTestUtil.createWebMetaData(getReplicationGranularity(), getReplicationTrigger(), -1, true, maxIdle, -1 ,false, 0);
      jbcm1.init(warname, metadata);
      this.managers.add(jbcm1);
      jbcm1.start();
     
      return new JBossCacheManager[]{jbcm0, jbcm1};
   }
View Full Code Here


      throws Exception
   {
      JBossCacheManager[] result = new JBossCacheManager[pojoCaches.length];
      for (int i = 0; i < pojoCaches.length; i++)
      {
         JBossCacheManager jbcm = createManager(warname, maxInactive, pojoCaches[i], null);
         JBossWebMetaData metadata = createWebMetaData(getReplicationGranularity(), getReplicationTrigger(), -1, true, maxIdle, -1, true, maxUnreplicated);
         jbcm.init(warname, metadata);
         this.managers.add(jbcm);
         jbcm.start();
         result[i] = jbcm;
      }
     
      return result;
   }
View Full Code Here

     
      String warname = String.valueOf(++testId);
     
      // A war with a maxInactive of 30 mins and a maxIdle of 1
      JBossCacheManager[] mgrs = getCacheManagers(warname, 1800000, 1, -1);
      JBossCacheManager jbcm0 = mgrs[0];
      JBossCacheManager jbcm1 = mgrs[1];
     
      Object value = "0";
      SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(Collections.singletonMap("count", value), false);
      SessionTestUtil.invokeRequest(jbcm0, setHandler, null);
     
      String id = setHandler.getSessionId();
     
      SessionTestUtil.sleepThread(1100);
     
      jbcm0.backgroundProcess();
      jbcm1.backgroundProcess();    
     
      value = "1";
      setHandler = new SetAttributesRequestHandler(Collections.singletonMap("count", value), false);
      SessionTestUtil.invokeRequest(jbcm0, setHandler, id);
     
View Full Code Here

     
      String warname = String.valueOf(++testId);
     
      // A war with a maxInactive of 30 mins and a maxIdle of 1
      JBossCacheManager[] mgrs = getCacheManagers(warname, 1800000, 1, -1);
      JBossCacheManager jbcm0 = mgrs[0];
      JBossCacheManager jbcm1 = mgrs[1];
     
      Object value = "0";
      SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(Collections.singletonMap("count", value), false);
      SessionTestUtil.invokeRequest(jbcm0, setHandler, null);
     
      String id = setHandler.getSessionId();
     
      SessionTestUtil.sleepThread(1100);
     
      jbcm0.backgroundProcess();
      jbcm1.backgroundProcess();    
     
      value = "1";
      setHandler = new SetAttributesRequestHandler(Collections.singletonMap("count", value), false);
      SessionTestUtil.invokeRequest(jbcm1, setHandler, id);
     
View Full Code Here

   }
  
   protected JBossCacheManager[] getCacheManagers(String warname, int maxInactive, int maxIdle, int maxUnreplicated)
      throws Exception
   {
      JBossCacheManager jbcm0 = SessionTestUtil.createManager(warname, maxInactive, pojoCaches[0], null);
      JBossWebMetaData metadata = SessionTestUtil.createWebMetaData(getReplicationGranularity(), getReplicationTrigger(), -1, true, maxIdle, -1, true, maxUnreplicated);
      jbcm0.init(warname, metadata);
      this.managers.add(jbcm0);
      jbcm0.start();
     
      JBossCacheManager jbcm1 = SessionTestUtil.createManager(warname, maxInactive, pojoCaches[1], null);
      metadata = SessionTestUtil.createWebMetaData(getReplicationGranularity(), getReplicationTrigger(), -1, true, maxIdle, -1, true, -1);
      jbcm1.init(warname, metadata);
      this.managers.add(jbcm1);
      jbcm1.start();
     
      return new JBossCacheManager[]{jbcm0, jbcm1};
   }
View Full Code Here

     
      String warname = String.valueOf(++testId);
     
      // A war with a maxInactive of 3 secs and a maxUnreplicated of 1
      JBossCacheManager[] mgrs = getCacheManagers(warname, 3, 1);
      JBossCacheManager jbcm0 = mgrs[0];
      JBossCacheManager jbcm1 = mgrs[1];
     
      SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(allAttributes, false);
      SessionTestUtil.invokeRequest(jbcm0, setHandler, null);
     
      validateNewSession(setHandler);
     
      Thread.sleep(250);
     
      // Now make a request that will not trigger replication but keeps the jbcm0 session alive
      BasicRequestHandler getHandler = new BasicRequestHandler(immutables.keySet(), false);
      SessionTestUtil.invokeRequest(jbcm0, getHandler, setHandler.getSessionId());
     
      validateExpectedAttributes(immutables, getHandler);
     
      // Sleep long enough that the session will be expired on other server
      // if it doesn't have a maxUnreplicatedInterval grace period
      Thread.sleep(2800);
     
      // jbcm1 considers the session unmodified for > 3 sec maxInactiveInterval.
      // Try to drive the session out of the jbcm1 cache     
      jbcm1.backgroundProcess();
     
      // Replicate just one attribute; see if the other is still in jbcm1
      SetAttributesRequestHandler modifyHandler = new SetAttributesRequestHandler(mutables, false);
      SessionTestUtil.invokeRequest(jbcm0, modifyHandler, setHandler.getSessionId());
     
View Full Code Here

     
      String warname = String.valueOf(++testId);
     
      // A war with a maxInactive of 2 secs and a maxUnreplicated of -1
      JBossCacheManager[] mgrs = getCacheManagers(warname, 2, -1);
      JBossCacheManager jbcm0 = mgrs[0];
      JBossCacheManager jbcm1 = mgrs[1];
     
      SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(allAttributes, false);
      SessionTestUtil.invokeRequest(jbcm0, setHandler, null);
     
      validateNewSession(setHandler);
View Full Code Here

     
      int maxUnrep = testZero ? 0 : 1;
     
      // A war with a maxInactive of 3 secs and a maxUnreplicated of 0 or 1
      JBossCacheManager[] mgrs = getCacheManagers(warname, 3, maxUnrep);
      JBossCacheManager jbcm0 = mgrs[0];
      JBossCacheManager jbcm1 = mgrs[1];
     
      // Establish session.
      SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(allAttributes, false);
      SessionTestUtil.invokeRequest(jbcm0, setHandler, null);
     
View Full Code Here

     
      String warname = String.valueOf(++testId);
     
      // A war with a maxInactive of 3 secs and a maxUnreplicated of 1
      JBossCacheManager[] mgrs = getCacheManagers(warname, 3, 1);
      JBossCacheManager jbcm0 = mgrs[0];
      JBossCacheManager jbcm1 = mgrs[1];
     
      SetAttributesRequestHandler setHandler = new SetAttributesRequestHandler(allAttributes, false);
      SessionTestUtil.invokeRequest(jbcm0, setHandler, null);
     
      // Sleep less than the maxUnreplicated time so next request shouldn't trigger timestamp repl
View Full Code Here

      log.info("++++ Starting testRemoteExpirationGracePeriod ++++");
     
      String warname = String.valueOf(++testId);
     
      JBossCacheManager[] mgrs = getCacheManagers(warname, 3, 2);
      JBossCacheManager jbcm0 = mgrs[0];
      JBossCacheManager jbcm1 = mgrs[1];
     
      SetAttributesRequestHandler setHandler1 = new SetAttributesRequestHandler(allAttributes, false);
      SessionTestUtil.invokeRequest(jbcm0, setHandler1, null);
     
      Fqn session1Fqn = Fqn.fromString(SessionTestUtil.getSessionFqn(warname, setHandler1.getSessionId()));
     
      SetAttributesRequestHandler setHandler2 = new SetAttributesRequestHandler(allAttributes, false);
      SessionTestUtil.invokeRequest(jbcm0, setHandler2, null);
     
      Fqn session2Fqn = Fqn.fromString(SessionTestUtil.getSessionFqn(warname, setHandler2.getSessionId()));
     
      // Overage the sessions
      Thread.sleep(3010);
      // Try to force out the overaged sessions
      jbcm1.backgroundProcess();
      // Confirm they are still there
      // FIXME -- avoid direct cache operations
      assertNotNull(pojoCaches[1].getCache().get(session1Fqn, CacheHelper.VERSION_KEY));
      assertNotNull(pojoCaches[1].getCache().get(session2Fqn, CacheHelper.VERSION_KEY));
     
      // Access one to prove it gets expired once the manager can see its real timestamp
      BasicRequestHandler getHandler = new BasicRequestHandler(allAttributes.keySet(), false);
      SessionTestUtil.invokeRequest(jbcm1, getHandler, setHandler1.getSessionId());     
      validateNewSession(getHandler);
     
      // Sleep past the grace period
      Thread.sleep(2010);
      // The get restored a new fresh session with the first id, but the 2nd
      // one is still there and overaged. Try to force it out
      jbcm1.backgroundProcess();
      // FIXME -- avoid direct cache operations
      assertNull(pojoCaches[1].getCache().get(session2Fqn, CacheHelper.VERSION_KEY));
   }
View Full Code Here

TOP

Related Classes of org.jboss.web.tomcat.service.session.JBossCacheManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.