[wsas-java-dev] svn commit r1722 -
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering
svn at wso2.org
svn at wso2.org
Tue Apr 3 03:14:55 PDT 2007
Author: azeez
Date: Tue Apr 3 03:14:29 2007
New Revision: 1722
Modified:
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/NodeManager.java
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/WSASConfigManagerListener.java
Log:
WSASConfigManagerListener notifies the NodeManager of a failure, who in turn will notify the AdminClient
Modified: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/NodeManager.java
==============================================================================
--- trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/NodeManager.java (original)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/NodeManager.java Tue Apr 3 03:14:29 2007
@@ -85,8 +85,8 @@
init();
ConfigurationManager configMan = getConfigurationManager();
if (configMan != null) {
- configMan.commit();
-// return commitSuccessful(configMan);
+// configMan.commit();
+ return isCommitSuccessful(configMan);
}
return true;
}
@@ -110,8 +110,8 @@
return null;
}
- private boolean commitSuccessful(ConfigurationManager configMan) throws AxisFault {
- delay(); // Wait for sometime, so that the failures on other nodes can be detected
+ private boolean isCommitSuccessful(ConfigurationManager configMan) throws AxisFault {
+// delay(); // Wait for sometime, so that the failures on other nodes can be detected
MessageContext msgCtx = MessageContext.getCurrentMessageContext();
AxisService axisService = msgCtx.getAxisService();
Parameter opFailed = axisService.getParameter(OPERATION_FAILED);
@@ -166,7 +166,7 @@
private void delay() {
try {
- Thread.sleep(3000);
+ Thread.sleep(5000);
} catch (InterruptedException e) {
log.error(e);
}
Modified: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/WSASConfigManagerListener.java
==============================================================================
--- trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/WSASConfigManagerListener.java (original)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/WSASConfigManagerListener.java Tue Apr 3 03:14:29 2007
@@ -22,6 +22,7 @@
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.description.AxisServiceGroup;
import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -116,6 +117,7 @@
AxisServiceGroup serviceGroup = axisConfig.getServiceGroup(sgName);
if (serviceGroup == null) {
try {
+ notifyFailureToNodeManager();
axisConfig.getClusterManager().getConfigurationManager().
exceptionOccurred(new Exception("Service group " + sgName +
" does not exist"));
@@ -137,7 +139,7 @@
isProcessing = true;
log.info("Applying policy to service ...");
- //TODO: impl
+ //TODO: impl
// We've finished processing this request, so reset the isProcessing flag to false
isProcessing = false;
@@ -171,8 +173,8 @@
"Waiting for prepare request...");
} catch (Throwable e) {
- //TODO: Need to propogate error to other nodes & the node manager
try {
+ notifyFailureToNodeManager();
configurationContext.getAxisConfiguration().
getClusterManager().getConfigurationManager().exceptionOccurred(e);
} catch (Exception e1) {
@@ -301,6 +303,14 @@
ignored.printStackTrace();
}
}
+
+ // Wait for a few more seconds, since a handleException message could be received
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException ignored) {
+ ignored.printStackTrace();
+ }
+
log.info("Committing configuration changes...");
for (Iterator iterator = pendingCommits.iterator(); iterator.hasNext();) {
Commit commit = (Commit) iterator.next();
@@ -311,7 +321,7 @@
(Controllable) configurationContext.
getProperty(ServerConstants.WSO2WSAS_INSTANCE);
try {
- configurationContext.getServiceGroupContexts().clear();
+ configurationContext.getServiceGroupContexts().clear();
ConfigurationContext configCtx =
(ConfigurationContext) commit.getObject();
controllable.setConfigurationContext(configCtx);
@@ -372,6 +382,15 @@
}
}
+ private void notifyFailureToNodeManager() throws AxisFault {
+ AxisService axisService =
+ configurationContext.getAxisConfiguration().
+ getService(ServerConstants.NODE_MANAGER_SERVICE);
+ if (axisService != null) {
+ axisService.addParameter(new Parameter(NodeManager.OPERATION_FAILED, "true"));
+ }
+ }
+
/**
* This object represents a cached commit event.
*/
More information about the Wsas-java-dev
mailing list