felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r905985 - in /felix/trunk/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal: OptionalFeaturesHandler.java PluginServlet.java
Date Wed, 03 Feb 2010 10:48:20 GMT
Author: cziegeler
Date: Wed Feb  3 10:48:19 2010
New Revision: 905985

URL: http://svn.apache.org/viewvc?rev=905985&view=rev
Log:
FELIX-2031 : Services should be registered asynchronously

Modified:
    felix/trunk/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OptionalFeaturesHandler.java
    felix/trunk/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PluginServlet.java

Modified: felix/trunk/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OptionalFeaturesHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OptionalFeaturesHandler.java?rev=905985&r1=905984&r2=905985&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OptionalFeaturesHandler.java
(original)
+++ felix/trunk/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OptionalFeaturesHandler.java
Wed Feb  3 10:48:19 2010
@@ -107,22 +107,58 @@
                 {
                     if ( event.getType() == ServiceEvent.REGISTERED )
                     {
-                        this.bindEventAdmin(event.getServiceReference());
+                        new Thread()
+                        {
+                            public void run()
+                            {
+                                try {
+                                    Thread.sleep(500);
+                                } catch (InterruptedException ignore) {}
+                                bindEventAdmin(event.getServiceReference());
+                            }
+                        }.start();
                     }
                     else if ( event.getType() == ServiceEvent.UNREGISTERING )
                     {
-                        this.unbindEventAdmin(event.getServiceReference());
+                        new Thread()
+                        {
+                            public void run()
+                            {
+                                try {
+                                    Thread.sleep(500);
+                                } catch (InterruptedException ignore) {}
+                                unbindEventAdmin(event.getServiceReference());
+                            }
+                        }.start();
                     }
                 }
                 else if ( objectClasses[i].equals(CONFIGURATION_ADMIN_CLASS_NAME) )
                 {
                     if ( event.getType() == ServiceEvent.REGISTERED )
                     {
-                        this.bindConfigAdmin(event.getServiceReference());
+                        new Thread()
+                        {
+                            public void run()
+                            {
+                                try {
+                                    Thread.sleep(500);
+                                } catch (InterruptedException ignore) {}
+                                bindConfigAdmin(event.getServiceReference());
+                            }
+                        }.start();
                     }
                     else if ( event.getType() == ServiceEvent.UNREGISTERING )
                     {
-                        this.unbindConfigAdmin(event.getServiceReference());
+                        new Thread()
+                        {
+                            public void run()
+                            {
+                                try {
+                                    Thread.sleep(500);
+                                } catch (InterruptedException ignore) {}
+                                unbindConfigAdmin(event.getServiceReference());
+                            }
+                        }.start();
                     }
                 }
             }
@@ -148,7 +184,7 @@
 
     private void unbindEventAdmin(final ServiceReference ref)
     {
-        if ( this.eventAdminReference == ref )
+        if ( this.eventAdminReference != null && this.eventAdminReference.equals(ref)
)
         {
             this.eventAdminReference = null;
             this.plugin.setEventAdminAvailable(false);

Modified: felix/trunk/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PluginServlet.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PluginServlet.java?rev=905985&r1=905984&r2=905985&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PluginServlet.java
(original)
+++ felix/trunk/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PluginServlet.java
Wed Feb  3 10:48:19 2010
@@ -39,10 +39,10 @@
     private final EventCollector collector;
 
     /** Is the event admin available? */
-    private boolean eventAdminAvailable = false;
+    private volatile boolean eventAdminAvailable = false;
 
     /** Is the config admin available? */
-    private boolean configAdminAvailable = false;
+    private volatile boolean configAdminAvailable = false;
 
     public PluginServlet()
     {



Mime
View raw message