Author: degenaro
Date: Thu Apr 30 21:35:05 2015
New Revision: 1677081

URL: http://svn.apache.org/r1677081
Log:
UIMA-4375DUCC Web Server (WS) mis-classifies machine(s) as down

Modified:
    
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/MachineInfo.java
    
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/WebServerComponent.java

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/MachineInfo.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/MachineInfo.java?rev=1677081&r1=1677080&r2=1677081&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/MachineInfo.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/MachineInfo.java
 Thu Apr 30 21:35:05 2015
@@ -35,8 +35,9 @@ public class MachineInfo implements Comp
        private static DuccLogger logger = 
DuccLoggerComponents.getWsLogger(MachineInfo.class.getName());
        private static DuccId jobid = null;
        
-       private static final int SECONDS_PER_MILLI = 1000;
-       private static final int DOWN_AFTER_SECONDS = 65;
+       private long down_fudge = 10;
+       private long DOWN_AFTER_SECONDS = WebServerComponent.updateInterval + 
down_fudge;
+       private long SECONDS_PER_MILLI = 1000;
        
        private String fileDef;
        private String ip;
@@ -93,6 +94,9 @@ public class MachineInfo implements Comp
                catch(Throwable t) {
                        logger.warn(location, jobid, t);
                }
+               if(secondsMIA < DOWN_AFTER_SECONDS) {
+                       secondsMIA = DOWN_AFTER_SECONDS;
+               }
                return secondsMIA;
        }
        

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/WebServerComponent.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/WebServerComponent.java?rev=1677081&r1=1677080&r2=1677081&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/WebServerComponent.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/WebServerComponent.java
 Thu Apr 30 21:35:05 2015
@@ -59,7 +59,9 @@ implements IWebServer {
        private static AtomicInteger reservationCount = new AtomicInteger(0);
        
        private static AtomicLong updateLast = new 
AtomicLong(System.currentTimeMillis());
-       private static long updateInterval = 60*1000;
+       public static long updateInterval = 60*1000;
+       private static AtomicLong updateCount = new AtomicLong(0);
+       private static long warmup = 10;
        
        public WebServerComponent(CamelContext context, CommonConfiguration 
common) {
                super("WebServer",context);
@@ -144,6 +146,9 @@ implements IWebServer {
        private void sortMachines() {
                long last = updateLast.get();
                long deadline = last + updateInterval;
+               if(updateCount.getAndIncrement() < warmup) {
+                       deadline = last + updateInterval/10;
+               }
                long now = System.currentTimeMillis();
                if(now > deadline) {
                        boolean success = updateLast.compareAndSet(last, now);


Reply via email to