[jboss-cvs] JBossAS SVN: r64026 - in trunk/server/src/main/org/jboss/ejb: deployers and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jul 13 02:14:15 EDT 2007


Author: scott.stark at jboss.org
Date: 2007-07-13 02:14:15 -0400 (Fri, 13 Jul 2007)
New Revision: 64026

Modified:
   trunk/server/src/main/org/jboss/ejb/Container.java
   trunk/server/src/main/org/jboss/ejb/EjbModule.java
   trunk/server/src/main/org/jboss/ejb/EjbModuleMBean.java
   trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java
Log:
Setup proper injection of the ejb timer service

Modified: trunk/server/src/main/org/jboss/ejb/Container.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/Container.java	2007-07-13 06:12:48 UTC (rev 64025)
+++ trunk/server/src/main/org/jboss/ejb/Container.java	2007-07-13 06:14:15 UTC (rev 64026)
@@ -233,6 +233,8 @@
     */
    protected boolean isJaccEnabled = false;
 
+   protected EJBTimerService timerService;
+
    static
    {
       try
@@ -450,6 +452,16 @@
       jaccContextID = id;
    }
 
+   public EJBTimerService getTimerService()
+   {
+      return timerService;
+   }
+
+   public void setTimerService(EJBTimerService timerService)
+   {
+      this.timerService = timerService;
+   }
+
    /** 
     * Get the flag whether JACC is enabled  
     * @return 
@@ -744,8 +756,7 @@
       TimerService timerService = null;
       try
       {
-         EJBTimerService service = (EJBTimerService)SecurityActions.getMBeanProxy(EJBTimerService.class, EJBTimerService.OBJECT_NAME, server);
-         timerService = service.createTimerService(getJmxName(), pKey, this);
+         timerService = this.timerService.createTimerService(getJmxName(), pKey, this);
       }
       catch (Exception e)
       {
@@ -766,17 +777,16 @@
    {
       try
       {
-         EJBTimerService service = (EJBTimerService)SecurityActions.getMBeanProxy(EJBTimerService.class, EJBTimerService.OBJECT_NAME, server);
          if (pKey != null)
          {
             // entity bean->remove()
-            service.removeTimerService(getJmxName(), pKey);
+            timerService.removeTimerService(getJmxName(), pKey);
          }
          else
          {
             // container stop, we choose whether active timers
             // should be persisted (default), or not (legacy)
-            service.removeTimerService(getJmxName(), getBeanMetaData().getTimerPersistence());
+            timerService.removeTimerService(getJmxName(), getBeanMetaData().getTimerPersistence());
          }
       }
       catch (Exception e)
@@ -794,8 +804,7 @@
       {
          // TODO: this name needs to be externalized
          // pass to the ejb timer service the container ObjectName
-         server.invoke(EJBTimerService.OBJECT_NAME, "restoreTimers", new Object[] { getServiceName(), getClassLoader() }, new String[] { "javax.management.ObjectName",
-               "java.lang.ClassLoader" });
+         timerService.restoreTimers(getServiceName(), getClassLoader());
       }
       catch (Exception e)
       {

Modified: trunk/server/src/main/org/jboss/ejb/EjbModule.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/EjbModule.java	2007-07-13 06:12:48 UTC (rev 64025)
+++ trunk/server/src/main/org/jboss/ejb/EjbModule.java	2007-07-13 06:14:15 UTC (rev 64026)
@@ -35,6 +35,7 @@
 import java.util.Map;
 
 import javax.ejb.EJBLocalHome;
+import javax.ejb.TimerService;
 import javax.management.ObjectName;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
@@ -51,6 +52,7 @@
 import org.jboss.deployment.DeploymentInfo;
 import org.jboss.ejb.plugins.SecurityProxyInterceptor;
 import org.jboss.ejb.plugins.StatefulSessionInstancePool;
+import org.jboss.ejb.txtimer.EJBTimerService;
 import org.jboss.invocation.InvocationType;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.ApplicationMetaData;
@@ -152,6 +154,7 @@
    private ObjectName webServiceName;
 
    private TransactionManagerFactory tmFactory;
+   private EJBTimerService timerService;
 
    /** Whether we are call by value */
    private boolean callByValue;
