Package org.jboss.ejb3.annotation

Examples of org.jboss.ejb3.annotation.CacheConfig


   public StatefulBeanContext create(Class<?>[] initTypes, Object[] initValues)
   {
      StatefulBeanContext sfctx = (StatefulBeanContext) createBeanContext();
      // Tell context how to handle replication
      CacheConfig config = getAnnotation(CacheConfig.class);
      if (config != null)
      {
         sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
      }

      // this is for propagated extended PC's
      sfctx = sfctx.pushContainedIn();
     
View Full Code Here


   public StatefulBeanContext create(Class<?>[] initTypes, Object[] initValues)
   {
      StatefulBeanContext sfctx = (StatefulBeanContext) createBeanContext();
      // Tell context how to handle replication
      CacheConfig config = getAnnotation(CacheConfig.class);
      if (config != null)
      {
         sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
      }

      // this is for propagated extended PC's
      sfctx = sfctx.pushContainedIn();
     
View Full Code Here

/* 314 */     this.pool = this.ejbContainer.getPool();
/* 315 */     ClassLoader cl = this.ejbContainer.getClassloader();
/* 316 */     this.classloader = new WeakReference(cl);
/*     */
/* 318 */     Advisor advisor = this.ejbContainer;
/* 319 */     CacheConfig config = (CacheConfig)advisor.resolveAnnotation(CacheConfig.class);
/* 320 */     MBeanServer server = MBeanServerLocator.locateJBoss();
/* 321 */     String name = config.name();
/* 322 */     if ((name == null) || (name.trim().length() == 0))
/* 323 */       name = "jboss.cache:service=EJB3SFSBClusteredCache";
/* 324 */     ObjectName cacheON = new ObjectName(name);
/* 325 */     CacheJmxWrapperMBean mbean = (CacheJmxWrapperMBean)MBeanProxyExt.create(CacheJmxWrapperMBean.class, cacheON, server);
/* 326 */     this.cache = mbean.getCache();
/*     */
/* 328 */     this.cacheNode = new Fqn(new Object[] { this.ejbContainer.getDeploymentQualifiedName() });
/*     */
/* 331 */     this.region = this.cache.getRegion(this.cacheNode, true);
/* 332 */     EvictionPolicyConfig epc = getEvictionPolicyConfig((int)config.idleTimeoutSeconds(), config.maxSize());
/*     */
/* 334 */     this.region.setEvictionPolicy(epc);
/*     */
/* 337 */     cleanBeanRegion();
/*     */
/* 340 */     this.region.registerContextClassLoader(cl);
/* 341 */     this.region.activate();
/*     */
/* 343 */     this.log.debug("initialize(): created region: " + this.region + " for ejb: " + this.ejbContainer.getEjbName());
/*     */
/* 345 */     this.removalTimeout = config.removalTimeoutSeconds();
/* 346 */     if (this.removalTimeout > 0L)
/* 347 */       this.removalTask = new RemovalTimeoutTask("SFSB Removal Thread - " + this.ejbContainer.getObjectName().getCanonicalName());
/*     */   }
View Full Code Here

/* 1525 */           configAnnotation.setReplicationIsPassivation(Boolean.parseBoolean(config.getReplicationIsPassivation()));
/*      */         }
/* 1527 */         if (config.getRemoveTimeoutSeconds() != null) {
/* 1528 */           configAnnotation.setRemovalTimeoutSeconds(config.getRemoveTimeoutSeconds().intValue());
/*      */         }
/* 1530 */         CacheConfig existingConfig = (CacheConfig)this.ejbClass.getAnnotation(CacheConfig.class);
/* 1531 */         if (existingConfig != null) {
/* 1532 */           configAnnotation.merge(existingConfig);
/*      */         }
/* 1534 */         addClassAnnotation(container, CacheConfig.class, configAnnotation);
/*      */       }
/*      */       else
/*      */       {
/* 1538 */         CacheConfigImpl configAnnotation = new CacheConfigImpl();
/*      */
/* 1540 */         if (config.getMaxSize() != null) {
/* 1541 */           configAnnotation.setMaxSize(config.getMaxSize().intValue());
/*      */         }
/* 1543 */         if (config.getIdleTimeoutSeconds() != null) {
/* 1544 */           configAnnotation.setIdleTimeoutSeconds(config.getIdleTimeoutSeconds().intValue());
/*      */         }
/* 1546 */         if (config.getRemoveTimeoutSeconds() != null) {
/* 1547 */           configAnnotation.setRemovalTimeoutSeconds(config.getRemoveTimeoutSeconds().intValue());
/*      */         }
/* 1549 */         CacheConfig existingConfig = (CacheConfig)this.ejbClass.getAnnotation(CacheConfig.class);
/* 1550 */         if (existingConfig != null) {
/* 1551 */           configAnnotation.merge(existingConfig);
/*      */         }
/* 1553 */         addClassAnnotation(container, CacheConfig.class, configAnnotation);
/*      */       }
View Full Code Here

