servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r395327 - /incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java
Date Wed, 19 Apr 2006 18:04:11 GMT
Author: gnodet
Date: Wed Apr 19 11:04:09 2006
New Revision: 395327

URL: http://svn.apache.org/viewcvs?rev=395327&view=rev
Log:
Only add listeners when the JBI container is fully initialized.

Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java?rev=395327&r1=395326&r2=395327&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java
Wed Apr 19 11:04:09 2006
@@ -112,6 +112,7 @@
     protected boolean embedded = false;
     protected boolean notifyStatistics = false;
     protected EventListenerList listeners = new EventListenerList();
+    protected EventListener[] configuredListeners;
     
     /**
      * Default Constructor
@@ -505,6 +506,16 @@
             } catch (JMException e) {
                 throw new JBIException(e);
             }
+            
+            // Initialize listeners after the whole container has been initialized
+            // so that they can register themselves as JMX mbeans for example
+            if (configuredListeners != null) {
+                for (int i = 0; i < configuredListeners.length; i++) {
+                    EventListener listener = configuredListeners[i];
+                    addListener(listener);
+                }
+            }
+            
             log.info("ServiceMix JBI Container (http://servicemix.org/) name: " + getName()
+ " running version: "
                     + EnvironmentContext.getVersion());
         }
@@ -1157,10 +1168,7 @@
     }
     
     public void setListeners(EventListener[] listeners) {
-        for (int i = 0; i < listeners.length; i++) {
-            EventListener listener = listeners[i];
-            addListener(listener);
-        }
+        configuredListeners = listeners;
     }
     
     public void callListeners(MessageExchange exchange) {



Mime
View raw message