You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2013/01/30 17:32:00 UTC

svn commit: r1440509 - /uima/sandbox/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/NodeAgent.java

Author: cwiklik
Date: Wed Jan 30 16:32:00 2013
New Revision: 1440509

URL: http://svn.apache.org/viewvc?rev=1440509&view=rev
Log:
UIMA-2622 Modified the Agent to check the state of a process before deciding which one to kill due to a low swap space

Modified:
    uima/sandbox/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/NodeAgent.java

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/NodeAgent.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/NodeAgent.java?rev=1440509&r1=1440508&r2=1440509&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/NodeAgent.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/NodeAgent.java Wed Jan 30 16:32:00 2013
@@ -411,6 +411,12 @@ public class NodeAgent extends AbstractD
       inventorySemaphore.release();
     }
   }
+  private boolean isProcessRunning(IDuccProcess process) {
+	  if ( process.getProcessState().equals(ProcessState.Running) || process.getProcessState().equals(ProcessState.Initializing) ) {
+		  return true;
+	  } 
+	  return false;
+  }
   /**
    * Called when swap space on a node reached minimum as defined by 
    * ducc.node.min.swap.threshold in ducc.properties. The agent will
@@ -424,7 +430,8 @@ public class NodeAgent extends AbstractD
       inventorySemaphore.acquire();
       //  find the fattest process
       for (Entry<DuccId, IDuccProcess> processEntry : getInventoryRef().entrySet()) {
-        if ( biggestProcess == null || biggestProcess.getResidentMemory() < processEntry.getValue().getResidentMemory() ) {
+        if ( isProcessRunning(processEntry.getValue()) &&
+        	 ( biggestProcess == null || biggestProcess.getResidentMemory() < processEntry.getValue().getResidentMemory() ) ) {
           biggestProcess = processEntry.getValue();
         }
       }