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 2007/03/21 08:59:06 UTC
svn commit: r520791 - in /webservices/axis2/trunk/java/modules:
clustering/src/org/apache/axis2/cluster/tribes/
clustering/src/org/apache/axis2/cluster/tribes/configuration/
clustering/src/org/apache/axis2/cluster/tribes/context/
clustering/src/org/apa...
Author: azeez
Date: Wed Mar 21 00:59:05 2007
New Revision: 520791
URL: http://svn.apache.org/viewvc?view=rev&rev=520791
Log:
Added methods to communicate exceptions
Added:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/CommandType.java
- copied, changed from r520779, webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/CommandType.java
Removed:
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/CommandType.java
Modified:
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelSender.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/TribesConfigurationManager.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdateEntryCommandMessage.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdater.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/info/TransientTribesChannelInfo.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManager.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManagerListener.java
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java?view=diff&rev=520791&r1=520790&r2=520791
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java Wed Mar 21 00:59:05 2007
@@ -19,7 +19,7 @@
import java.io.Serializable;
import java.util.Map;
-import org.apache.axis2.cluster.ClusteringFault;
+import org.apache.axis2.cluster.CommandType;
import org.apache.axis2.cluster.configuration.ConfigurationEvent;
import org.apache.axis2.cluster.context.ContextEvent;
import org.apache.axis2.cluster.tribes.configuration.ConfigurationCommand;
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelSender.java?view=diff&rev=520791&r1=520790&r2=520791
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelSender.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelSender.java Wed Mar 21 00:59:05 2007
@@ -16,11 +16,7 @@
package org.apache.axis2.cluster.tribes;
-import java.io.Serializable;
-
import org.apache.axis2.cluster.ClusteringFault;
-import org.apache.axis2.cluster.tribes.context.ContextCommandMessage;
-import org.apache.axis2.cluster.tribes.context.TribesContextManager;
import org.apache.catalina.tribes.Channel;
import org.apache.catalina.tribes.ChannelException;
import org.apache.catalina.tribes.Member;
@@ -29,42 +25,64 @@
public class ChannelSender {
- private Channel channel;
-
+ private Channel channel;
+
private static final Log log = LogFactory.getLog(ChannelSender.class);
-
- public void send(CommandMessage msg) throws ClusteringFault {
- Member[] group = channel.getMembers();
- log.debug("Group size " + group.length);
- // send the message
-
- for (int i=0;i<group.length;i++) {
- printMember(group[i]);
- }
-
- try {
- channel.send(group, msg, 0);
- } catch (ChannelException e) {
- log.error("" + msg, e);
- String message = "Error sending command message : " + msg;
- throw new ClusteringFault (message, e);
- }
- }
-
- public Channel getChannel() {
- return channel;
- }
-
- public void setChannel(Channel channel) {
- this.channel = channel;
- }
-
- private void printMember(Member member) {
- member.getUniqueId();
- log.debug("\n===============================");
- log.debug("Member Name " + member.getName());
- log.debug("Member Host" + member.getHost());
- log.debug("Member Payload" + member.getPayload());
- log.debug("===============================\n");
- }
+
+ public void send(CommandMessage msg) throws ClusteringFault {
+ Member[] group = channel.getMembers();
+ log.debug("Group size " + group.length);
+ // send the message
+
+ for (int i = 0; i < group.length; i++) {
+ printMember(group[i]);
+ }
+
+ if (group.length > 0) {
+ try {
+ channel.send(group, msg, 0);
+ } catch (ChannelException e) {
+ log.error("" + msg, e);
+ String message = "Error sending command message : " + msg;
+ throw new ClusteringFault(message, e);
+ }
+ }
+ }
+
+ public void send(Throwable throwable) throws ClusteringFault {
+ Member[] group = channel.getMembers();
+ log.debug("Group size " + group.length);
+ // send the message
+
+ for (int i = 0; i < group.length; i++) {
+ printMember(group[i]);
+ }
+
+ if (group.length > 0) {
+ try {
+ channel.send(group, throwable, 0);
+ } catch (ChannelException e) {
+ log.error("" + throwable, e);
+ String message = "Error sending exception message : " + throwable;
+ throw new ClusteringFault(message, e);
+ }
+ }
+ }
+
+ public Channel getChannel() {
+ return channel;
+ }
+
+ public void setChannel(Channel channel) {
+ this.channel = channel;
+ }
+
+ private void printMember(Member member) {
+ member.getUniqueId();
+ log.debug("\n===============================");
+ log.debug("Member Name " + member.getName());
+ log.debug("Member Host" + member.getHost());
+ log.debug("Member Payload" + member.getPayload());
+ log.debug("===============================\n");
+ }
}
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/TribesConfigurationManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/TribesConfigurationManager.java?view=diff&rev=520791&r1=520790&r2=520791
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/TribesConfigurationManager.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/TribesConfigurationManager.java Wed Mar 21 00:59:05 2007
@@ -17,11 +17,11 @@
package org.apache.axis2.cluster.tribes.configuration;
import org.apache.axis2.cluster.ClusteringFault;
+import org.apache.axis2.cluster.CommandType;
import org.apache.axis2.cluster.configuration.ConfigurationEvent;
import org.apache.axis2.cluster.configuration.ConfigurationManager;
import org.apache.axis2.cluster.configuration.ConfigurationManagerListener;
import org.apache.axis2.cluster.tribes.ChannelSender;
-import org.apache.axis2.cluster.tribes.CommandType;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.catalina.tribes.Channel;
import org.apache.catalina.tribes.ChannelException;
@@ -62,6 +62,10 @@
send(command);
}
+ public void exceptionOccurred(Throwable throwable) throws ClusteringFault {
+ send(throwable);
+ }
+
public void loadServiceGroup(String serviceGroupName) throws ClusteringFault {
ConfigurationCommand command = new ConfigurationCommand(CommandType.LOAD_SERVICE_GROUP);
command.setSgcName(serviceGroupName);
@@ -89,13 +93,15 @@
send(command);
}
+ private void send(Throwable throwable) throws ClusteringFault {
+ sender.send(throwable);
+ }
+
private void send(ConfigurationCommand command) throws ClusteringFault {
- Channel channel = sender.getChannel();
- if (channel.getMembers().length > 0) {
- sender.send(command);
- }
+ sender.send(command);
// Need to send the message to self too
+ Channel channel = sender.getChannel();
try {
channel.send(new Member[]{channel.getLocalMember(true)},
command,
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdateEntryCommandMessage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdateEntryCommandMessage.java?view=diff&rev=520791&r1=520790&r2=520791
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdateEntryCommandMessage.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdateEntryCommandMessage.java Wed Mar 21 00:59:05 2007
@@ -18,7 +18,7 @@
import java.io.Serializable;
-import org.apache.axis2.cluster.tribes.CommandType;
+import org.apache.axis2.cluster.CommandType;
public class ContextUpdateEntryCommandMessage extends ContextCommandMessage {
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdater.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdater.java?view=diff&rev=520791&r1=520790&r2=520791
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdater.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/ContextUpdater.java Wed Mar 21 00:59:05 2007
@@ -25,238 +25,236 @@
import java.util.Map;
import java.util.Set;
-import org.apache.axis2.cluster.tribes.CommandType;
-
public class ContextUpdater {
- private Map serviceCtxProps = null;
- private Map serviceGrpCtxProps = null;
+ private Map serviceCtxProps = null;
+ private Map serviceGrpCtxProps = null;
- public Map getServiceCtxProps() {
- return serviceCtxProps;
- }
-
- public Map getServiceGrpCtxProps() {
- return serviceGrpCtxProps;
- }
-
- public ContextUpdater() {
- serviceCtxProps = new HashMap ();
- serviceGrpCtxProps = new HashMap ();
- }
-
- public void addServiceContext(String parentId, String serviceCtxName) {
- String key = parentId + "_" + serviceCtxName;
- serviceCtxProps.put(key, new HashMap());
- }
-
- public void addServiceGroupContext(String groupId) {
- String key = groupId;
- serviceGrpCtxProps.put(key, new HashMap());
- }
-
- public void removeServiceContext(String parentId, String serviceCtxName) {
- String key = parentId + "_" + serviceCtxName;
- serviceCtxProps.remove(key);
- }
-
- public void removeServiceGroupContext(String groupId) {
- String key = groupId;
- serviceGrpCtxProps.remove(key);
- }
-
- public void addPropToServiceContext(String parentId, String serviceCtxName,
- String propName, Object value) {
- String key = parentId + "_" + serviceCtxName;
- HashMap map = (HashMap) serviceCtxProps.get(key);
- map.put(propName, value);
- }
-
- public void addPropToServiceGroupContext(String groupId, String propName,
- Object value) {
- String key = groupId;
- HashMap map = (HashMap) serviceGrpCtxProps.get(key);
- map.put(propName, value);
- }
-
- public void removePropFromServiceContext(String parentId,
- String serviceCtxName, String propName) {
- String key = parentId + "_" + serviceCtxName;
- HashMap map = (HashMap) serviceCtxProps.get(key);
- map.remove(propName);
- }
-
- public void removePropFromServiceGroupContext(String groupId,
- String propName) {
- String key = groupId;
- HashMap map = (HashMap) serviceGrpCtxProps.get(key);
- map.remove(propName);
- }
-
- public void updatePropOnServiceContext(String parentId,
- String serviceCtxName, String propName, Object value) {
- String key = parentId + "_" + serviceCtxName;
- HashMap map = (HashMap) serviceCtxProps.get(key);
- map.put(propName, value);
- }
-
- public void updatePropOnServiceGroupContext(String groupId,
- String propName, Object value) {
- String key = groupId;
- HashMap map = (HashMap) serviceGrpCtxProps.get(key);
- map.put(propName, value);
- }
-
- public Map getServiceGroupProps(String groupId) {
- return (Map) serviceGrpCtxProps.get(groupId);
- }
-
- public Map getServiceProps(String parentId, String serviceCtxName) {
- String key = parentId + "_" + serviceCtxName;
- return (Map) serviceCtxProps.get(key);
- }
-
- public List updateStateOnServiceContext(String parentId,
- String serviceCtxName, Map newProps) {
- String key = parentId + "_" + serviceCtxName;
- HashMap oldProps = (HashMap) serviceCtxProps.get(key);
- if (oldProps == null) {
- oldProps = new HashMap();
- serviceCtxProps.put(key, oldProps);
- }
-
- List commandList = new ArrayList();
-
- try {
- // using set operations to figure out the diffs
-
- // figuring out entries to remove
- Set diffForRemove = new HashSet();
- diffForRemove.addAll(oldProps.keySet());
- diffForRemove.removeAll(newProps.keySet());
-
- // figuring out new entires
- Set diffForAddOrUpdate = new HashSet();
- diffForAddOrUpdate.addAll(newProps.keySet());
- diffForAddOrUpdate.removeAll(oldProps.keySet());
-
- // figuring out entries to update
- for (Iterator it= newProps.keySet().iterator();it.hasNext();) {
-
- String paramKey = (String) it.next();
-
- Object oldValue = oldProps.get(paramKey);
- Object newValue = newProps.get(paramKey);
-
- if (oldValue != null && !oldValue.equals(newValue)) {
- diffForAddOrUpdate.add(paramKey);
- }
- }
-
- for (Iterator it= diffForAddOrUpdate.iterator();it.hasNext();) {
-
- String paramKey = (String) it.next();
-
- Object value = newProps.get(paramKey);
- if (value instanceof Serializable) {
- oldProps.put(paramKey, value);
- commandList.add(new ContextUpdateEntryCommandMessage(
- parentId,
- serviceCtxName, serviceCtxName, paramKey,
- (Serializable) value,
- ContextUpdateEntryCommandMessage.SERVICE_CONTEXT,
- ContextUpdateEntryCommandMessage.ADD_OR_UPDATE_ENTRY));
- }
- }
-
- for (Iterator it= diffForRemove.iterator();it.hasNext();) {
-
- String paramKey = (String) it.next();
-
- oldProps.remove(paramKey);
- commandList.add(new ContextUpdateEntryCommandMessage(
- parentId,
- serviceCtxName, serviceCtxName, paramKey, "",
- ContextUpdateEntryCommandMessage.SERVICE_CONTEXT,
- ContextUpdateEntryCommandMessage.REMOVE_ENTRY));
-
- }
- } catch (RuntimeException e) {
- e.printStackTrace();
- }
-
- return commandList;
- }
-
- public List updateStateOnServiceGroupContext(String ctxId,
- Map newProps) {
- HashMap oldProps = (HashMap) serviceGrpCtxProps.get(ctxId);
- if (oldProps == null) {
- oldProps = new HashMap();
- serviceCtxProps.put(ctxId, oldProps);
- }
-
- List commandList = new ArrayList ();
-
- try {
- // using set operations to figure out the diffs
-
- // figuring out entries to remove
- Set diffForRemove = new HashSet();
- diffForRemove.addAll(oldProps.keySet());
- diffForRemove.removeAll(newProps.keySet());
-
- // figuring out entries to update
- Set diffForAddOrUpdate = new HashSet ();
- diffForAddOrUpdate.addAll(newProps.keySet());
- diffForAddOrUpdate.removeAll(oldProps.keySet());
-
- // figuring out entries to update
- for (Iterator it=newProps.keySet().iterator();it.hasNext();) {
-
- String paramKey = (String) it.next();
-
- Object oldValue = oldProps.get(paramKey);
- Object newValue = newProps.get(paramKey);
-
- if (oldValue != null && !oldValue.equals(newValue)) {
- diffForAddOrUpdate.add(paramKey);
- }
- }
-
- for (Iterator it=diffForAddOrUpdate.iterator();it.hasNext();) {
-
- String paramKey = (String) it.next();
-
- Object value = newProps.get(paramKey);
- if (value instanceof Serializable) {
- oldProps.put(paramKey, value);
- commandList.add(new ContextUpdateEntryCommandMessage(
- "",
- ctxId,
- ctxId, paramKey, (Serializable) value,
- ContextUpdateEntryCommandMessage.SERVICE_GROUP_CONTEXT,
- ContextUpdateEntryCommandMessage.ADD_OR_UPDATE_ENTRY));
- // oldProps.replicate(paramKey, true); //
- // map.replicate(true) will replicate all
- }
- }
-
- for (Iterator it=diffForRemove.iterator();it.hasNext();) {
-
- String paramKey = (String) it.next();
-
- commandList.add(new ContextUpdateEntryCommandMessage(
- "", ctxId, ctxId,
- paramKey, "",
- ContextUpdateEntryCommandMessage.SERVICE_GROUP_CONTEXT,
- ContextUpdateEntryCommandMessage.REMOVE_ENTRY));
- // oldProps.remove(paramKey);
- }
- } catch (RuntimeException e) {
- e.printStackTrace();
- }
+ public Map getServiceCtxProps() {
+ return serviceCtxProps;
+ }
+
+ public Map getServiceGrpCtxProps() {
+ return serviceGrpCtxProps;
+ }
+
+ public ContextUpdater() {
+ serviceCtxProps = new HashMap ();
+ serviceGrpCtxProps = new HashMap ();
+ }
+
+ public void addServiceContext(String parentId, String serviceCtxName) {
+ String key = parentId + "_" + serviceCtxName;
+ serviceCtxProps.put(key, new HashMap());
+ }
+
+ public void addServiceGroupContext(String groupId) {
+ String key = groupId;
+ serviceGrpCtxProps.put(key, new HashMap());
+ }
+
+ public void removeServiceContext(String parentId, String serviceCtxName) {
+ String key = parentId + "_" + serviceCtxName;
+ serviceCtxProps.remove(key);
+ }
+
+ public void removeServiceGroupContext(String groupId) {
+ String key = groupId;
+ serviceGrpCtxProps.remove(key);
+ }
+
+ public void addPropToServiceContext(String parentId, String serviceCtxName,
+ String propName, Object value) {
+ String key = parentId + "_" + serviceCtxName;
+ HashMap map = (HashMap) serviceCtxProps.get(key);
+ map.put(propName, value);
+ }
+
+ public void addPropToServiceGroupContext(String groupId, String propName,
+ Object value) {
+ String key = groupId;
+ HashMap map = (HashMap) serviceGrpCtxProps.get(key);
+ map.put(propName, value);
+ }
+
+ public void removePropFromServiceContext(String parentId,
+ String serviceCtxName, String propName) {
+ String key = parentId + "_" + serviceCtxName;
+ HashMap map = (HashMap) serviceCtxProps.get(key);
+ map.remove(propName);
+ }
+
+ public void removePropFromServiceGroupContext(String groupId,
+ String propName) {
+ String key = groupId;
+ HashMap map = (HashMap) serviceGrpCtxProps.get(key);
+ map.remove(propName);
+ }
+
+ public void updatePropOnServiceContext(String parentId,
+ String serviceCtxName, String propName, Object value) {
+ String key = parentId + "_" + serviceCtxName;
+ HashMap map = (HashMap) serviceCtxProps.get(key);
+ map.put(propName, value);
+ }
+
+ public void updatePropOnServiceGroupContext(String groupId,
+ String propName, Object value) {
+ String key = groupId;
+ HashMap map = (HashMap) serviceGrpCtxProps.get(key);
+ map.put(propName, value);
+ }
+
+ public Map getServiceGroupProps(String groupId) {
+ return (Map) serviceGrpCtxProps.get(groupId);
+ }
+
+ public Map getServiceProps(String parentId, String serviceCtxName) {
+ String key = parentId + "_" + serviceCtxName;
+ return (Map) serviceCtxProps.get(key);
+ }
+
+ public List updateStateOnServiceContext(String parentId,
+ String serviceCtxName, Map newProps) {
+ String key = parentId + "_" + serviceCtxName;
+ HashMap oldProps = (HashMap) serviceCtxProps.get(key);
+ if (oldProps == null) {
+ oldProps = new HashMap();
+ serviceCtxProps.put(key, oldProps);
+ }
+
+ List commandList = new ArrayList();
+
+ try {
+ // using set operations to figure out the diffs
+
+ // figuring out entries to remove
+ Set diffForRemove = new HashSet();
+ diffForRemove.addAll(oldProps.keySet());
+ diffForRemove.removeAll(newProps.keySet());
+
+ // figuring out new entires
+ Set diffForAddOrUpdate = new HashSet();
+ diffForAddOrUpdate.addAll(newProps.keySet());
+ diffForAddOrUpdate.removeAll(oldProps.keySet());
+
+ // figuring out entries to update
+ for (Iterator it= newProps.keySet().iterator();it.hasNext();) {
+
+ String paramKey = (String) it.next();
+
+ Object oldValue = oldProps.get(paramKey);
+ Object newValue = newProps.get(paramKey);
+
+ if (oldValue != null && !oldValue.equals(newValue)) {
+ diffForAddOrUpdate.add(paramKey);
+ }
+ }
+
+ for (Iterator it= diffForAddOrUpdate.iterator();it.hasNext();) {
+
+ String paramKey = (String) it.next();
+
+ Object value = newProps.get(paramKey);
+ if (value instanceof Serializable) {
+ oldProps.put(paramKey, value);
+ commandList.add(new ContextUpdateEntryCommandMessage(
+ parentId,
+ serviceCtxName, serviceCtxName, paramKey,
+ (Serializable) value,
+ ContextUpdateEntryCommandMessage.SERVICE_CONTEXT,
+ ContextUpdateEntryCommandMessage.ADD_OR_UPDATE_ENTRY));
+ }
+ }
+
+ for (Iterator it= diffForRemove.iterator();it.hasNext();) {
+
+ String paramKey = (String) it.next();
+
+ oldProps.remove(paramKey);
+ commandList.add(new ContextUpdateEntryCommandMessage(
+ parentId,
+ serviceCtxName, serviceCtxName, paramKey, "",
+ ContextUpdateEntryCommandMessage.SERVICE_CONTEXT,
+ ContextUpdateEntryCommandMessage.REMOVE_ENTRY));
+
+ }
+ } catch (RuntimeException e) {
+ e.printStackTrace();
+ }
+
+ return commandList;
+ }
+
+ public List updateStateOnServiceGroupContext(String ctxId,
+ Map newProps) {
+ HashMap oldProps = (HashMap) serviceGrpCtxProps.get(ctxId);
+ if (oldProps == null) {
+ oldProps = new HashMap();
+ serviceCtxProps.put(ctxId, oldProps);
+ }
+
+ List commandList = new ArrayList ();
+
+ try {
+ // using set operations to figure out the diffs
+
+ // figuring out entries to remove
+ Set diffForRemove = new HashSet();
+ diffForRemove.addAll(oldProps.keySet());
+ diffForRemove.removeAll(newProps.keySet());
+
+ // figuring out entries to update
+ Set diffForAddOrUpdate = new HashSet ();
+ diffForAddOrUpdate.addAll(newProps.keySet());
+ diffForAddOrUpdate.removeAll(oldProps.keySet());
+
+ // figuring out entries to update
+ for (Iterator it=newProps.keySet().iterator();it.hasNext();) {
+
+ String paramKey = (String) it.next();
+
+ Object oldValue = oldProps.get(paramKey);
+ Object newValue = newProps.get(paramKey);
+
+ if (oldValue != null && !oldValue.equals(newValue)) {
+ diffForAddOrUpdate.add(paramKey);
+ }
+ }
+
+ for (Iterator it=diffForAddOrUpdate.iterator();it.hasNext();) {
+
+ String paramKey = (String) it.next();
+
+ Object value = newProps.get(paramKey);
+ if (value instanceof Serializable) {
+ oldProps.put(paramKey, value);
+ commandList.add(new ContextUpdateEntryCommandMessage(
+ "",
+ ctxId,
+ ctxId, paramKey, (Serializable) value,
+ ContextUpdateEntryCommandMessage.SERVICE_GROUP_CONTEXT,
+ ContextUpdateEntryCommandMessage.ADD_OR_UPDATE_ENTRY));
+ // oldProps.replicate(paramKey, true); //
+ // map.replicate(true) will replicate all
+ }
+ }
+
+ for (Iterator it=diffForRemove.iterator();it.hasNext();) {
+
+ String paramKey = (String) it.next();
+
+ commandList.add(new ContextUpdateEntryCommandMessage(
+ "", ctxId, ctxId,
+ paramKey, "",
+ ContextUpdateEntryCommandMessage.SERVICE_GROUP_CONTEXT,
+ ContextUpdateEntryCommandMessage.REMOVE_ENTRY));
+ // oldProps.remove(paramKey);
+ }
+ } catch (RuntimeException e) {
+ e.printStackTrace();
+ }
- return commandList;
- }
+ return commandList;
+ }
}
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java?view=diff&rev=520791&r1=520790&r2=520791
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java Wed Mar 21 00:59:05 2007
@@ -17,13 +17,13 @@
package org.apache.axis2.cluster.tribes.context;
import org.apache.axis2.cluster.ClusteringFault;
+import org.apache.axis2.cluster.CommandType;
import org.apache.axis2.cluster.context.ContextEvent;
import org.apache.axis2.cluster.context.ContextManager;
import org.apache.axis2.cluster.context.ContextManagerListener;
import org.apache.axis2.cluster.listeners.DefaultContextManagerListener;
import org.apache.axis2.cluster.tribes.ChannelSender;
import org.apache.axis2.cluster.tribes.CommandMessage;
-import org.apache.axis2.cluster.tribes.CommandType;
import org.apache.axis2.context.AbstractContext;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ServiceContext;
@@ -298,8 +298,6 @@
}
private void send(CommandMessage command) throws ClusteringFault {
- if (sender.getChannel().getMembers().length > 0) {
- sender.send(command);
- }
+ sender.send(command);
}
}
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/info/TransientTribesChannelInfo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/info/TransientTribesChannelInfo.java?view=diff&rev=520791&r1=520790&r2=520791
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/info/TransientTribesChannelInfo.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/info/TransientTribesChannelInfo.java Wed Mar 21 00:59:05 2007
@@ -18,7 +18,7 @@
import java.io.Serializable;
-import org.apache.axis2.cluster.tribes.CommandType;
+import org.apache.axis2.cluster.CommandType;
import org.apache.axis2.cluster.tribes.context.ContextCommandMessage;
import org.apache.catalina.tribes.ChannelListener;
import org.apache.catalina.tribes.Member;
@@ -53,7 +53,7 @@
grpCtxCreationCount++;
} else if (comMsg.getCommandType()==CommandType.CREATE_SERVICE_CONTEXT) {
srvCtxCreationCount++;
- } else if (comMsg.getCommandType()==CommandType.REMOVE_SERVICE_GROUP_CONTEXT) {
+ } else if (comMsg.getCommandType()== CommandType.REMOVE_SERVICE_GROUP_CONTEXT) {
grpCtxRemoveCount++;
} else if (comMsg.getCommandType()==CommandType.REMOVE_SERVICE_CONTEXT) {
srvCtxRemoveCount++;
Copied: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/CommandType.java (from r520779, webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/CommandType.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/CommandType.java?view=diff&rev=520791&p1=webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/CommandType.java&r1=520779&p2=webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/CommandType.java&r2=520791
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/CommandType.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/CommandType.java Wed Mar 21 00:59:05 2007
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.apache.axis2.cluster.tribes;
+package org.apache.axis2.cluster;
public interface CommandType {
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManager.java?view=diff&rev=520791&r1=520790&r2=520791
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManager.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManager.java Wed Mar 21 00:59:05 2007
@@ -21,26 +21,39 @@
import org.apache.neethi.Policy;
public interface ConfigurationManager {
-
- /*
- * Configuration management methods
- */
+
+ /*
+ * Configuration management methods
+ */
void loadServiceGroup(String serviceGroupName) throws ClusteringFault;
+
void unloadServiceGroup(String serviceGroupName) throws ClusteringFault;
+
void applyPolicy(String serviceGroupName, Policy policy) throws ClusteringFault;
- void reloadConfiguration() throws ClusteringFault ;
-
+
+ void reloadConfiguration() throws ClusteringFault;
+
/*
- * Transaction management methods
- */
+ * Transaction management methods
+ */
void prepare() throws ClusteringFault;
+
void rollback() throws ClusteringFault;
+
void commit() throws ClusteringFault;
-
+
+ /**
+ * To notify other nodes that an Exception occurred, during the processing
+ * of a {@link ConfigurationEvent}
+ *
+ * @param throwable The throwable which has to be propogated to other nodes
+ */
+ void exceptionOccurred(Throwable throwable) throws ClusteringFault;
+
/**
* For registering a configuration event listener.
*/
void addConfigurationManagerListener(ConfigurationManagerListener listener);
-
- void setAxisConfiguration (AxisConfiguration axisConfiguration);
+
+ void setAxisConfiguration(AxisConfiguration axisConfiguration);
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManagerListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManagerListener.java?view=diff&rev=520791&r1=520790&r2=520791
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManagerListener.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManagerListener.java Wed Mar 21 00:59:05 2007
@@ -19,12 +19,13 @@
import org.apache.axis2.engine.AxisConfiguration;
public interface ConfigurationManagerListener {
- public void serviceGroupLoaded(ConfigurationEvent event);
- public void serviceGroupUnloaded(ConfigurationEvent event);
- public void policyApplied(ConfigurationEvent event);
- public void configurationReloaded (ConfigurationEvent event);
- public void prepareCalled (ConfigurationEvent event);
- public void rollbackCalled (ConfigurationEvent event);
- public void commitCalled (ConfigurationEvent event);
- public void setAxisConfiguration (AxisConfiguration axisConfiguration);
+ void serviceGroupLoaded(ConfigurationEvent event);
+ void serviceGroupUnloaded(ConfigurationEvent event);
+ void policyApplied(ConfigurationEvent event);
+ void configurationReloaded (ConfigurationEvent event);
+ void prepareCalled (ConfigurationEvent event);
+ void rollbackCalled (ConfigurationEvent event);
+ void commitCalled (ConfigurationEvent event);
+ void handleException(Throwable throwable);
+ void setAxisConfiguration (AxisConfiguration axisConfiguration);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org