tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1221803 - in /openejb/trunk/openejb/container/openejb-osgi/src/main: filtered-resources/features.xml java/org/apache/openejb/core/osgi/impl/Activator.java java/org/apache/openejb/core/osgi/impl/Deployer.java
Date Wed, 21 Dec 2011 16:58:08 GMT
Author: rmannibucau
Date: Wed Dec 21 16:58:08 2011
New Revision: 1221803

URL: http://svn.apache.org/viewvc?rev=1221803&view=rev
Log:
trying to start the service manage each time we could need it

Modified:
    openejb/trunk/openejb/container/openejb-osgi/src/main/filtered-resources/features.xml
    openejb/trunk/openejb/container/openejb-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Activator.java
    openejb/trunk/openejb/container/openejb-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java

Modified: openejb/trunk/openejb/container/openejb-osgi/src/main/filtered-resources/features.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-osgi/src/main/filtered-resources/features.xml?rev=1221803&r1=1221802&r2=1221803&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-osgi/src/main/filtered-resources/features.xml
(original)
+++ openejb/trunk/openejb/container/openejb-osgi/src/main/filtered-resources/features.xml
Wed Dec 21 16:58:08 2011
@@ -51,8 +51,8 @@
     <bundle>mvn:org.apache.openwebbeans/openwebbeans-ee/${org.apache.openwebbeans.version}</bundle>
     <bundle>mvn:org.apache.openwebbeans/openwebbeans-ejb-common</bundle>
     <bundle>mvn:org.apache.openwebbeans/openwebbeans-ejb/${org.apache.openwebbeans.version}</bundle>
-    <bundle>mvn:org.apache.openwebbeans/openwebbeans-web/${org.apache.openwebbeans.version}</bundle>
     <bundle>mvn:org.apache.openwebbeans/openwebbeans-osgi/${org.apache.openwebbeans.version}</bundle>
+    <bundle>mvn:org.apache.openwebbeans/openwebbeans-web/${org.apache.openwebbeans.version}</bundle>
   </feature>
 
   <feature name="geronimo-osgi" version="${geronimo-osgi.version}">

Modified: openejb/trunk/openejb/container/openejb-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Activator.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Activator.java?rev=1221803&r1=1221802&r2=1221803&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Activator.java
(original)
+++ openejb/trunk/openejb/container/openejb-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Activator.java
Wed Dec 21 16:58:08 2011
@@ -66,6 +66,17 @@ public class Activator implements Bundle
         }
 
         // should be registered through openejb-server
+        checkServiceManager(context);
+
+        LOGGER.info("Registering OSGified OpenEJB Deployer");
+        context.addBundleListener(new Deployer(this, context));
+    }
+
+    public synchronized void checkServiceManager(BundleContext context) {
+        if (serviceManager != null) { // already started
+            return;
+        }
+
         ServiceTracker serviceManagerTracker = null;
         try {
             serviceManagerTracker = getServiceManger(context);
@@ -85,11 +96,9 @@ public class Activator implements Bundle
                 serviceManagerTracker.close();
             }
         }
-
-        LOGGER.info("Registering OSGified OpenEJB Deployer");
-        context.addBundleListener(new Deployer(context.getBundle()));
     }
 
+
     private static ServiceTracker getServiceManger(BundleContext context) throws InterruptedException
{
         ServiceTracker serviceManagerTracker = new ServiceTracker(context, SERVICE_MANAGER_NAME,
null);
         serviceManagerTracker.open();

Modified: openejb/trunk/openejb/container/openejb-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java?rev=1221803&r1=1221802&r2=1221803&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java
(original)
+++ openejb/trunk/openejb/container/openejb-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java
Wed Dec 21 16:58:08 2011
@@ -57,13 +57,16 @@ public class Deployer implements BundleL
     private Map<Bundle, List<ServiceRegistration>> registrations = new ConcurrentHashMap<Bundle,
List<ServiceRegistration>>();
     private Map<Bundle, AppContext> appContexts = new ConcurrentHashMap<Bundle,
AppContext>();
 
-    private final Bundle openejbBundle;
+    private final BundleContext openejbBundleContext;
+    private final Activator openejbActivator;
 
-    public Deployer(Bundle classLoader) {
-        openejbBundle = classLoader;
+    public Deployer(Activator activator, BundleContext context) {
+        openejbActivator = activator;
+        openejbBundleContext = context;
     }
 
     public void bundleChanged(BundleEvent event) {
+        openejbActivator.checkServiceManager(openejbBundleContext);
         switch (event.getType()) {
             case BundleEvent.STARTED:
                 deploy(event.getBundle());
@@ -83,7 +86,7 @@ public class Deployer implements BundleL
 
     private void deploy(Bundle bundle) {
         final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
-        final ClassLoader osgiCl = new OSGIClassLoader(bundle, openejbBundle);
+        final ClassLoader osgiCl = new OSGIClassLoader(bundle, openejbBundleContext.getBundle());
         Thread.currentThread().setContextClassLoader(osgiCl);
 
         try {



Mime
View raw message