servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r679199 - in /servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common: DefaultComponent.java ServiceUnit.java
Date Wed, 23 Jul 2008 20:55:37 GMT
Author: gnodet
Date: Wed Jul 23 13:55:36 2008
New Revision: 679199

URL: http://svn.apache.org/viewvc?rev=679199&view=rev
Log:
Fix synchronization issues when adding endpoints dynamically

Modified:
    servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/DefaultComponent.java
    servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/ServiceUnit.java

Modified: servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/DefaultComponent.java
URL: http://svn.apache.org/viewvc/servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/DefaultComponent.java?rev=679199&r1=679198&r2=679199&view=diff
==============================================================================
--- servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/DefaultComponent.java
(original)
+++ servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/DefaultComponent.java
Wed Jul 23 13:55:36 2008
@@ -56,6 +56,10 @@
         setComponent(this);
         registry = createRegistry();
         serviceUnitManager = createServiceUnitManager();
+        serviceUnit = new XBeanServiceUnit();
+        serviceUnit.setName("#default#");
+        serviceUnit.setComponent(this);
+        registry.registerServiceUnit(serviceUnit);
     }
 
     /* (non-Javadoc)
@@ -328,10 +332,6 @@
     @Override
     protected void doInit() throws Exception {
         super.doInit();
-        serviceUnit = new XBeanServiceUnit();
-        serviceUnit.setName("#default#");
-        serviceUnit.setComponent(this);
-        registry.registerServiceUnit(serviceUnit);
         List endpoints = getConfiguredEndpoints();
         if (endpoints != null && !endpoints.isEmpty()) {
             Iterator iter = endpoints.iterator();

Modified: servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/ServiceUnit.java
URL: http://svn.apache.org/viewvc/servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/ServiceUnit.java?rev=679199&r1=679198&r2=679199&view=diff
==============================================================================
--- servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/ServiceUnit.java
(original)
+++ servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/ServiceUnit.java
Wed Jul 23 13:55:36 2008
@@ -45,7 +45,7 @@
         this.component = component;
     }
 
-    public void start() throws Exception {
+    public synchronized void start() throws Exception {
         // Activate endpoints
         List<Endpoint> activated = new ArrayList<Endpoint>();
         try {
@@ -67,7 +67,7 @@
         }
     }
 
-    public void stop() throws Exception {
+    public synchronized void stop() throws Exception {
         this.status = LifeCycleMBean.STOPPED;
         // Deactivate endpoints
         Exception exception = null;
@@ -83,7 +83,7 @@
         }
     }
 
-    public void shutDown() throws JBIException {
+    public synchronized void shutDown() throws JBIException {
         this.status = LifeCycleMBean.SHUTDOWN;
     }
 
@@ -126,7 +126,7 @@
         return this.endpoints.values();
     }
 
-    public void addEndpoint(Endpoint endpoint) throws DeploymentException {
+    public synchronized void addEndpoint(Endpoint endpoint) throws DeploymentException {
         String key = EndpointSupport.getKey(endpoint);
         if (this.endpoints.put(key, endpoint) != null) {
             throw new DeploymentException(
@@ -141,7 +141,7 @@
         }
     }
 
-    public void removeEndpoint(Endpoint endpoint) throws DeploymentException {
+    public synchronized void removeEndpoint(Endpoint endpoint) throws DeploymentException
{
         String key = EndpointSupport.getKey(endpoint);
         if (this.endpoints.remove(key) == null) {
             throw new DeploymentException("Endpoint not found in the SU for key: " + EndpointSupport.getKey(endpoint));



Mime
View raw message