Package org.jboss.util

Examples of org.jboss.util.TimedCachePolicy$ResolutionTimer


      if (resolution == null)
         resolution = getInteger(readInstanceProperties(VFSUtils.VFS_CACHE_KEY + ".TimedPolicyCaching.resolution", null, true));

      log.debug("Creating timed cache policy, lifetime: " + defaultLifetime + ", threadSafe: " + threadSafe + ", resolution: " + resolution);

      TimedCachePolicy tcp;
      if (defaultLifetime == null)
         tcp = new TimedCachePolicy();
      else if (resolution != null)
         tcp = new TimedCachePolicy(defaultLifetime, threadSafe, resolution);
      else
         tcp = new TimedCachePolicy(defaultLifetime);

      info = getCacheName() + "{lifetime=" + tcp.getDefaultLifetime() + ", resolution=" + tcp.getResolution() + "}";

      return tcp;
   }
View Full Code Here


   @SuppressWarnings("unchecked")
   public VFSContext findContext(URI uri)
   {
      String uriString = VFSUtils.stripProtocol(uri);
      TimedCachePolicy tcp = getPolicy();
      List validKeys = tcp.getValidKeys();
      Set<String> keys = new TreeSet<String>(validKeys);
      readLock();
      try
      {
         for (String key : keys)
View Full Code Here

      log.info("Creating "+count+" threads doing "+iterations+" iterations");
      PolicyContext.registerHandler(SecurityConstants.SUBJECT_CONTEXT_KEY,
          new SubjectPolicyContextHandler(), false);
      AuthorizationManager am = new JBossAuthorizationManager("testIdentity");
      JaasSecurityManager secMgr = new JaasSecurityManager("testIdentity", new SecurityAssociationHandler());
      TimedCachePolicy cache = new TimedCachePolicy(3, false, 100);
      cache.create();
      cache.start();
      secMgr.setCachePolicy(cache);
      Thread[] testThreads = new Thread[count];
      AuthTester[] testers = new AuthTester[count];
      for(int t = 0; t < count; t ++)
      {
View Full Code Here

   public void testStringCharArrayCredential()
   {
      SimplePrincipal jduke = new SimplePrincipal("jduke");
      CallbackHandler handler = new SecurityAssociationHandler(jduke, "theduke".toCharArray());
      JaasSecurityManager sm = new JaasSecurityManager("testStringCharArrayCredential", handler);
      TimedCachePolicy cache = new TimedCachePolicy(600, true, 10);
      cache.create();
      cache.start();
      sm.setCachePolicy(cache);

      // Initial validation to populate the cache
      assertTrue(sm.isValid(jduke, "theduke"));
      // Validate that the String credential form uses the cache
View Full Code Here

   public void testCharArrayStringCredential()
   {
      SimplePrincipal jduke = new SimplePrincipal("jduke");
      CallbackHandler handler = new SecurityAssociationHandler(jduke, "theduke".toCharArray());
      JaasSecurityManager sm = new JaasSecurityManager("testStringCharArrayCredential", handler);
      TimedCachePolicy cache = new TimedCachePolicy(600, true, 10);
      cache.create();
      cache.start();
      sm.setCachePolicy(cache);

      // Reset the validation count
      CountedLoginModule.validateCount = 0;
      // Initial validation to populate the cache
View Full Code Here

    Test setResolution
    @throws Exception
    */
   public void testSetResolution() throws Exception
   {
      TimedCachePolicy tcp = new TimedCachePolicy(5, true, 1);
      tcp.create();
      tcp.start();
      tcp.insert("key", "value");
      tcp.setResolution(2);
      Object value = tcp.get("key");
      assertTrue("key has a value", value != null);
      Thread.sleep(8000);
      value = tcp.get("key");
      tcp.stop();
      assertTrue("key has no value", value == null);
   }
View Full Code Here

    Test start/stop/start sequence.
    @throws Exception
    */
   public void testStopStart() throws Exception
   {
      TimedCachePolicy tcp = new TimedCachePolicy(5, true, 1);
      tcp.create();
      tcp.start();
      tcp.stop();
      tcp.start();
      tcp.insert("key", "value");
      tcp.setResolution(2);
      Object value = tcp.get("key");
      assertTrue("key has a value", value != null);
      Thread.sleep(8000);
      value = tcp.get("key");
      tcp.stop();
      assertTrue("key has no value", value == null);
   }
View Full Code Here

         return subject;

      long lifetime = 0;
      if( domainCache instanceof TimedCachePolicy )
      {
         TimedCachePolicy cache = (TimedCachePolicy) domainCache;
         lifetime = cache.getDefaultLifetime();
      }
      DomainInfo info = new DomainInfo(lifetime);
      info.loginCtx = lc;
      info.subject = new Subject();
      SubjectActions.copySubject(subject, info.subject, true, this.deepCopySubjectOption);
View Full Code Here

         return subject;

      long lifetime = 0;
      if (domainCache instanceof TimedCachePolicy)
      {
         TimedCachePolicy cache = (TimedCachePolicy) domainCache;
         lifetime = cache.getDefaultLifetime();
      }
      DomainInfo info = new DomainInfo(lifetime);
      info.loginCtx = lc;
      info.subject = new Subject();
      SubjectActions.copySubject(subject, info.subject, true, this.deepCopySubjectOption);
View Full Code Here

         return subject;

      long lifetime = 0;
      if( domainCache instanceof TimedCachePolicy )
      {
         TimedCachePolicy cache = (TimedCachePolicy) domainCache;
         lifetime = cache.getDefaultLifetime();
      }
      DomainInfo info = new DomainInfo(lifetime);
      info.loginCtx = lc;
      info.subject = new Subject();
      SubjectActions.copySubject(subject, info.subject, true, this.deepCopySubjectOption);
View Full Code Here

TOP

Related Classes of org.jboss.util.TimedCachePolicy$ResolutionTimer

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.