FileDocCategorySizeDatePackage
JBossTimerServiceFactory.javaAPI DocJBoss 4.2.14322Fri Jul 13 20:53:54 BST 2007org.jboss.ejb3.timerservice.jboss

JBossTimerServiceFactory

public class JBossTimerServiceFactory extends org.jboss.ejb3.timerservice.TimerServiceFactory
Factory to create timer services which use the JBoss EJB Timer Service.
author
Carlo de Wolf
version
$Revision: $

Fields Summary
private static Logger
log
Constructors Summary
Methods Summary
public javax.ejb.TimerServicecreateTimerService(javax.management.ObjectName containerId, org.jboss.ejb3.timerservice.TimedObjectInvoker invoker)

   
   /* (non-Javadoc)
    * @see org.jboss.ejb3.timerservice.TimerServiceFactory#createTimerService(javax.management.ObjectName, org.jboss.ejb3.timerservice.TimedObjectInvoker)
    */
   
        
   
      TimerService timerService = null;
      try
      {
         EJBTimerService service = getEJBTimerService();
         TimerService delegate = service.createTimerService(containerId, null, invoker);
         timerService = new TimerServiceFacade(containerId, delegate);
      }
      catch (Exception e)
      {
         //throw new EJBException("Could not create timer service", e);
         if (log.isTraceEnabled())
         {
            log.trace("Unable to initialize timer service", e);
         }
         else
         {
            log.trace("Unable to initialize timer service");
         }
      }
      return timerService;
   
protected org.jboss.ejb.txtimer.EJBTimerServicegetEJBTimerService()

      return (EJBTimerService) MBeanProxyExt.create(EJBTimerService.class, EJBTimerService.OBJECT_NAME, MBeanServerLocator.locateJBoss());
   
public voidremoveTimerService(javax.ejb.TimerService timerService)

      removeTimerService(((TimerServiceFacade) timerService).getContainerId());
   
protected voidremoveTimerService(javax.management.ObjectName containerId)

      try
      {
         EJBTimerService service = getEJBTimerService();
         service.removeTimerService(containerId, true);
      }
      catch (Exception e)
      {
         //throw new EJBException("Could not remove timer service", e);
         if (log.isTraceEnabled())
         {
            log.trace("Unable to initialize timer service", e);
         }
         else
         {
            log.trace("Unable to initialize timer service");
         }
      }
   
public voidrestoreTimerService(javax.ejb.TimerService aTimerService)

      if (aTimerService == null)
      {
         log.warn("TIMER SERVICE IS NOT INSTALLED");
         return;
      }
      TimerServiceFacade timerService = (TimerServiceFacade) aTimerService;
      EJBContainer container = timerService.getContainer();
      // FIXME: do not assume that a TimedObjectInvoker is an EJBContainer
      ClassLoader loader = container.getClassloader();
      
      getEJBTimerService().restoreTimers(timerService.getContainerId(), loader);