org.jboss.ejb3
Class TimerServiceContainer

java.lang.Object
  extended by org.jboss.ejb3.EJBContainer
      extended by org.jboss.ejb3.TimerServiceContainer
All Implemented Interfaces:
Container, org.jboss.ejb3.context.spi.BeanManager, org.jboss.ejb3.interceptors.direct.IndirectContainer<EJBContainer,org.jboss.ejb3.interceptors.direct.DirectContainer<EJBContainer>>, JavaEEComponent, EJBInjectionContainer, ExtendedInjectionContainer, InjectionContainer
Direct Known Subclasses:
MessagingContainer, SessionContainer

public abstract class TimerServiceContainer
extends EJBContainer

A EJBContainer which contains the common functionality around EJB3 timer service.

TimerServiceContainer is responsible for creating, restoring and suspending TimerService at the right time during EJBContainer lifecycle events. The TimerServiceContainer knows about EJB3 spec rules and takes care of not creating, restoring or suspending timer service for stateful session beans.


Field Summary
protected  javax.ejb.TimerService timerService
          TimerService which will be created for this container
 
Fields inherited from class org.jboss.ejb3.EJBContainer
assembly, beanClassName, classloader, ejbName, enc, encFactory, encInjections, encInjectors, ENTITY_MANAGER_FACTORY, initialContextProperties, injectors, invokeStats, MANAGED_ENTITY_MANAGER_FACTORY, metadataBasedAnnotationRepo, objectName, pool, reinitialize, xml
 
Fields inherited from interface org.jboss.ejb3.Container
ENC_CTX_NAME
 
Constructor Summary
protected TimerServiceContainer(java.lang.String name, org.jboss.aop.Domain domain, java.lang.ClassLoader cl, java.lang.String beanClassName, java.lang.String ejbName, java.util.Hashtable ctxProperties, Ejb3Deployment deployment, org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData beanMetaData)
          Constructor
 
Method Summary
protected  void afterStart()
          Restores the timers after this container has fully started, thus ensuring that any invocations on this container through the restored timers are handled successfully
 void create()
          Creates a TimerService for this container.
protected abstract  org.jboss.ejb3.timerservice.spi.TimedObjectInvoker getTimedObjectInvoker()
          Returns the TimedObjectInvoker which will be used by the timer implementations to invoke the timeout method (annotated with Timeout or specified in deployment descriptor) on the bean.
 javax.ejb.TimerService getTimerService()
          Returns the TimerService associated with this container.
 javax.ejb.TimerService getTimerService(java.lang.Object pKey)
          Returns the TimerService associated with this container.
protected  void lockedStop()
          Suspends the TimerService associated with this container.
 void setTimerServiceFactory(org.jboss.ejb3.timerservice.spi.TimerServiceFactory factory)
          Set the TimerServiceFactory, which will be used for managing the TimerService associated with this container
 
