You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by ks...@apache.org on 2010/11/09 16:09:16 UTC

svn commit: r1033007 - in /juddi/trunk/juddi-core/src/main/java/org/apache/juddi: config/Property.java subscription/SubscriptionNotifier.java

Author: kstam
Date: Tue Nov  9 15:09:16 2010
New Revision: 1033007

URL: http://svn.apache.org/viewvc?rev=1033007&view=rev
Log:
JUDDI-423 making the setting for acceptable lagtime configurable.

Modified:
    juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java
    juddi/trunk/juddi-core/src/main/java/org/apache/juddi/subscription/SubscriptionNotifier.java

Modified: juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java?rev=1033007&r1=1033006&r2=1033007&view=diff
==============================================================================
--- juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java (original)
+++ juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java Tue Nov  9 15:09:16 2010
@@ -27,8 +27,9 @@ public interface Property 
 	public final static String JUDDI_TRANSFER_EXPIRATION_DAYS    ="juddi.transfer.expiration.days";
 	public final static String JUDDI_AUTHENTICATE_INQUIRY        ="juddi.authenticate.Inquiry";
 	public final static String JUDDI_SUBSCRIPTION_EXPIRATION_DAYS="juddi.subscription.expiration.days";
-	public final static String JUDDI_NOTIFICATION_START_BUFFER   ="juddi.notification.start.buffer";
-	public final static String JUDDI_NOTIFICATION_INTERVAL       ="juddi.notification.interval";
+	public final static String JUDDI_NOTIFICATION_START_BUFFER       ="juddi.notification.start.buffer";
+	public final static String JUDDI_NOTIFICATION_INTERVAL           ="juddi.notification.interval";
+	public final static String JUDDI_NOTIFICATION_ACCEPTABLE_LAGTIME ="juddi.notification.acceptable.lagtime";
 	public final static String JUDDI_SUBSCRIPTION_CHUNKEXPIRATION_MINUTES="juddi.subscription.chunkexpiration.minutes";
 	public final static String JUDDI_JNDI_REGISTRATION           ="juddi.jndi.registration";
 	public final static String JUDDI_SUBSCRIPTION_NOTIFICATION   ="juddi.subscription.notification";

Modified: juddi/trunk/juddi-core/src/main/java/org/apache/juddi/subscription/SubscriptionNotifier.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/subscription/SubscriptionNotifier.java?rev=1033007&r1=1033006&r2=1033007&view=diff
==============================================================================
--- juddi/trunk/juddi-core/src/main/java/org/apache/juddi/subscription/SubscriptionNotifier.java (original)
+++ juddi/trunk/juddi-core/src/main/java/org/apache/juddi/subscription/SubscriptionNotifier.java Tue Nov  9 15:09:16 2010
@@ -62,8 +62,8 @@ public class SubscriptionNotifier extend
 	private Timer timer = null;
 	private long startBuffer = AppConfig.getConfiguration().getLong(Property.JUDDI_NOTIFICATION_START_BUFFER, 20000l); // 20s startup delay default 
 	private long interval = AppConfig.getConfiguration().getLong(Property.JUDDI_NOTIFICATION_INTERVAL, 300000l); //5 min default
+	private long acceptableLagTime = AppConfig.getConfiguration().getLong(Property.JUDDI_NOTIFICATION_ACCEPTABLE_LAGTIME, 500l); //500 milliseconds
 	private UDDISubscriptionImpl subscriptionImpl = new UDDISubscriptionImpl();
-	private static long ACCEPTABLE_LAG_TIME = 500l; //500 milliseconds
 	private static String SUBR_V3_NAMESPACE = "urn:uddi-org:v3_service";
 	private static String SUBSCRIPTION_LISTENER = "UDDI_SubscriptionListener_Port";
 	
@@ -115,18 +115,20 @@ public class SubscriptionNotifier extend
 	}
 	/**
 	 * Checks to see that the event are fired on time. If they are late this may indicate that the server
-	 * is under load.
+	 * is under load. The acceptableLagTime is configurable using the "juddi.notification.acceptable.lagtime"
+	 * property and is defaulted to 500ms. A negative value means that you do not care about the lag time
+	 * and you simply always want to go do the notification work.
 	 * 
 	 * @param scheduleExecutionTime
 	 * @return true if the server is within the acceptable latency lag.
 	 */
 	private boolean firedOnTime(long scheduleExecutionTime) {
 		long lagTime = System.currentTimeMillis() - scheduleExecutionTime;
-		if (lagTime <= ACCEPTABLE_LAG_TIME) {
+		if (lagTime <= acceptableLagTime || acceptableLagTime < 0) {
 			return true;
 		} else {
 			log.warn("NotificationTimer is lagging " + lagTime + " milli seconds behind. A lag time "
-					+ "which exceeds an acceptable lagtime of " + ACCEPTABLE_LAG_TIME + "ms indicates "
+					+ "which exceeds an acceptable lagtime of " + acceptableLagTime + "ms indicates "
 					+ "that the registry server is under stress. We are therefore skipping this notification "
 					+ "cycle.");
 			return false;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org