Author: azeez
Date: Thu Jan  6 10:36:35 2011
New Revision: 1055823

URL: http://svn.apache.org/viewvc?rev=1055823&view=rev
Log:
Fix for AXIS2-4080

invoke ServiceLifecycle.startup() after completely populating the AxisService


Modified:
    
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java

Modified: 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java?rev=1055823&r1=1055822&r2=1055823&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
 Thu Jan  6 10:36:35 2011
@@ -430,6 +430,7 @@ public class ServiceBuilder extends Desc
                        throw new DeploymentException(axisFault);
                }
 
+        startupServiceLifecycle();
                return service;
        }
 
@@ -507,14 +508,13 @@ public class ServiceBuilder extends Desc
 
        private void loadServiceLifeCycleClass(String className)
                        throws DeploymentException {
-               if (className != null) {
-                       try {
-                               ClassLoader loader = service.getClassLoader();
-                               Class serviceLifeCycleClassImpl = 
Loader.loadClass(loader,
+        if (className != null) {
+            try {
+                ClassLoader loader = service.getClassLoader();
+                Class serviceLifeCycleClassImpl = Loader.loadClass(loader,
                                                className);
-                               ServiceLifeCycle serviceLifeCycle = 
(ServiceLifeCycle) serviceLifeCycleClassImpl
-                                               .newInstance();
-                               serviceLifeCycle.startUp(configCtx, service);
+                ServiceLifeCycle serviceLifeCycle =
+                        (ServiceLifeCycle) 
serviceLifeCycleClassImpl.newInstance();
                                service.setServiceLifeCycle(serviceLifeCycle);
                        } catch (Exception e) {
                                throw new DeploymentException(e.getMessage(), 
e);
@@ -915,8 +915,10 @@ public class ServiceBuilder extends Desc
                }
        }
        
-       private void processPolicyAttachments(OMElement serviceElement, 
AxisService service) throws DeploymentException {
-               Iterator attachmentElements = 
serviceElement.getChildrenWithName(new QName(POLICY_NS_URI, 
TAG_POLICY_ATTACHMENT));
+       private void processPolicyAttachments(OMElement serviceElement,
+                                          AxisService service) throws 
DeploymentException {
+               Iterator attachmentElements =
+                serviceElement.getChildrenWithName(new QName(POLICY_NS_URI, 
TAG_POLICY_ATTACHMENT));
                try {
                        Utils.processPolicyAttachments(attachmentElements, 
service);
                } catch (Exception e) {
@@ -924,4 +926,9 @@ public class ServiceBuilder extends Desc
                }
        }
 
+    private void startupServiceLifecycle() {
+        if (service.getServiceLifeCycle() != null) {
+            service.getServiceLifeCycle().startUp(configCtx, service);
+        }
+    }
 }


Reply via email to