@@ -205,6 +208,16 @@
       this.tmFactory = tm;
    }
 
+   public EJBTimerService getTimerService()
+   {
+      return timerService;
+   }
+
+   public void setTimerService(EJBTimerService timerService)
+   {
+      this.timerService = timerService;
+   }
+
    public ObjectName getWebServiceName()
    {
       return webServiceName;
@@ -792,6 +805,9 @@
       InitialContext iniCtx = new InitialContext();
       container.setTransactionManager(tmFactory.getTransactionManager());
 
+      // Set
+      container.setTimerService(timerService);
+
       // Set security domain manager
       String securityDomain = bean.getApplicationMetaData().getSecurityDomain();
       String confSecurityDomain = conf.getSecurityDomain();

Modified: trunk/server/src/main/org/jboss/ejb/EjbModuleMBean.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/EjbModuleMBean.java	2007-07-13 06:12:48 UTC (rev 64025)
+++ trunk/server/src/main/org/jboss/ejb/EjbModuleMBean.java	2007-07-13 06:14:15 UTC (rev 64026)
@@ -23,6 +23,7 @@
 
 import javax.management.ObjectName;
  
+import org.jboss.ejb.txtimer.EJBTimerService;
 import org.jboss.tm.TransactionManagerFactory;
 
 /**
@@ -41,4 +42,7 @@
   void setTransactionManagerFactory(TransactionManagerFactory tmFactory); 
   public ObjectName getWebServiceName();
   public void setWebServiceName(ObjectName webServiceName);
+  public EJBTimerService getTimerService();
+  public void setTimerService(EJBTimerService timerService);
+
 }

Modified: trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java	2007-07-13 06:12:48 UTC (rev 64025)
+++ trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java	2007-07-13 06:14:15 UTC (rev 64026)
@@ -31,7 +31,6 @@
 import javax.management.ObjectName;
 
 import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
 import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
 import org.jboss.ejb.EjbModule;
@@ -108,7 +107,7 @@
       this.ccmServiceName = ccmServiceName;
    }
 
-   public String getTimerServiceName()
+   public String getTimerService()
    {
       return timerServiceName;
    }
@@ -200,7 +199,15 @@
       wsDepends.setDependency(getWebServiceName());
       ws.setValue(wsDepends);
       attrs.add(ws);
-       
+      // Injection of the TimerService
+      ServiceAttributeMetaData tms = new ServiceAttributeMetaData();
+      ServiceDependencyValueMetaData tmsDepends = new ServiceDependencyValueMetaData();
+      tms.setName("TimerService");
+      tmsDepends.setDependency(timerServiceName);
+      tmsDepends.setProxyType("attribute");
+      tms.setValue(tmsDepends);
+      attrs.add(tms);
+
       ejbModule.setAttributes(attrs); 
       
       List<ServiceDependencyMetaData> dependencies = new ArrayList<ServiceDependencyMetaData>();
@@ -212,14 +219,6 @@
          ccm.setIDependOn(ccmServiceName);
          dependencies.add(ccm);
       }
-      // Dependency on the timer service
-      // TODO: this should be injected directly to the ejb container
-      if( timerServiceName != null && timerServiceName.length() > 0 )
-      {
-         ServiceDependencyMetaData tms = new ServiceDependencyMetaData();
-         tms.setIDependOn(timerServiceName);
-         dependencies.add(tms);
-      }
       // Add dependencies on the invoker services in use
       Iterator beans = deployment.getEnterpriseBeans();
       HashSet<String> invokerNames = new HashSet<String>();




More information about the jboss-cvs-commits mailing list