Author: objectiser
Date: 2009-02-19 07:33:24 -0500 (Thu, 19 Feb 2009)
New Revision: 518
Modified:
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorFilter.java
Log:
Updated to change from active/passive to manage/monitor terminology.
Modified:
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java
===================================================================
---
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java 2009-02-19
10:39:14 UTC (rev 517)
+++
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java 2009-02-19
12:33:24 UTC (rev 518)
@@ -332,31 +332,45 @@
ConfigTree config=ConfigTree.fromInputStream(is);
if (config.getName().equals(VALIDATOR_NODE)) {
+ // Old 'active' attribute is now 'mode'
String active=config.getAttribute(ACTIVE_ATTR);
if (active != null && active.equalsIgnoreCase("true")) {
+ m_managedMode = true;
+ }
+
+ String mode=config.getAttribute(MODE_ATTR);
+
+ if (mode != null) {
+ if (mode.equals("manage")) {
+ m_managedMode = true;
+ } else if (mode.equals("monitor")) {
+ m_managedMode = false; // will override active=true
+ } else {
+ logger.severe("Unknown mode '"+mode+"' - setting to
'monitor'");
+ m_managedMode = false;
+ }
+ }
- logger.info("Setting validators into active mode");
- m_active = true;
+ if (m_managedMode) {
+ logger.info("Setting validators in 'manage' mode");
} else {
- logger.info("Setting validators into passive mode");
- m_active = false;
+ logger.info("Setting validators in 'monitor' mode");
}
- // Check if dynamic reply-to endpoint timeout specified
- String timeout=config.getAttribute(DYNAMIC_ENDPOINT_TIMEOUT_ATTR);
- long replyToTimeout=DynamicReplyToEndpointManager.DYNAMIC_ENDPOINT_TIMEOUT;
+ // Check for dynamic replyTo endpoint timeout
+ String timeoutValue=config.getAttribute(REPLY_TO_TIMEOUT_ATTR);
- if (timeout != null && timeout.trim().length() > 0) {
+ if (timeoutValue != null) {
try {
- replyToTimeout = Long.parseLong(timeout);
- } catch(Exception te) {
- logger.severe("Dynamic endpoint timeout value '"+
- timeout+"' not a valid Long type: "+te);
+ long tv=Long.parseLong(timeoutValue);
+
+ m_replyToManager.setReplyToTimeout(tv);
+ } catch(Exception e) {
+ logger.log(Level.SEVERE,
+ "Unable to set 'reply to' timeout", e);
}
}
-
- m_replyToManager.setTimeout(replyToTimeout);
}
updateConfiguration(config, existingValidatorNames,
@@ -478,7 +492,7 @@
if (active != null && active.equalsIgnoreCase("true")) {
logger.info("Setting validator into active mode");
- m_active = true;
+ m_managedMode = true;
}
}
@@ -663,25 +677,26 @@
/**
* This method returns whether the service validator configuration
- * is in 'active' mode. If yes, then invalid messages will
+ * is in 'manage' mode. If yes, then invalid messages will
* be blocked from being delivered to their destination.
*
- * @return Whether the service validator is in 'active' mode
+ * @return Whether the service validator is in 'manage' mode
*/
- public boolean isActive() {
- return(m_active);
+ public boolean isManagedMode() {
+ return(m_managedMode);
}
private static final Logger logger =
Logger.getLogger("org.jboss.soa.overlord.validator.jbossesb");
private static final String EPR_ATTR = "epr";
private static final String DYNAMIC_REPLY_TO_ATTR = "dynamicReplyTo";
- private static final String DYNAMIC_ENDPOINT_TIMEOUT_ATTR =
"dynamicEndpointTimeout";
private static final String OUTPUT_NODE = "output";
private static final String INPUT_NODE = "input";
private static final String SERVICE_NODE = "service";
private static final String ACTIVE_ATTR = "active";
+ private static final String MODE_ATTR = "mode";
+ private static final String REPLY_TO_TIMEOUT_ATTR = "replyToTimeout";
private static final String VALIDATOR_NODE = "validator";
private static final String CONFIG_FILE = "validator-config.xml";
@@ -698,7 +713,7 @@
private java.util.Map<Endpoint,java.util.List<ServiceValidator>>
m_outputValidators=new
java.util.Hashtable<Endpoint,java.util.List<ServiceValidator>>();
private java.util.Set<Endpoint> m_inputDynaReplyTos=new
java.util.HashSet<Endpoint>();
private java.util.Set<Endpoint> m_outputDynaReplyTos=new
java.util.HashSet<Endpoint>();
- private boolean m_active=false;
+ private boolean m_managedMode=false;
private DynamicReplyToEndpointManager m_replyToManager=new
DynamicReplyToEndpointManager();
/**
@@ -777,8 +792,6 @@
public class DynamicReplyToEndpointManager extends Thread {
- public static final int DYNAMIC_ENDPOINT_TIMEOUT = 10000;
-
/**
* The default constructor
*/
@@ -798,7 +811,7 @@
try {
synchronized(this) {
- wait(m_timeout);
+ wait(m_replyToTimeout);
}
} catch(Exception e) {
logger.severe("Failed to wait");
@@ -845,20 +858,6 @@
}
/**
- * This method sets the timeout used to determine when to
- * discard the dynamic endpoints being monitored.
- *
- * @param timeout The timeout value
- */
- public void setTimeout(long timeout) {
- m_timeout = timeout;
-
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Dynamic endpoint monitoring timeout="+timeout);
- }
- }
-
- /**
* This method returns the list of service validators
* associated with the dynamic reply-to endpoint.
*
@@ -948,6 +947,16 @@
}
}
+ /**
+ * This method sets the timeout period for purging the
+ * cache of reply-to endpoints.
+ *
+ * @param timeoutValue The timeout value
+ */
+ public void setReplyToTimeout(long timeoutValue) {
+ m_replyToTimeout = timeoutValue;
+ }
+
private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_inputs=
new java.util.HashMap<Endpoint,java.util.List<ServiceValidator>>();
private java.util.Map<Endpoint,java.util.List<ServiceValidator>>
m_outputs=
@@ -956,6 +965,6 @@
new java.util.HashMap<Endpoint,java.util.List<ServiceValidator>>();
private java.util.Map<Endpoint,java.util.List<ServiceValidator>>
m_outputsPendingDelete=
new java.util.HashMap<Endpoint,java.util.List<ServiceValidator>>();
- private long m_timeout=DYNAMIC_ENDPOINT_TIMEOUT;
+ private long m_replyToTimeout=10000;
}
}
Modified:
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorFilter.java
===================================================================
---
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorFilter.java 2009-02-19
10:39:14 UTC (rev 517)
+++
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorFilter.java 2009-02-19
12:33:24 UTC (rev 518)
@@ -77,7 +77,7 @@
logger.log(java.util.logging.Level.SEVERE,
"Failed to handle sent message", ex);
- if (ServiceValidatorManager.instance().isActive()) {
+ if (ServiceValidatorManager.instance().isManagedMode()) {
throw new CourierException("Failed to handle sent message", ex);
}
} else {
@@ -140,7 +140,7 @@
logger.log(java.util.logging.Level.SEVERE,
"Failed to handle received message", ex);
- if (ServiceValidatorManager.instance().isActive()) {
+ if (ServiceValidatorManager.instance().isManagedMode()) {
throw new CourierException("Failed to handle received message",
ex);
}
} else {
Show replies by date