Methods inherited from class org.jboss.ejb3.EJBContainer
canResolveEJB, checkForDuplicateLocalAndRemoteInterfaces, construct, createBeanContext, createInterceptor, createObjectName, createObjectName, destroy, destroyBeanContext, findPartitionName, getAdvisor, getAnnotation, getAnnotation, getAnnotation, getAnnotation, getAnnotation, getAnnotation, getAnnotations, getApplicationException, getAssemblyDescriptor, getBeanClass, getBeanClassName, getBeanContainer, getBeanInstantiator, getBusinessAndComponentInterfaces, getBusinessObject, getCachedConnectionManager, getClassloader, getClazz, getDependencyPolicy, getDeployment, getDeploymentDescriptorType, getDeploymentPropertyListString, getDeploymentQualifiedName, getDeploymentUnit, getEffigy, getEJBContainer, getEJBHome, getEjbJndiName, getEjbJndiName, getEJBLocalHome, getEjbName, getEnc, getEncInjections, getEncInjectors, getEnvironmentRefGroup, getHandledCallbacks, getIdentifier, getInitialContext, getInitialContextProperties, getInjectionHandlers, getInjectors, getInterceptorClasses, getInterceptorInjectors, getInterceptorRepository, getInterceptors, getInvocationLock, getInvokedBusinessInterface, getInvokedInterface, getInvokeStats, getJaccContextId, getMetaDataBasedAnnotationRepository, getMethodInfo, getModule, getName, getNonBridgeMethod, getObjectName, getPartitionName, getPool, getRollbackOnly, getRootFile, getSecurityManager, getTimeoutCallback, getUserTransaction, getVirtualMethods, getXml, hasJNDIBinding, initializePool, initMetaDataBasedAnnotationRepository, injectBeanContext, instantiated, invokeCallback, invokePostActivate, invokePostConstruct, invokePostConstruct, invokePreDestroy, invokePrePassivate, isAnnotationPresent, isBusinessMethod, isCallerInRole, isClustered, lockedStart, lookup, peekContext, popContext, popEnc, processMetadata, pushContext, pushEnc, reinitialize, resolveAnnotation, resolveAnnotation, resolveAnnotation, resolveAnnotation, resolveBusinessInterfaces, resolveEJB, resolveEjbContainer, resolveEjbContainer, resolveInjectors, resolveMessageDestination, resolvePersistenceUnitSupplier, setAssemblyDescriptor, setBeanInstantiator, setCachedConnectionManager, setDirectContainer, setEjbEncFactory, setInjectionManager, setJaccContextId, setRollbackOnly, setTransactionManager, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.ejb3.Container
getMBean
 

Field Detail

timerService

protected javax.ejb.TimerService timerService
TimerService which will be created for this container

Constructor Detail

TimerServiceContainer

protected TimerServiceContainer(java.lang.String name,
                                org.jboss.aop.Domain domain,
                                java.lang.ClassLoader cl,
                                java.lang.String beanClassName,
                                java.lang.String ejbName,
                                java.util.Hashtable ctxProperties,
                                Ejb3Deployment deployment,
                                org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData beanMetaData)
                         throws java.lang.ClassNotFoundException
Constructor

Parameters:
name - Name of the container
domain - AOP domain for this container
cl - Classloader of this container
beanClassName - The fully qualified class name of the EJB
ejbName - The name of the EJB
ctxProperties - Naming context properties
deployment - Deployment, can be null
beanMetaData - Metadata of the EJB
Throws:
java.lang.ClassNotFoundException
Method Detail

create

public void create()
            throws java.lang.Exception
Creates a TimerService for this container. TimerService creation is skipped for stateful session beans, since stateful session beans do not support timerservice

Specified by:
create in interface Container
Overrides:
create in class EJBContainer
Throws:
java.lang.Exception
See Also:
EJBContainer.create()

afterStart

protected void afterStart()
Restores the timers after this container has fully started, thus ensuring that any invocations on this container through the restored timers are handled successfully

This method skips timerservice restoration of stateful session beans

Overrides:
afterStart in class EJBContainer
See Also:
EJBContainer.afterStart()

lockedStop

protected void lockedStop()
                   throws java.lang.Exception
Suspends the TimerService associated with this container.

This method skips timerservice suspension of stateful session beans

Overrides:
lockedStop in class EJBContainer
Throws:
java.lang.Exception
See Also:
EJBContainer.lockedStop()

getTimerService

public javax.ejb.TimerService getTimerService()
Returns the TimerService associated with this container.

Throws:
java.lang.UnsupportedOperationException - If this container corresponds to a stateful session bean

getTimerService

public javax.ejb.TimerService getTimerService(java.lang.Object pKey)
Returns the TimerService associated with this container.

Throws:
java.lang.UnsupportedOperationException - If this container corresponds to a stateful session bean

setTimerServiceFactory

public void setTimerServiceFactory(org.jboss.ejb3.timerservice.spi.TimerServiceFactory factory)
Set the TimerServiceFactory, which will be used for managing the TimerService associated with this container

Parameters:
factory -

getTimedObjectInvoker

protected abstract org.jboss.ejb3.timerservice.spi.TimedObjectInvoker getTimedObjectInvoker()
Returns the TimedObjectInvoker which will be used by the timer implementations to invoke the timeout method (annotated with Timeout or specified in deployment descriptor) on the bean.

Returns: