[jboss-cvs] JBossAS SVN: r60586 - trunk/aspects/src/main/org/jboss/aop/deployment.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Feb 16 07:56:20 EST 2007


Author: kabir.khan at jboss.com
Date: 2007-02-16 07:56:20 -0500 (Fri, 16 Feb 2007)
New Revision: 60586

Modified:
   trunk/aspects/src/main/org/jboss/aop/deployment/AspectManagerService.java
Log:
Fix some of the AOP tests. Make sure that when running in JBoss 5, the state of the AspectManagerService is set to started

Modified: trunk/aspects/src/main/org/jboss/aop/deployment/AspectManagerService.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/deployment/AspectManagerService.java	2007-02-16 11:31:23 UTC (rev 60585)
+++ trunk/aspects/src/main/org/jboss/aop/deployment/AspectManagerService.java	2007-02-16 12:56:20 UTC (rev 60586)
@@ -90,6 +90,9 @@
    protected String include;
    protected String ignore;
    private String baseXml = "base-aop.xml";
+   //When running with JBoss 5 registration with MBeanServer happens after the service has been started
+   boolean registerHappensAfterStart;
+   boolean hasBeenStarted;
 
    // Static -------------------------------------------------------
 
@@ -98,9 +101,13 @@
    {
    }
 
+   /**
+    * Ctor called wehen running in JBoss 5. In JBoss 5 we take control of registering this service in JMX ourselves
+    */
    public AspectManagerService(String baseXml)
    {
       this.baseXml = baseXml;
+      this.registerHappensAfterStart = true;
    }
 
    // Public -------------------------------------------------------
@@ -118,6 +125,10 @@
    protected void createService()
            throws Exception
    {
+      if (hasBeenStarted)
+      {
+         return;
+      }
       // Set a default tmp classes dir to the jboss tmp dir/aopclasses
       if (tmpClassesDir == null)
       {
@@ -271,15 +282,6 @@
       sendNotification(msg);
    }
 
-   protected void startService()
-           throws Exception
-   {
-   }
-
-   protected void stopService()
-   {
-   }
-
    public boolean getPrune()
    {
       return AspectManager.getPrune();
@@ -621,4 +623,20 @@
       InstrumentorFactory.initialise(instrumentor);
    }
 
+   @Override
+   public void postRegister(Boolean done)
+   {
+      super.postRegister(done);
+      if (registerHappensAfterStart)
+      {
+         try
+         {
+            super.start();
+         }
+         catch (Exception e)
+         {
+            throw new RuntimeException(e);
+         }
+      }
+   }
 }




More information about the jboss-cvs-commits mailing list