You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by az...@apache.org on 2008/09/17 12:53:00 UTC
svn commit: r696233 - in
/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2:
context/ConfigurationContextFactory.java engine/AxisServer.java
Author: azeez
Date: Wed Sep 17 03:53:00 2008
New Revision: 696233
URL: http://svn.apache.org/viewvc?rev=696233&view=rev
Log:
The cluster should be initialized at last
Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java?rev=696233&r1=696232&r2=696233&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java Wed Sep 17 03:53:00 2008
@@ -85,10 +85,6 @@
}
ConfigurationContext configContext = new ConfigurationContext(axisConfig);
- if (axisConfig.getClusterManager() != null) {
- configContext.initCluster();
- }
-
if (axisConfigurator instanceof DeploymentEngine) {
((DeploymentEngine) axisConfigurator).setConfigContext(configContext);
}
@@ -106,6 +102,12 @@
if (deploymentLifeCycleListener != null){
deploymentLifeCycleListener.postDeploy(configContext);
}
+
+ // Finally initialize the cluster
+ if (axisConfig.getClusterManager() != null) {
+ configContext.initCluster();
+ }
+
return configContext;
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java?rev=696233&r1=696232&r2=696233&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java Wed Sep 17 03:53:00 2008
@@ -20,6 +20,8 @@
package org.apache.axis2.engine;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.clustering.ClusterManager;
+import org.apache.axis2.clustering.ClusteringConstants;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.description.AxisService;
@@ -27,7 +29,7 @@
/**
* This class provide a very convenient way of creating server and deploying services.
* Once someone call start method it will fire up configuration context and start up the listeners.
- * One can provide repository location and axis.xml as system properties.
+ * One can provide repository location and axis.xml as system properties.
*/
public class AxisServer {
@@ -40,9 +42,10 @@
/**
* If you do not want Axis2 to start the server automatically then pass the "false" else "true"
+ *
* @param startOnDeploy : boolean
*/
- public AxisServer(boolean startOnDeploy){
+ public AxisServer(boolean startOnDeploy) {
this.startOnDeploy = startOnDeploy;
listenerManager = new ListenerManager();
}
@@ -57,17 +60,18 @@
/**
* Will make Java class into a web service
+ *
* @param serviceClassName : Actual class you want to make as a web service
* @throws AxisFault : If something went wrong
*/
- public void deployService(String serviceClassName) throws AxisFault{
- if(configContext==null){
+ public void deployService(String serviceClassName) throws AxisFault {
+ if (configContext == null) {
configContext = getConfigurationContext();
}
AxisConfiguration axisConfig = configContext.getAxisConfiguration();
- AxisService service = AxisService.createService(serviceClassName,axisConfig);
+ AxisService service = AxisService.createService(serviceClassName, axisConfig);
axisConfig.addService(service);
- if(startOnDeploy){
+ if (startOnDeploy) {
start();
}
}
@@ -75,13 +79,25 @@
/**
* Will create a configuration context from the avialable data and then it
* will start the listener manager
+ *
* @throws AxisFault if something went wrong
*/
- protected void start()throws AxisFault {
- if(configContext==null){
+ protected void start() throws AxisFault {
+ if (configContext == null) {
configContext = getConfigurationContext();
}
- if(!started){
+ if (!started) {
+
+ ClusterManager clusterManager =
+ configContext.getAxisConfiguration().getClusterManager();
+ String avoidInit = ClusteringConstants.Parameters.AVOID_INITIATION;
+ if (clusterManager != null &&
+ clusterManager.getParameter(avoidInit) != null &&
+ ((String) clusterManager.getParameter(avoidInit).getValue()).equalsIgnoreCase("true")) {
+ clusterManager.setConfigurationContext(configContext);
+ clusterManager.init();
+ }
+
listenerManager.startSystem(configContext);
started = true;
}
@@ -89,10 +105,11 @@
/**
* Stop the server, automatically terminates the listener manager as well.
+ *
* @throws AxisFault
*/
- public void stop() throws AxisFault{
- if(configContext!=null){
+ public void stop() throws AxisFault {
+ if (configContext != null) {
configContext.terminate();
}
}
@@ -113,7 +130,7 @@
* @throws AxisFault
*/
public ConfigurationContext getConfigurationContext() throws AxisFault {
- if(configContext == null){
+ if (configContext == null) {
configContext = createDefaultConfigurationContext();
}
return configContext;
@@ -121,6 +138,7 @@
/**
* Users extending this class can override this method to supply a custom ConfigurationContext
+ *
* @return ConfigurationContext
* @throws AxisFault
*/