/* 248 */     PersistenceManager pmConfig = (PersistenceManager)advisor.resolveAnnotation(PersistenceManager.class);
/* 249 */     EJBContainer ejbContainer = (EJBContainer)container;
/* 250 */     this.pm = ejbContainer.getDeployment().getPersistenceManagerFactoryRegistry().getPersistenceManagerFactory(pmConfig.value()).createPersistenceManager();
/*     */
/* 252 */     this.pm.initialize(container);
/* 253 */     CacheConfig config = (CacheConfig)advisor.resolveAnnotation(CacheConfig.class);
/* 254 */     this.maxSize = config.maxSize();
/* 255 */     this.sessionTimeout = config.idleTimeoutSeconds();
/* 256 */     this.removalTimeout = config.removalTimeoutSeconds();
/* 257 */     this.log = Logger.getLogger(getClass().getName() + "." + container.getEjbName());
/* 258 */     this.log.debug("Initializing SimpleStatefulCache with maxSize: " + this.maxSize + " timeout: " + this.sessionTimeout + " for " + container.getObjectName().getCanonicalName());
/*     */
/* 260 */     this.timeoutTask = new SessionTimeoutTask("SFSB Passivation Thread - " + container.getObjectName().getCanonicalName());
/*     */
View Full Code Here

   public StatefulBeanContext create(Class<?>[] initTypes, Object[] initValues)
   {
      StatefulBeanContext sfctx = (StatefulBeanContext) createBeanContext();
      // Tell context how to handle replication
      CacheConfig config = getAnnotation(CacheConfig.class);
      if (config != null)
      {
         sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
      }

      // this is for propagated extended PC's
      sfctx = sfctx.pushContainedIn();
     
View Full Code Here

   public StatefulBeanContext create(Class<?>[] initTypes, Object[] initValues)
   {
      StatefulBeanContext sfctx = (StatefulBeanContext) createBeanContext();
      // Tell context how to handle replication
      CacheConfig config = getAnnotation(CacheConfig.class);
      if (config != null)
      {
         sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
      }

      // this is for propagated extended PC's
      sfctx = sfctx.pushContainedIn();
View Full Code Here

      PersistenceManager pmConfig = (PersistenceManager) advisor.resolveAnnotation(PersistenceManager.class);
      EJBContainer ejbContainer = (EJBContainer)container;
      this.pm = ejbContainer.getDeployment().getPersistenceManagerFactoryRegistry().getPersistenceManagerFactory(
            pmConfig.value()).createPersistenceManager();
      pm.initialize(container);
      CacheConfig config = (CacheConfig) advisor.resolveAnnotation(CacheConfig.class);
      maxSize = config.maxSize();
      sessionTimeout = config.idleTimeoutSeconds();
      removalTimeout = config.removalTimeoutSeconds();
      log = Logger.getLogger(getClass().getName() + "." + container.getEjbName());
      log.debug("Initializing SimpleStatefulCache with maxSize: " +maxSize + " timeout: " +sessionTimeout +
              " for " +container.getObjectName().getCanonicalName() );
      timeoutTask = new SessionTimeoutTask("SFSB Passivation Thread - " + container.getObjectName().getCanonicalName());
  
View Full Code Here

      this.pool = this.ejbContainer.getPool();
      ClassLoader cl = this.ejbContainer.getClassloader();
      this.classloader = new WeakReference<ClassLoader>(cl);
     
      CacheConfig config = (CacheConfig) ejbContainer.resolveAnnotation(CacheConfig.class);
      MBeanServer server = MBeanServerLocator.locateJBoss();
      String name = config.name();
      if (name == null || name.trim().length() == 0)
         name = CacheConfig.DEFAULT_CLUSTERED_OBJECT_NAME;
      ObjectName cacheON = new ObjectName(name);
      CacheJmxWrapperMBean mbean = (CacheJmxWrapperMBean) MBeanProxyExt.create(CacheJmxWrapperMBean.class, cacheON, server);
      cache = mbean.getCache();

      cacheNode = new Fqn(new Object[] { this.ejbContainer.getDeploymentPropertyListString() });
     
      // Try to create an eviction region per ejb
      region = cache.getRegion(cacheNode, true);
      EvictionPolicyConfig epc = getEvictionPolicyConfig((int) config.idleTimeoutSeconds(),
            config.maxSize());
      region.setEvictionPolicy(epc);

      // JBCACHE-1136.  There's no reason to have state in an inactive region
      cleanBeanRegion();

      // Transfer over the state for the region
      region.registerContextClassLoader(cl);
      try
      {
        region.activate();
      }
      catch (RegionNotEmptyException e)
      {
         // this can happen with nested bean contexts if gravitation
         // pulls a parent bean over after the parent region is stopped
         // Clean up and try again
         cleanBeanRegion();
         region.activate();
      }

      log.debug("initialize(): created region: " +region + " for ejb: " + this.ejbContainer.getEjbName());

      removalTimeout = config.removalTimeoutSeconds();
      if (removalTimeout > 0)
         removalTask = new RemovalTimeoutTask("SFSB Removal Thread - " + this.ejbContainer.getObjectName().getCanonicalName());
   }
View Full Code Here

      {        
         StatefulBeanContext sfctx = (StatefulBeanContext) ctx;
         // FIXME: remove this class cast
         EJBContainer c = (EJBContainer) container;
         // Tell context how to handle replication
         CacheConfig config = c.getAnnotation(CacheConfig.class);
         if (config != null)
         {
            sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
         }
         // this is for propagated extended PC's
         ctx = sfctx = sfctx.pushContainedIn();
      }
      container.pushContext(ctx);
View Full Code Here

TOP

Related Classes of org.jboss.ejb3.annotation.CacheConfig

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.