Package org.jboss.util

Examples of org.jboss.util.TimedCachePolicy$ResolutionTimer


         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

    /**
    * @param args the command line arguments
    */
    public static void main(String args[])
    {
        TimedCachePolicy cache = new TimedCachePolicy(20, false, 1);
        cache.create();
        cache.start();
        cache.insert("1", new Refreshable(5, "value1", 4));
        cache.insert("2", new Refreshable(3, "value2", 10));
        cache.insert("3", "value3");
        long start = System.currentTimeMillis();
        // Loop until the longest lived value is gone
        while( cache.peek("2") != null )
        {
            long now = System.currentTimeMillis();
            System.out.println("Elapsed: "+(now - start) / 1000);
            System.out.println("get(1) -> "+cache.get("1"));
            System.out.println("get(2) -> "+cache.get("2"));
            System.out.println("get(3) -> "+cache.get("3"));
            try
            {
                Thread.currentThread().sleep(3*1000);
            }
            catch(InterruptedException e)
            {
            }
        }
        long now = System.currentTimeMillis();
        System.out.println("End, elapsed: "+(now - start) / 1000);
        System.out.println("get(1) -> "+cache.get("1"));
        System.out.println("get(2) -> "+cache.get("2"));
        System.out.println("get(3) -> "+cache.get("3"));
    }
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

   public void setCacheTimeout(String securityDomain, int timeoutInSecs, int resInSecs)
   {
      CachePolicy cache = getCachePolicy(securityDomain);
      if( cache != null && cache instanceof TimedCachePolicy )
      {
         TimedCachePolicy tcp = (TimedCachePolicy) cache;
         synchronized( tcp )
         {
            tcp.setDefaultLifetime(timeoutInSecs);
            tcp.setResolution(resInSecs);
         }
      }
      else
      {
         log.warn("Failed to find cache policy for securityDomain='"
View Full Code Here

   {
      CachePolicy cache = getCachePolicy(securityDomain);
      List validPrincipals = null;
      if( cache instanceof TimedCachePolicy )
      {
         TimedCachePolicy tcache = (TimedCachePolicy) cache;
         validPrincipals = tcache.getValidKeys();
      }
      return validPrincipals;
   }
View Full Code Here

       was created by out getObjectInstance() method. All this does is create
       a new TimedCache instance.
       */
      public Object invoke(Object obj, Method method, Object[] args) throws Throwable
      {
         TimedCachePolicy cachePolicy = new TimedCachePolicy(defaultCacheTimeout,
            true, defaultCacheResolution);
         cachePolicy.create();
         cachePolicy.start();
         return cachePolicy;
      }
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.