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 2019/08/02 17:27:49 UTC

svn commit: r1864247 [9/10] - in /uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent: ./ config/ deploy/ deploy/uima/ event/ exceptions/ launcher/ metrics/collectors/ monitor/ processors/

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/DuccGarbageStatsCollector.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/DuccGarbageStatsCollector.java?rev=1864247&r1=1864246&r2=1864247&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/DuccGarbageStatsCollector.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/DuccGarbageStatsCollector.java Fri Aug  2 17:27:48 2019
@@ -32,108 +32,105 @@ import org.apache.uima.ducc.common.utils
 import org.apache.uima.ducc.transport.event.common.IDuccProcess;
 
 public class DuccGarbageStatsCollector {
-	MBeanServerConnection connection = null;
-	DuccLogger logger = null;
-	IDuccProcess process = null;
-	JmxUrl jmxUrl = null;
-	private boolean reportJmxUrl = true;
-
-	public DuccGarbageStatsCollector(DuccLogger logger, IDuccProcess process) {
-		this.logger = logger;
-		this.process = process;
-		try {
-			jmxUrl = new JmxUrl(process);
-		} catch (Exception e) {
-			logger.error("DuccGarbageStatsCollector.ctor", null, e);
-		}
-
-	}
-
-	private MBeanServerConnection getServerConnection() throws Exception {
-		logger.info("DuccGarbageStatsCollector.getServerConnection()", null,
-				"Connecting GC collector to remote child process - URL:"
-						+ jmxUrl.get());
-		JMXServiceURL url = new JMXServiceURL(jmxUrl.get()); 
-		JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
-		return jmxc.getMBeanServerConnection();
-	}
-
-	public ProcessGarbageCollectionStats collect() {
-		ProcessGarbageCollectionStats gcStats = new ProcessGarbageCollectionStats();
-		try {
-			if (connection == null) {
-				// if there is a problem here, an exception will be thrown.
-				// The connection should never be null if getServerConnection()
-				// returns without an exception.
-				connection = getServerConnection();
-			}
-			Set<ObjectInstance> mbeans = connection.queryMBeans(
-					new ObjectName("java.lang:type=GarbageCollector,*"),
-					null);
-			Long totalCollectionCount = new Long(0);
-			Long totalCollectionTime = new Long(0);
-
-			for (ObjectInstance gcObject : mbeans) {
-				String gcCollectorName = gcObject.getObjectName()
-						.getCanonicalKeyPropertyListString();
-				ObjectName memoryManagerMXBean = new ObjectName(
-						"java.lang:" + gcCollectorName);
-				totalCollectionCount += (Long) connection.getAttribute(
-						memoryManagerMXBean, "CollectionCount");
-				totalCollectionTime += (Long) connection.getAttribute(
-						memoryManagerMXBean, "CollectionTime");
-			}
-			// Returns the total number of collections that have occurred.
-			gcStats.setCollectionCount(totalCollectionCount);
-			// Returns the approximate accumulated collection elapsed time
-			// in milliseconds.
-			gcStats.setCollectionTime(totalCollectionTime);
-			logger.debug("DuccGarbageStatsCollector.collect()", null,
-					"GC Collector Fetch Stats For PID:" + process.getPID()
-							+ " GC Count:" + gcStats.getCollectionCount()
-							+ " GC Time:" + gcStats.getCollectionTime());
-
-		} catch (Throwable e) {
-			// will retry this connection again
-			connection = null;
-			logger.error("", null, "Failed to Fetch JMX GC Stats From PID:"
-					+ process.getPID() + " Reason:\n" + e);
-			
-			logger.info("DuccGarbageStatsCollector.collect()", null,
-					"GC Collector Failed to Connect via JMX to child process PID:"
-							+ process.getPID() + " JmxUrl:" + jmxUrl.get()
-							+ " Will try to reconnect later");
-		}
-		
-		return gcStats;
-	}
-
-	private class JmxUrl {
-		IDuccProcess process = null;;
-
-		public JmxUrl(IDuccProcess remoteProcess) {
-			this.process = remoteProcess;
-		}
-
-		public boolean isAvailable() {
-			if (process != null && process.getProcessJmxUrl() != null
-					&& process.getProcessJmxUrl().trim().length() > 0) {
-				return true;
-			}
-			return false;
-		}
-
-		public String get() {
-			if (isAvailable()) {
-				if (reportJmxUrl) {
-					reportJmxUrl = false; // report this once
-					logger.info("JmxUrl.get()", null, "Remote Process JMX URL:"
-							+ process.getProcessJmxUrl());
-				}
-				return process.getProcessJmxUrl();
-			} else {
-				return "";
-			}
-		}
-	}
+  MBeanServerConnection connection = null;
+
+  DuccLogger logger = null;
+
+  IDuccProcess process = null;
+
+  JmxUrl jmxUrl = null;
+
+  private boolean reportJmxUrl = true;
+
+  public DuccGarbageStatsCollector(DuccLogger logger, IDuccProcess process) {
+    this.logger = logger;
+    this.process = process;
+    try {
+      jmxUrl = new JmxUrl(process);
+    } catch (Exception e) {
+      logger.error("DuccGarbageStatsCollector.ctor", null, e);
+    }
+
+  }
+
+  private MBeanServerConnection getServerConnection() throws Exception {
+    logger.info("DuccGarbageStatsCollector.getServerConnection()", null,
+            "Connecting GC collector to remote child process - URL:" + jmxUrl.get());
+    JMXServiceURL url = new JMXServiceURL(jmxUrl.get());
+    JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
+    return jmxc.getMBeanServerConnection();
+  }
+
+  public ProcessGarbageCollectionStats collect() {
+    ProcessGarbageCollectionStats gcStats = new ProcessGarbageCollectionStats();
+    try {
+      if (connection == null) {
+        // if there is a problem here, an exception will be thrown.
+        // The connection should never be null if getServerConnection()
+        // returns without an exception.
+        connection = getServerConnection();
+      }
+      Set<ObjectInstance> mbeans = connection
+              .queryMBeans(new ObjectName("java.lang:type=GarbageCollector,*"), null);
+      Long totalCollectionCount = new Long(0);
+      Long totalCollectionTime = new Long(0);
+
+      for (ObjectInstance gcObject : mbeans) {
+        String gcCollectorName = gcObject.getObjectName().getCanonicalKeyPropertyListString();
+        ObjectName memoryManagerMXBean = new ObjectName("java.lang:" + gcCollectorName);
+        totalCollectionCount += (Long) connection.getAttribute(memoryManagerMXBean,
+                "CollectionCount");
+        totalCollectionTime += (Long) connection.getAttribute(memoryManagerMXBean,
+                "CollectionTime");
+      }
+      // Returns the total number of collections that have occurred.
+      gcStats.setCollectionCount(totalCollectionCount);
+      // Returns the approximate accumulated collection elapsed time
+      // in milliseconds.
+      gcStats.setCollectionTime(totalCollectionTime);
+      logger.debug("DuccGarbageStatsCollector.collect()", null,
+              "GC Collector Fetch Stats For PID:" + process.getPID() + " GC Count:"
+                      + gcStats.getCollectionCount() + " GC Time:" + gcStats.getCollectionTime());
+
+    } catch (Throwable e) {
+      // will retry this connection again
+      connection = null;
+      logger.error("", null,
+              "Failed to Fetch JMX GC Stats From PID:" + process.getPID() + " Reason:\n" + e);
+
+      logger.info("DuccGarbageStatsCollector.collect()", null,
+              "GC Collector Failed to Connect via JMX to child process PID:" + process.getPID()
+                      + " JmxUrl:" + jmxUrl.get() + " Will try to reconnect later");
+    }
+
+    return gcStats;
+  }
+
+  private class JmxUrl {
+    IDuccProcess process = null;;
+
+    public JmxUrl(IDuccProcess remoteProcess) {
+      this.process = remoteProcess;
+    }
+
+    public boolean isAvailable() {
+      if (process != null && process.getProcessJmxUrl() != null
+              && process.getProcessJmxUrl().trim().length() > 0) {
+        return true;
+      }
+      return false;
+    }
+
+    public String get() {
+      if (isAvailable()) {
+        if (reportJmxUrl) {
+          reportJmxUrl = false; // report this once
+          logger.info("JmxUrl.get()", null, "Remote Process JMX URL:" + process.getProcessJmxUrl());
+        }
+        return process.getProcessJmxUrl();
+      } else {
+        return "";
+      }
+    }
+  }
 }

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/MetricCollector.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/MetricCollector.java?rev=1864247&r1=1864246&r2=1864247&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/MetricCollector.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/MetricCollector.java Fri Aug  2 17:27:48 2019
@@ -21,5 +21,5 @@ package org.apache.uima.ducc.agent.metri
 import java.io.IOException;
 
 public interface MetricCollector {
-  public void parseMetricFile()  throws IOException;
+  public void parseMetricFile() throws IOException;
 }

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeCpuCollector.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeCpuCollector.java?rev=1864247&r1=1864246&r2=1864247&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeCpuCollector.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeCpuCollector.java Fri Aug  2 17:27:48 2019
@@ -26,51 +26,48 @@ import java.util.concurrent.Callable;
 
 import org.apache.uima.ducc.common.node.metrics.NodeCpuInfo;
 
-
-
 public class NodeCpuCollector implements Callable<NodeCpuInfo> {
 
   public NodeCpuInfo call() throws Exception {
     OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean();
     return new NodeCpuInfo(osBean.getAvailableProcessors(), String.valueOf(getCPULoad()));
   }
-	private double getCPULoad() throws Exception {
-		double cpu = 0.0;
-		InputStreamReader in = null;
-		String[] command = {
-				"/bin/sh",
-				"-c",
-				"/bin/grep 'cpu' /proc/stat | /bin/awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage}'" };
-		try {
-			ProcessBuilder pb = new ProcessBuilder();
-			pb.command(command);
-
-			pb.redirectErrorStream(true);
-			Process swapCollectorProcess = pb.start();
-			in = new InputStreamReader(swapCollectorProcess.getInputStream());
-			BufferedReader reader = new BufferedReader(in);
-			String line = null;
-			while ((line = reader.readLine()) != null) {
-				System.out.println(line);
-				try {
-					cpu = Double.parseDouble(line.trim());
-				} catch (NumberFormatException e) {
-					cpu = 0;
-					e.printStackTrace();
-				}
-			}
-		} catch (Exception e) {
-			throw e;
-		} finally {
-			if (in != null) {
-				try {
-					in.close();
-				} catch (Exception e) {
-				}
 
-			}
-		}
+  private double getCPULoad() throws Exception {
+    double cpu = 0.0;
+    InputStreamReader in = null;
+    String[] command = { "/bin/sh", "-c",
+        "/bin/grep 'cpu' /proc/stat | /bin/awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage}'" };
+    try {
+      ProcessBuilder pb = new ProcessBuilder();
+      pb.command(command);
+
+      pb.redirectErrorStream(true);
+      Process swapCollectorProcess = pb.start();
+      in = new InputStreamReader(swapCollectorProcess.getInputStream());
+      BufferedReader reader = new BufferedReader(in);
+      String line = null;
+      while ((line = reader.readLine()) != null) {
+        System.out.println(line);
+        try {
+          cpu = Double.parseDouble(line.trim());
+        } catch (NumberFormatException e) {
+          cpu = 0;
+          e.printStackTrace();
+        }
+      }
+    } catch (Exception e) {
+      throw e;
+    } finally {
+      if (in != null) {
+        try {
+          in.close();
+        } catch (Exception e) {
+        }
 
-		return cpu;
-	}
+      }
+    }
+
+    return cpu;
+  }
 }

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeCpuUsageCollector.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeCpuUsageCollector.java?rev=1864247&r1=1864246&r2=1864247&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeCpuUsageCollector.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeCpuUsageCollector.java Fri Aug  2 17:27:48 2019
@@ -24,18 +24,16 @@ import java.util.concurrent.Callable;
 import org.apache.uima.ducc.common.agent.metrics.cpu.DuccNodeCpuUsage;
 import org.apache.uima.ducc.common.agent.metrics.cpu.NodeCpuUsage;
 
-
 public class NodeCpuUsageCollector extends AbstractMetricCollector
-implements Callable<NodeCpuUsage>{
-	
-	public NodeCpuUsageCollector(RandomAccessFile fileHandle,
-			int howMany, int offset) {
-		super(fileHandle, howMany, offset);
-	}
+        implements Callable<NodeCpuUsage> {
+
+  public NodeCpuUsageCollector(RandomAccessFile fileHandle, int howMany, int offset) {
+    super(fileHandle, howMany, offset);
+  }
 
-	public NodeCpuUsage call() throws Exception {
-		super.parseMetricFile();
-		return new DuccNodeCpuUsage(super.metricFileContents,
-				super.metricFieldOffsets, super.metricFieldLengths);
-	}
+  public NodeCpuUsage call() throws Exception {
+    super.parseMetricFile();
+    return new DuccNodeCpuUsage(super.metricFileContents, super.metricFieldOffsets,
+            super.metricFieldLengths);
+  }
 }

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeCpuUtilizationCollector.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeCpuUtilizationCollector.java?rev=1864247&r1=1864246&r2=1864247&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeCpuUtilizationCollector.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeCpuUtilizationCollector.java Fri Aug  2 17:27:48 2019
@@ -24,17 +24,16 @@ import java.util.concurrent.Callable;
 import org.apache.uima.ducc.common.agent.metrics.cpu.DuccNodeCpuUsage;
 import org.apache.uima.ducc.common.agent.metrics.cpu.NodeCpuUsage;
 
-
 public class NodeCpuUtilizationCollector extends AbstractMetricCollector
-implements Callable<NodeCpuUsage>{
-	
-	public NodeCpuUtilizationCollector(RandomAccessFile fileHandle,
-			int howMany, int offset) {
-		super(fileHandle, howMany, offset);
-	}
-	public NodeCpuUsage call() throws Exception {
-		super.parseMetricFile();
-		return new DuccNodeCpuUsage(super.metricFileContents,
-				super.metricFieldOffsets, super.metricFieldLengths);
-	}
+        implements Callable<NodeCpuUsage> {
+
+  public NodeCpuUtilizationCollector(RandomAccessFile fileHandle, int howMany, int offset) {
+    super(fileHandle, howMany, offset);
+  }
+
+  public NodeCpuUsage call() throws Exception {
+    super.parseMetricFile();
+    return new DuccNodeCpuUsage(super.metricFileContents, super.metricFieldOffsets,
+            super.metricFieldLengths);
+  }
 }

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeLoadAverageCollector.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeLoadAverageCollector.java?rev=1864247&r1=1864246&r2=1864247&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeLoadAverageCollector.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeLoadAverageCollector.java Fri Aug  2 17:27:48 2019
@@ -26,43 +26,41 @@ import java.util.concurrent.Callable;
 import org.apache.uima.ducc.common.node.metrics.NodeLoadAverage;
 import org.apache.uima.ducc.common.node.metrics.UptimeNodeLoadAverage;
 
-public class NodeLoadAverageCollector implements
-		Callable<NodeLoadAverage> {
+public class NodeLoadAverageCollector implements Callable<NodeLoadAverage> {
 
-	public NodeLoadAverageCollector() {
-	}
+  public NodeLoadAverageCollector() {
+  }
 
-	public NodeLoadAverage call() throws Exception {
-		return collect();
-	}
+  public NodeLoadAverage call() throws Exception {
+    return collect();
+  }
 
-	private NodeLoadAverage collect() throws Exception {
-		InputStream stream = null;
-		BufferedReader reader = null;
-		UptimeNodeLoadAverage uptimeLoadAverage = new UptimeNodeLoadAverage();
-		ProcessBuilder pb = new ProcessBuilder("uptime");
-		;
-		pb.redirectErrorStream(true);
-		Process proc = pb.start();
-		// spawn uptime command and scrape the output
-		stream = proc.getInputStream();
-		reader = new BufferedReader(new InputStreamReader(stream));
-		String line;
-		String regex = "\\s+";
-		String filter = "load average:";
-		// read the next line from ps output
-		while ((line = reader.readLine()) != null) {
-			int pos = 0;
-			if ((pos = line.indexOf(filter)) > -1) {
-				String la = line.substring(pos + filter.length()).replaceAll(
-						regex, "");
-				String[] averages = la.split(",");
-				uptimeLoadAverage.setLoadAvg1(averages[0]);
-				uptimeLoadAverage.setLoadAvg5(averages[1]);
-				uptimeLoadAverage.setLoadAvg15(averages[2]);
-			}
-		}
-		proc.waitFor();
-		return uptimeLoadAverage;
-	}
+  private NodeLoadAverage collect() throws Exception {
+    InputStream stream = null;
+    BufferedReader reader = null;
+    UptimeNodeLoadAverage uptimeLoadAverage = new UptimeNodeLoadAverage();
+    ProcessBuilder pb = new ProcessBuilder("uptime");
+    ;
+    pb.redirectErrorStream(true);
+    Process proc = pb.start();
+    // spawn uptime command and scrape the output
+    stream = proc.getInputStream();
+    reader = new BufferedReader(new InputStreamReader(stream));
+    String line;
+    String regex = "\\s+";
+    String filter = "load average:";
+    // read the next line from ps output
+    while ((line = reader.readLine()) != null) {
+      int pos = 0;
+      if ((pos = line.indexOf(filter)) > -1) {
+        String la = line.substring(pos + filter.length()).replaceAll(regex, "");
+        String[] averages = la.split(",");
+        uptimeLoadAverage.setLoadAvg1(averages[0]);
+        uptimeLoadAverage.setLoadAvg5(averages[1]);
+        uptimeLoadAverage.setLoadAvg15(averages[2]);
+      }
+    }
+    proc.waitFor();
+    return uptimeLoadAverage;
+  }
 }

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeMemInfoCollector.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeMemInfoCollector.java?rev=1864247&r1=1864246&r2=1864247&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeMemInfoCollector.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeMemInfoCollector.java Fri Aug  2 17:27:48 2019
@@ -30,130 +30,133 @@ import org.apache.uima.ducc.common.agent
 import org.apache.uima.ducc.common.node.metrics.NodeMemoryInfo;
 import org.apache.uima.ducc.common.utils.Utils;
 
-
 public class NodeMemInfoCollector implements CallableMemoryCollector {
-	private long fakeMemorySize = -1;
-	private String[] targetFields;
-    private int uidMax = 500;   // default. Used to sum up memory of processes owned by uids < uidMax
-	public NodeMemInfoCollector(String[] targetFields) {
-		this.targetFields = targetFields;
-		String tmp;
-		
-		if ((tmp = System
-				.getProperty("ducc.agent.node.metrics.fake.memory.size")) != null) {
-			try {
-				fakeMemorySize = Long.parseLong(tmp);
-			} catch (NumberFormatException e) {
-				e.printStackTrace();
-			}
-		}
-
-		uidMax = Utils.getMaxSystemUserId();
-	}
-
-	public NodeMemory call() throws Exception {
-
-		BufferedReader fileReader = new BufferedReader(new FileReader(
-				"/proc/meminfo"));
-		// the order of fields corresponds to the field label position
-		long memInfoValues[] = new long[targetFields.length];
-		try {
-			String line;
-			// Read each line from meminfo file
-			while ((line = fileReader.readLine()) != null) {
-				// parse line and remove spaces
-				String[] parts = line.trim().split("\\s+");
-
-				// ignore lines that contain fields we dont need. The
-				// targetFields array
-				// contains labels of fields we are interested in. For each line
-				// read
-				// from file try to find a match.
-				for (int i = 0; i < targetFields.length; i++) {
-					if (parts[0].equals(targetFields[i])) {
-						// got a field we need
-						try {
-							memInfoValues[i] = Long.parseLong(parts[1]);
-						} catch (NumberFormatException e) {
-							throw e;
-						}
-						break; // get the next field
-					}
-				}
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-			throw e;
-		} finally {
-			fileReader.close();
-		}
-		long memUsed = 0;
-		// if running ducc in simulation mode skip memory adjustment. Report free memory = fakeMemorySize
-		if ( fakeMemorySize == -1 ) {
-			// sum up memory of all processes owned by UIDs < gidMax 
-			memUsed = collectRSSFromPSCommand();
-			//System.out.println("Total:"+memInfoValues[0] + " Available:"+memInfoValues[1] +" Calculated:"+(memInfoValues[0] - memUsed)+" Priviledged Memory:"+memUsed);
-		}
-		
-		memInfoValues[1] = memInfoValues[0] - memUsed;
-		return new NodeMemoryInfo(memInfoValues, fakeMemorySize);
-	}
-	private long collectRSSFromPSCommand() throws Exception {
-		InputStream stream = null;
-	    BufferedReader reader = null;
-	  
-	      ProcessBuilder pb;
-	      if ( Utils.isMac() ) {
-	        pb = new ProcessBuilder("ps","-Ao","user=,pid=,uid=,rss=");
-	      } else {
-	        pb = new ProcessBuilder("ps","-Ao","user:32,pid,uid,rss", "--no-heading");
-	      }
-	      pb.redirectErrorStream(true);
-	      Process proc = pb.start();
-	      //  spawn ps command and scrape the output
-	      stream = proc.getInputStream();
-	      reader = new BufferedReader(new InputStreamReader(stream));
-	      String line;
-	      String regex = "\\s+";
-	      long memoryUsed = 0;
-	      // read the next line from ps output
-	      while ((line = reader.readLine()) != null) {
-	          String tokens[] = line.split(regex);
-	          if ( tokens.length > 0 ) {
-	        	  try {
-	        		  int uid = Integer.valueOf(tokens[2]);
-	        		  if ( uid < uidMax ) {
-	        			  memoryUsed += Long.valueOf(tokens[3]);
-	        		  }
-	        	  } catch( NumberFormatException nfe) {
-	        		  
-	        	  }
-	          }
-	      }	
-	      stream.close();
-	      return memoryUsed;
-	}
-	public static void main(String[] args) {
-	    String[] meminfoTargetFields = new String[] {"MemTotal:","MemFree:","SwapTotal:","SwapFree:"};
-
-		try {
-			NodeMemInfoCollector nmi = new NodeMemInfoCollector(meminfoTargetFields);
-			ExecutorService pool = Executors.newFixedThreadPool(1);
-			while( true ) {
-				Future<NodeMemory> nmiFuture = pool.submit(nmi);
-				NodeMemory memInfo = nmiFuture.get();
-				System.out.println("... Meminfo Data -"+
-						" Memory Total:"+memInfo.getMemTotal()+
-						" Memory Free:"+memInfo.getMemFree()+
-						" Swap Total:"+memInfo.getSwapTotal()+
-						" Swap Free:"+memInfo.getSwapFree());
-				synchronized(nmi) {
-					nmi.wait(4000);
-				}
-			}
-			
-		} catch( Exception e) {
-			e.printStackTrace();
-		}
-	}
+  private long fakeMemorySize = -1;
+
+  private String[] targetFields;
+
+  private int uidMax = 500; // default. Used to sum up memory of processes owned by uids < uidMax
+
+  public NodeMemInfoCollector(String[] targetFields) {
+    this.targetFields = targetFields;
+    String tmp;
+
+    if ((tmp = System.getProperty("ducc.agent.node.metrics.fake.memory.size")) != null) {
+      try {
+        fakeMemorySize = Long.parseLong(tmp);
+      } catch (NumberFormatException e) {
+        e.printStackTrace();
+      }
+    }
+
+    uidMax = Utils.getMaxSystemUserId();
+  }
+
+  public NodeMemory call() throws Exception {
+
+    BufferedReader fileReader = new BufferedReader(new FileReader("/proc/meminfo"));
+    // the order of fields corresponds to the field label position
+    long memInfoValues[] = new long[targetFields.length];
+    try {
+      String line;
+      // Read each line from meminfo file
+      while ((line = fileReader.readLine()) != null) {
+        // parse line and remove spaces
+        String[] parts = line.trim().split("\\s+");
+
+        // ignore lines that contain fields we dont need. The
+        // targetFields array
+        // contains labels of fields we are interested in. For each line
+        // read
+        // from file try to find a match.
+        for (int i = 0; i < targetFields.length; i++) {
+          if (parts[0].equals(targetFields[i])) {
+            // got a field we need
+            try {
+              memInfoValues[i] = Long.parseLong(parts[1]);
+            } catch (NumberFormatException e) {
+              throw e;
+            }
+            break; // get the next field
+          }
+        }
+      }
+    } catch (Exception e) {
+      e.printStackTrace();
+      throw e;
+    } finally {
+      fileReader.close();
+    }
+    long memUsed = 0;
+    // if running ducc in simulation mode skip memory adjustment. Report free memory =
+    // fakeMemorySize
+    if (fakeMemorySize == -1) {
+      // sum up memory of all processes owned by UIDs < gidMax
+      memUsed = collectRSSFromPSCommand();
+      // System.out.println("Total:"+memInfoValues[0] + " Available:"+memInfoValues[1] +"
+      // Calculated:"+(memInfoValues[0] - memUsed)+" Priviledged Memory:"+memUsed);
+    }
+
+    memInfoValues[1] = memInfoValues[0] - memUsed;
+    return new NodeMemoryInfo(memInfoValues, fakeMemorySize);
+  }
+
+  private long collectRSSFromPSCommand() throws Exception {
+    InputStream stream = null;
+    BufferedReader reader = null;
+
+    ProcessBuilder pb;
+    if (Utils.isMac()) {
+      pb = new ProcessBuilder("ps", "-Ao", "user=,pid=,uid=,rss=");
+    } else {
+      pb = new ProcessBuilder("ps", "-Ao", "user:32,pid,uid,rss", "--no-heading");
+    }
+    pb.redirectErrorStream(true);
+    Process proc = pb.start();
+    // spawn ps command and scrape the output
+    stream = proc.getInputStream();
+    reader = new BufferedReader(new InputStreamReader(stream));
+    String line;
+    String regex = "\\s+";
+    long memoryUsed = 0;
+    // read the next line from ps output
+    while ((line = reader.readLine()) != null) {
+      String tokens[] = line.split(regex);
+      if (tokens.length > 0) {
+        try {
+          int uid = Integer.valueOf(tokens[2]);
+          if (uid < uidMax) {
+            memoryUsed += Long.valueOf(tokens[3]);
+          }
+        } catch (NumberFormatException nfe) {
+
+        }
+      }
+    }
+    stream.close();
+    return memoryUsed;
+  }
+
+  public static void main(String[] args) {
+    String[] meminfoTargetFields = new String[] { "MemTotal:", "MemFree:", "SwapTotal:",
+        "SwapFree:" };
+
+    try {
+      NodeMemInfoCollector nmi = new NodeMemInfoCollector(meminfoTargetFields);
+      ExecutorService pool = Executors.newFixedThreadPool(1);
+      while (true) {
+        Future<NodeMemory> nmiFuture = pool.submit(nmi);
+        NodeMemory memInfo = nmiFuture.get();
+        System.out.println("... Meminfo Data -" + " Memory Total:" + memInfo.getMemTotal()
+                + " Memory Free:" + memInfo.getMemFree() + " Swap Total:" + memInfo.getSwapTotal()
+                + " Swap Free:" + memInfo.getSwapFree());
+        synchronized (nmi) {
+          nmi.wait(4000);
+        }
+      }
+
+    } catch (Exception e) {
+      e.printStackTrace();
+    }
+  }
 }

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeUsersCollector.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeUsersCollector.java?rev=1864247&r1=1864246&r2=1864247&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeUsersCollector.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/NodeUsersCollector.java Fri Aug  2 17:27:48 2019
@@ -39,23 +39,24 @@ import org.apache.uima.ducc.common.utils
 import org.apache.uima.ducc.transport.event.common.IDuccProcess;
 
 /**
- * Spawns "ps -ef --no-heading" cmd and scrapes the output to collect user processes. 
+ * Spawns "ps -ef --no-heading" cmd and scrapes the output to collect user processes.
  * 
  * Detects and filters out Ducc daemon processes and AMQ broker.
  * 
- * Detects rogue processes which are processes that are not associated with any job 
- * and not belonging to a user node reservation. 
+ * Detects rogue processes which are processes that are not associated with any job and not
+ * belonging to a user node reservation.
  * 
  */
 public class NodeUsersCollector implements CallableNodeUsersCollector {
-  
+
   DuccLogger logger;
+
   Agent agent;
-  
-  
-  int uidMax = 500;   // default 
+
+  int uidMax = 500; // default
+
   static String ducc_user = System.getProperty("user.name");
-  
+
   public NodeUsersCollector(Agent agent, DuccLogger logger) {
     this.agent = agent;
     this.logger = logger;
@@ -63,156 +64,170 @@ public class NodeUsersCollector implemen
     // user id < uidMax is not rogue and will be left running.
     uidMax = Utils.getMaxSystemUserId();
   }
+
   /**
-   * Returns true if a given userId belongs to an exclusion list defined in ducc.properties.
-   * This list contains user IDs the Agent should exclude while determining rogue processes.
-   * System owned (root, nfs, etc) processes should not be reported as rogue. 
+   * Returns true if a given userId belongs to an exclusion list defined in ducc.properties. This
+   * list contains user IDs the Agent should exclude while determining rogue processes. System owned
+   * (root, nfs, etc) processes should not be reported as rogue.
    * 
    * @param userId
-   * @return  boolean - true if a given user should be excluded. False otherwise
+   * @return boolean - true if a given user should be excluded. False otherwise
    */
-  public boolean excludeUser(String userId ) {
-    String userFilter =
-            System.getProperty("ducc.agent.rogue.process.user.exclusion.filter");
-    if ( userFilter != null) {
-      //  exclusion list contains comma separated user ids
+  public boolean excludeUser(String userId) {
+    String userFilter = System.getProperty("ducc.agent.rogue.process.user.exclusion.filter");
+    if (userFilter != null) {
+      // exclusion list contains comma separated user ids
       String[] excludedUsers = userFilter.split(",");
-      for ( String excludedUser : excludedUsers ) {
-        if ( excludedUser.equals(userId)) {
+      for (String excludedUser : excludedUsers) {
+        if (excludedUser.equals(userId)) {
           return true;
         }
       }
-      
+
     }
     return false;
   }
+
   /**
-   * Returns true if a given process belongs to an exclusion list defined in ducc.properties.
-   * This list contains process names the Agent should exclude while determining rogue processes.
+   * Returns true if a given process belongs to an exclusion list defined in ducc.properties. This
+   * list contains process names the Agent should exclude while determining rogue processes.
    * 
    * @param process
    * @return boolean - true if a given process should be excluded. False otherwise
    */
-  public boolean excludeProcess(String process ) {
-    String processFilter = 
-            System.getProperty("ducc.agent.rogue.process.exclusion.filter");
-    if ( processFilter != null ) {
-      //  exclusion list contains comma separated user ids
+  public boolean excludeProcess(String process) {
+    String processFilter = System.getProperty("ducc.agent.rogue.process.exclusion.filter");
+    if (processFilter != null) {
+      // exclusion list contains comma separated user ids
       String[] excludedProcesses = processFilter.split(",");
-      for ( String excludedProcess : excludedProcesses ) {
-        if ( excludedProcess.equals(process)) {
+      for (String excludedProcess : excludedProcesses) {
+        if (excludedProcess.equals(process)) {
           return true;
         }
       }
-    } 
+    }
     return false;
   }
 
-  private void aggregate( Set<NodeUsersCollector.ProcessInfo> processList, NodeUsersCollector.ProcessInfo cpi ) {
+  private void aggregate(Set<NodeUsersCollector.ProcessInfo> processList,
+          NodeUsersCollector.ProcessInfo cpi) {
     boolean added = false;
-    
-    for( NodeUsersCollector.ProcessInfo pi: processList ) {
+
+    for (NodeUsersCollector.ProcessInfo pi : processList) {
       // PIDs below are ints so safe to use ==
-      if ( pi.getPid() == cpi.getPPid() ) { // is the current process a child of another Process? 
-          pi.getChildren().add(cpi); // add current process as a child
-         added = true;
-         if ( pi.isRogue() ) { // if parent is rogue, a child is rogue as well
-           cpi.setRogue(true);
-           break;
-         }
-      } else if ( pi.getChildren().size() > 0 ) {
+      if (pi.getPid() == cpi.getPPid()) { // is the current process a child of another Process?
+        pi.getChildren().add(cpi); // add current process as a child
+        added = true;
+        if (pi.isRogue()) { // if parent is rogue, a child is rogue as well
+          cpi.setRogue(true);
+          break;
+        }
+      } else if (pi.getChildren().size() > 0) {
 
-        for(NodeUsersCollector.ProcessInfo childpi : pi.getChildren() ) {
+        for (NodeUsersCollector.ProcessInfo childpi : pi.getChildren()) {
           // is the current process a child of another Process?
-          if ( childpi.getPid() == cpi.getPPid() ) {  
-            added = true;  // dont add the child here as it will cause ConcurrentModificationException
-                           // just mark it for inclusion in a child list below
-            if ( childpi.isRogue() ) { // if parent is rogue, a child is rogue as well
+          if (childpi.getPid() == cpi.getPPid()) {
+            added = true; // dont add the child here as it will cause
+                          // ConcurrentModificationException
+                          // just mark it for inclusion in a child list below
+            if (childpi.isRogue()) { // if parent is rogue, a child is rogue as well
               cpi.setRogue(true);
             }
-            break;  // stop iterating over children
+            break; // stop iterating over children
           }
         }
-      } 
-      if ( added ) {
+      }
+      if (added) {
         pi.getChildren().add(cpi); // add current process as a child
-        if ( logger == null ) {
-          //System.out.println("********* Adding Child Process With PID:"+cpi.getPid()+ " As Child of Process:"+cpi.getPPid());
+        if (logger == null) {
+          // System.out.println("********* Adding Child Process With PID:"+cpi.getPid()+ " As Child
+          // of Process:"+cpi.getPPid());
         } else {
-          logger.info("aggregate", null, "********* Adding Child Process With PID:"+cpi.getPid()+ " As Child of Process:"+cpi.getPPid());
+          logger.info("aggregate", null, "********* Adding Child Process With PID:" + cpi.getPid()
+                  + " As Child of Process:" + cpi.getPPid());
         }
         break;
-     }
+      }
     }
     // not added to the list in the code above
-    if ( !added ) {
+    if (!added) {
       processList.add(cpi);
-      if ( logger == null ) {
-        //System.out.println("********* Adding Process With PID:"+cpi.getPid()+ " NO PARENT");
+      if (logger == null) {
+        // System.out.println("********* Adding Process With PID:"+cpi.getPid()+ " NO PARENT");
       } else {
-        logger.info("aggregate", null, "********* Adding Process With PID:"+cpi.getPid()+ " NO PARENT");
+        logger.info("aggregate", null,
+                "********* Adding Process With PID:" + cpi.getPid() + " NO PARENT");
       }
     }
   }
+
   private boolean isJobOrServiceProcess(String[] tokens) {
-	  String component = "";
-	    for( String token : tokens ) {
-	        if ( token.startsWith("-Dducc.deploy.components")) {
-	          int pos = token.indexOf('=');
-	          if ( pos > -1 ) {
-	            component = token.substring(pos+1);
-	            if ( component.trim().startsWith("uima-as") ||  component.trim().startsWith("service") ||  component.trim().startsWith("job-process")) {
-           		  return true;
-	            }
-	          }
-	        }
-	      }
-	    return false;
+    String component = "";
+    for (String token : tokens) {
+      if (token.startsWith("-Dducc.deploy.components")) {
+        int pos = token.indexOf('=');
+        if (pos > -1) {
+          component = token.substring(pos + 1);
+          if (component.trim().startsWith("uima-as") || component.trim().startsWith("service")
+                  || component.trim().startsWith("job-process")) {
+            return true;
+          }
+        }
+      }
+    }
+    return false;
   }
+
   private boolean ghostJobOrServiceProcess(String pid) {
-	  String component = "";
-      Map<DuccId, IDuccProcess> inventory = agent.getInventoryRef();
-      for( Entry<DuccId, IDuccProcess> entry : inventory.entrySet()) {
-    	  if ( entry.getValue().getPID().equals(pid)) {
-    		  return false;
-    	  }
+    String component = "";
+    Map<DuccId, IDuccProcess> inventory = agent.getInventoryRef();
+    for (Entry<DuccId, IDuccProcess> entry : inventory.entrySet()) {
+      if (entry.getValue().getPID().equals(pid)) {
+        return false;
       }
-  logger.trace("ghostJobOrServiceProcess", null, "********** Process ("+component+") with PID:"+pid+ " is rogue");
+    }
+    logger.trace("ghostJobOrServiceProcess", null,
+            "********** Process (" + component + ") with PID:" + pid + " is rogue");
+
+    return true;
 
-  return true;
-	  
   }
+
   private boolean duccDaemon(String[] tokens) {
     String location = "duccDaemon";
-    for( String token : tokens ) {
-      if ( token.startsWith("-Dducc.deploy.components")) {
+    for (String token : tokens) {
+      if (token.startsWith("-Dducc.deploy.components")) {
         int pos = token.indexOf("=");
-        if ( pos > -1 ) {
-          String component = token.substring(pos+1);
+        if (pos > -1) {
+          String component = token.substring(pos + 1);
           // if a process is uima-as service need to check if this is a rogue process
-          if ( component.trim().startsWith("uima-as")) {
-            break;  // will check if rogue process below
+          if (component.trim().startsWith("uima-as")) {
+            break; // will check if rogue process below
           }
         }
-        if ( logger == null ) {
-         // System.out.println(
-               //   "********** Process with PID:"+tokens[1]+ " Is a Ducc Daemon:"+token+". Skipping....");
+        if (logger == null) {
+          // System.out.println(
+          // "********** Process with PID:"+tokens[1]+ " Is a Ducc Daemon:"+token+". Skipping....");
         } else {
-          logger.trace(location, null, "********** Process with PID:"+tokens[1]+ " Is a Ducc Daemon:"+token+". Skipping....");
+          logger.trace(location, null, "********** Process with PID:" + tokens[1]
+                  + " Is a Ducc Daemon:" + token + ". Skipping....");
         }
         return true;
       } else if (token.startsWith("-Dactivemq.base")) {
-        if ( logger == null ) {
-         // System.out.println(
-           //       "********** Process with PID:"+tokens[1]+ " Is an ActiveMQ Broker:"+token+". Skipping....");
+        if (logger == null) {
+          // System.out.println(
+          // "********** Process with PID:"+tokens[1]+ " Is an ActiveMQ Broker:"+token+".
+          // Skipping....");
         } else {
-          logger.trace(location, null, "********** Process with PID:"+tokens[1]+ " Is an ActiveMQ Broker:"+token+". Skipping....");
+          logger.trace(location, null, "********** Process with PID:" + tokens[1]
+                  + " Is an ActiveMQ Broker:" + token + ". Skipping....");
         }
         return true;
       }
     }
     return false;
   }
+
   /**
    * 
    * @param pid
@@ -220,20 +235,21 @@ public class NodeUsersCollector implemen
    * @return
    */
   private boolean processAncestorIsOwnedByDucc(String ppid, Set<RunningProcess> list) {
-	  for( RunningProcess pi : list ) {
-		  if ( pi.getPid().equals(ppid) ) {
-			  if (  pi.getOwner().equalsIgnoreCase(ducc_user) ) {
-				  return true;
-			  } else {
-				  return processAncestorIsOwnedByDucc(pi.getPpid(), list);
-			  }
-		  } 
-	  }
-	  return false;
+    for (RunningProcess pi : list) {
+      if (pi.getPid().equals(ppid)) {
+        if (pi.getOwner().equalsIgnoreCase(ducc_user)) {
+          return true;
+        } else {
+          return processAncestorIsOwnedByDucc(pi.getPpid(), list);
+        }
+      }
+    }
+    return false;
   }
-  public TreeMap<String,NodeUsersInfo> call() throws Exception {
+
+  public TreeMap<String, NodeUsersInfo> call() throws Exception {
     String location = "call";
-    TreeMap<String,NodeUsersInfo> map = new TreeMap<String,NodeUsersInfo>();
+    TreeMap<String, NodeUsersInfo> map = new TreeMap<String, NodeUsersInfo>();
 
     List<String> currentPids = new ArrayList<String>();
     InputStream stream = null;
@@ -241,239 +257,261 @@ public class NodeUsersCollector implemen
     try {
 
       ProcessBuilder pb;
-      if ( Utils.isMac() ) {
-        pb = new ProcessBuilder("ps","-Ao","user=,pid=,ppid=,uid=,args=");
+      if (Utils.isMac()) {
+        pb = new ProcessBuilder("ps", "-Ao", "user=,pid=,ppid=,uid=,args=");
       } else {
-        pb = new ProcessBuilder("ps","-Ao","user:32,pid,ppid,uid,args", "--no-heading");
+        pb = new ProcessBuilder("ps", "-Ao", "user:32,pid,ppid,uid,args", "--no-heading");
       }
       pb.redirectErrorStream(true);
       Process proc = pb.start();
-      //  spawn ps command and scrape the output
+      // spawn ps command and scrape the output
       stream = proc.getInputStream();
       reader = new BufferedReader(new InputStreamReader(stream));
       String line;
       String regex = "\\s+";
-      if ( agent != null ) {
-         // copy all known reservations reported by the OR
-         agent.copyAllUserReservations(map);
-      }
-      if ( logger == null ) {
-       // System.out.println(
-        //        "********** User Process Map Size After copyAllUserReservations:"+map.size());
+      if (agent != null) {
+        // copy all known reservations reported by the OR
+        agent.copyAllUserReservations(map);
+      }
+      if (logger == null) {
+        // System.out.println(
+        // "********** User Process Map Size After copyAllUserReservations:"+map.size());
       } else {
-        logger.debug(location, null, "********** User Process Map Size After copyAllUserReservations:"+map.size());
+        logger.debug(location, null,
+                "********** User Process Map Size After copyAllUserReservations:" + map.size());
       }
-      if ( agent != null ) {
-          // copy all known rogue processes detected previously
-          agent.getRogueProcessReaper().copyAllUserRogueProcesses(map); 
-      }
-      if ( logger == null ) {
-        //System.out.println(
-         //       "********** User Process Map Size After copyAllUserRougeProcesses:"+map.size());
+      if (agent != null) {
+        // copy all known rogue processes detected previously
+        agent.getRogueProcessReaper().copyAllUserRogueProcesses(map);
+      }
+      if (logger == null) {
+        // System.out.println(
+        // "********** User Process Map Size After copyAllUserRougeProcesses:"+map.size());
       } else {
-        logger.debug(location, null, "********** User Process Map Size After copyAllUserRougeProcesses:"+map.size());
+        logger.debug(location, null,
+                "********** User Process Map Size After copyAllUserRougeProcesses:" + map.size());
       }
-      // Add all running processes to this list. Will use this list to determine if a process has a parent
+      // Add all running processes to this list. Will use this list to determine if a process has a
+      // parent
       // which is a rogue process.
-      Set<NodeUsersCollector.ProcessInfo> processList = 
-              new HashSet<NodeUsersCollector.ProcessInfo>();
-      
-      Set<RunningProcess> tempProcessList = 
-              new HashSet<RunningProcess>();
-  
+      Set<NodeUsersCollector.ProcessInfo> processList = new HashSet<NodeUsersCollector.ProcessInfo>();
+
+      Set<RunningProcess> tempProcessList = new HashSet<RunningProcess>();
+
       // To detect rogues there are two scans through process list:
       // #1 - fills tempProcessList which will be used to check each
-      //     process parent if its own by ducc.
+      // process parent if its own by ducc.
       // #2 - the actual rogue process detection loop
-      
+
       List<String> procList = new ArrayList<String>();
       // read the next line from ps output
       while ((line = reader.readLine()) != null) {
-    	  // save line for subsequent processing in the for..loop below
-    	  procList.add(line);
-          String tokens[] = line.split(regex);
-          if ( tokens.length > 0 ) {
-          	RunningProcess p = 
-                      new RunningProcess(tokens[1],tokens[2],tokens[0]);
-            // add process to a list which is used to look up each process parent
-          	tempProcessList.add(p);
-          }
+        // save line for subsequent processing in the for..loop below
+        procList.add(line);
+        String tokens[] = line.split(regex);
+        if (tokens.length > 0) {
+          RunningProcess p = new RunningProcess(tokens[1], tokens[2], tokens[0]);
+          // add process to a list which is used to look up each process parent
+          tempProcessList.add(p);
+        }
       }
       // the above loop filled tempProcessList, so now detect rogue processes.
-      for( String procInfo : procList) {
+      for (String procInfo : procList) {
         String tokens[] = procInfo.split(regex);
         String user = tokens[0];
         String pid = tokens[1];
         String ppid = tokens[2];
         String uid = tokens[3];
         String cmd = tokens[4];
-        
-        if ( tokens.length > 0 ) {
-        	try {
-        		// by convention processes owned by uid < gidMax are system processes thus not rogue
-        		if ( Integer.valueOf(uid) < uidMax ) {
-        			continue;    
-        		}
-        	} catch( NumberFormatException nfe) {
-        		
-        	}
-        	//	walk up the tree of ancestor processes to check if any is owned by ducc. If so, this
-            //  process is not rogue.
-            if ( processAncestorIsOwnedByDucc(pid, tempProcessList)) {
-            	continue;  // skip as this is not a rogue process
+
+        if (tokens.length > 0) {
+          try {
+            // by convention processes owned by uid < gidMax are system processes thus not rogue
+            if (Integer.valueOf(uid) < uidMax) {
+              continue;
             }
-            boolean ghost = false;
-            boolean jobOrServiceProcess = isJobOrServiceProcess(tokens);
-            if ( jobOrServiceProcess ) {
-            	ghost = ghostJobOrServiceProcess(pid);
-                if (!ghost) {
-                	continue;
-                }
-            } 
+          } catch (NumberFormatException nfe) {
 
-            // any process owned by user who started the agent process is not rogue
-            if ( ducc_user.equalsIgnoreCase(user) && !ghost) {
-            	continue;
+          }
+          // walk up the tree of ancestor processes to check if any is owned by ducc. If so, this
+          // process is not rogue.
+          if (processAncestorIsOwnedByDucc(pid, tempProcessList)) {
+            continue; // skip as this is not a rogue process
+          }
+          boolean ghost = false;
+          boolean jobOrServiceProcess = isJobOrServiceProcess(tokens);
+          if (jobOrServiceProcess) {
+            ghost = ghostJobOrServiceProcess(pid);
+            if (!ghost) {
+              continue;
             }
-        	// Detect and skip all ducc daemons except uima-as service
-//          if ( duccDaemon(tokens)) {
-//            continue;
-//          }
-          if ( logger == null ) {
-            //System.out.print(line);
+          }
+
+          // any process owned by user who started the agent process is not rogue
+          if (ducc_user.equalsIgnoreCase(user) && !ghost) {
+            continue;
+          }
+          // Detect and skip all ducc daemons except uima-as service
+          // if ( duccDaemon(tokens)) {
+          // continue;
+          // }
+          if (logger == null) {
+            // System.out.print(line);
           } else {
             logger.trace(location, null, line);
           }
-          //  Check if current process is owned by a user that should be excluded
-          //  from rogue process detection. A list of excluded users is in ducc.properties
-          //  Dont include root, nfs, and other system owned processes. Also exclude
-          //  processes that are defined in the process exclusion list in ducc.properties 
-          if ( excludeUser(user) || excludeProcess(cmd) || Utils.getPID().equals(pid))  {
-            continue;   // skip this process         
+          // Check if current process is owned by a user that should be excluded
+          // from rogue process detection. A list of excluded users is in ducc.properties
+          // Dont include root, nfs, and other system owned processes. Also exclude
+          // processes that are defined in the process exclusion list in ducc.properties
+          if (excludeUser(user) || excludeProcess(cmd) || Utils.getPID().equals(pid)) {
+            continue; // skip this process
           }
-          if ( agent != null ) {
+          if (agent != null) {
             // check if this process is in any of the cgroups. If so, this process is not rogue
-            //if ( ((NodeAgent)agent).useCgroups && ((NodeAgent)agent).cgroupsManager.isPidInCGroup(pid) ) {
-              //continue; // not rogue, this process is in a cgroup
-            //}
-            NodeUsersInfo nui = null; 
-            //  Check if user record is already in the map. May have been done above in
-            //  copyAllUserReservations().
-            if ( map.containsKey(user)) {
+            // if ( ((NodeAgent)agent).useCgroups &&
+            // ((NodeAgent)agent).cgroupsManager.isPidInCGroup(pid) ) {
+            // continue; // not rogue, this process is in a cgroup
+            // }
+            NodeUsersInfo nui = null;
+            // Check if user record is already in the map. May have been done above in
+            // copyAllUserReservations().
+            if (map.containsKey(user)) {
               nui = map.get(user);
             } else {
               nui = new NodeUsersInfo(user);
               map.put(user, nui);
             }
-            if ( logger == null ) {
-          //    System.out.println(
-           //           "User:"+user+" Reservations:"+nui.getReservations().size()+" Rogue Processes:"+nui.getRogueProcesses().size());
+            if (logger == null) {
+              // System.out.println(
+              // "User:"+user+" Reservations:"+nui.getReservations().size()+" Rogue
+              // Processes:"+nui.getRogueProcesses().size());
             } else {
-              logger.info(location, null, "User:"+user+" Reservations:"+nui.getReservations().size()+" Rogue Processes:"+nui.getRogueProcesses().size());
+              logger.info(location, null,
+                      "User:" + user + " Reservations:" + nui.getReservations().size()
+                              + " Rogue Processes:" + nui.getRogueProcesses().size());
             }
-            // add a process to a list of processes currently running on the node. The list will be used
+            // add a process to a list of processes currently running on the node. The list will be
+            // used
             // to remove stale rogue processes at the end of this method
-           // currentPids.add(tokens[1]);
+            // currentPids.add(tokens[1]);
             currentPids.add(pid);
-            if ( logger == null ) {
+            if (logger == null) {
             } else {
-              logger.trace(location, null,"Current Promuscess (Before Calling aggregate() - PID:"+pid+" PPID:"+ppid+" Process List Size:"+processList.size());
+              logger.trace(location, null, "Current Promuscess (Before Calling aggregate() - PID:"
+                      + pid + " PPID:" + ppid + " Process List Size:" + processList.size());
             }
-            NodeUsersCollector.ProcessInfo pi = 
-                    new NodeUsersCollector.ProcessInfo(Integer.parseInt(pid),Integer.parseInt(ppid));
-            // add the process to the list of processes. If this process has a parent, it will be added as a child. Compose
-            // hierarchy of processes so that we can use it later to determine if any given process has a parent that is rogue
+            NodeUsersCollector.ProcessInfo pi = new NodeUsersCollector.ProcessInfo(
+                    Integer.parseInt(pid), Integer.parseInt(ppid));
+            // add the process to the list of processes. If this process has a parent, it will be
+            // added as a child. Compose
+            // hierarchy of processes so that we can use it later to determine if any given process
+            // has a parent that is rogue
             aggregate(processList, pi);
-            
+
             // fetch user reservations
             List<IDuccId> userReservations = nui.getReservations();
-            //  if user has reservations on the node, any process found is not a rogue process
-            if ( userReservations.size() > 0 ) {
+            // if user has reservations on the node, any process found is not a rogue process
+            if (userReservations.size() > 0) {
               boolean found = false;
-              //  check if this process has previously been marked as rogue
-              for( NodeProcess rogue : nui.getRogueProcesses() ) {
-                if ( rogue.getPid().equals(pid)) {
+              // check if this process has previously been marked as rogue
+              for (NodeProcess rogue : nui.getRogueProcesses()) {
+                if (rogue.getPid().equals(pid)) {
                   found = true;
                   break;
                 }
               }
-              
-              if ( !found && !agent.isManagedProcess(processList, pi)) {
-                // code keeps count of java and non-java processes separately, so pass the type of process (java or not) 
-                // to allow distinct accounting 
+
+              if (!found && !agent.isManagedProcess(processList, pi)) {
+                // code keeps count of java and non-java processes separately, so pass the type of
+                // process (java or not)
+                // to allow distinct accounting
                 nui.addPid(pid, ppid, cmd.endsWith("java"));
               }
-              continue;  // all we know that the user has a reservation and there is a process running. If there
-                         // are reservations, we cant determine which user process is a rogue process
+              continue; // all we know that the user has a reservation and there is a process
+                        // running. If there
+                        // are reservations, we cant determine which user process is a rogue process
             }
-           
-            //  detect if this is a rogue process and add it to the rogue process list. First check if the current process
-            //  has a parent and if so, check if the parent is rogue. Second, if parent is not rogue (or no parent)
-            //  check if the process is in agent's inventory. If its not, we have a rogue process.
-            if ( agent.isRogueProcess(user, processList, pi) ) {
-              if ( nui.getRogueProcesses().size() == 0 || !inRogueList(nui.getRogueProcesses(),pid) ) {
+
+            // detect if this is a rogue process and add it to the rogue process list. First check
+            // if the current process
+            // has a parent and if so, check if the parent is rogue. Second, if parent is not rogue
+            // (or no parent)
+            // check if the process is in agent's inventory. If its not, we have a rogue process.
+            if (agent.isRogueProcess(user, processList, pi)) {
+              if (nui.getRogueProcesses().size() == 0
+                      || !inRogueList(nui.getRogueProcesses(), pid)) {
                 pi.setRogue(true);
-//                agent.getRogueProcessReaper().submitRogueProcessForKill(user, pid, ppid, cmd.endsWith("java"));
+                // agent.getRogueProcessReaper().submitRogueProcessForKill(user, pid, ppid,
+                // cmd.endsWith("java"));
               }
-              agent.getRogueProcessReaper().submitRogueProcessForKill(user, pid, ppid, cmd.endsWith("java"));
+              agent.getRogueProcessReaper().submitRogueProcessForKill(user, pid, ppid,
+                      cmd.endsWith("java"));
             }
           }
         }
       }
-    } 
-    catch (Exception e) {
-      if ( logger == null ) {
+    } catch (Exception e) {
+      if (logger == null) {
         e.printStackTrace();
       } else {
         logger.error(location, null, e);
       }
     } finally {
-    	if ( reader != null ) {
-    		try {
-    			reader.close();
-    		} catch( Exception exx){}
-    	}
+      if (reader != null) {
+        try {
+          reader.close();
+        } catch (Exception exx) {
+        }
+      }
     }
     StringBuffer sb = new StringBuffer();
-    // if no processes found, clear rogue process list and list of processes associated with a reserve
-    if ( currentPids.isEmpty()) {
-      for( Map.Entry<String,NodeUsersInfo> entry : map.entrySet()) {
+    // if no processes found, clear rogue process list and list of processes associated with a
+    // reserve
+    if (currentPids.isEmpty()) {
+      for (Map.Entry<String, NodeUsersInfo> entry : map.entrySet()) {
         entry.getValue().getReserveProcesses().clear();
         entry.getValue().getRogueProcesses().clear();
       }
     }
 
-    for( Map.Entry<String,NodeUsersInfo> entry : map.entrySet()) {
+    for (Map.Entry<String, NodeUsersInfo> entry : map.entrySet()) {
       sb.append(entry.getValue().toString()).append("\n");
     }
-    if ( logger == null ) {
+    if (logger == null) {
       System.out.println(sb.toString());
       System.out.println(
-            "***************************************************************************************");
+              "***************************************************************************************");
     } else {
-    	if ( sb.length() > 0 ) {
-    	      logger.info(location, null, sb.toString());
-    	      logger.info(location, null, "******************************************************************************");
-    	}
+      if (sb.length() > 0) {
+        logger.info(location, null, sb.toString());
+        logger.info(location, null,
+                "******************************************************************************");
+      }
     }
     // remove any rogue processes that are not in the list of current processes just collected
     agent.getRogueProcessReaper().removeDeadRogueProcesses(currentPids);
     return map;
   }
+
   private boolean inRogueList(List<NodeProcess> rogueProcesses, String pid) {
-    for( NodeProcess rogue : rogueProcesses ) {
-      if ( rogue.getPid().equals(pid)) {
+    for (NodeProcess rogue : rogueProcesses) {
+      if (rogue.getPid().equals(pid)) {
         return true;
       }
     }
     return false;
   }
+
   public class ProcessInfo {
     private int pid;
+
     private int ppid;
+
     boolean rogue;
-    Set<NodeUsersCollector.ProcessInfo> childProcesses = 
-            new HashSet<NodeUsersCollector.ProcessInfo>();
+
+    Set<NodeUsersCollector.ProcessInfo> childProcesses = new HashSet<NodeUsersCollector.ProcessInfo>();
+
     ProcessInfo(int pid, int ppid) {
       this.pid = pid;
       this.ppid = ppid;
@@ -500,81 +538,67 @@ public class NodeUsersCollector implemen
     }
 
   }
+
   public class RunningProcess {
-	  String pid;
-	  String ppid;
-	  public RunningProcess(String pid, String ppid, String owner) {
-		  this.pid = pid;
-		  this.ppid = ppid;
-		  this.owner = owner;
-	  }
-	  public String getPid() {
-		return pid;
-	}
-	public String getPpid() {
-		return ppid;
-	}
-	public String getOwner() {
-		return owner;
-	}
-	String owner;
-	  
-  }
-  /*
-  private void dump(Set<NodeUsersCollector.ProcessInfo> processList) {
-     for( NodeUsersCollector.ProcessInfo pi: processList ) {
-       if ( logger == null ) {
-         System.out.println("Process PID:"+pi.getPid()+" PPID:"+pi.getPPid());
-       } else {
-         logger.trace("dump",null,"Process PID:"+pi.getPid()+" PPID:"+pi.getPPid());
-       }
-       if ( pi.getChildren().size() > 0 ) {
-          if ( logger == null ) {
-            System.out.println("\t=>");
-          } else {
-            logger.trace("dump",null,"\t=>");
-          }
-          for(NodeUsersCollector.ProcessInfo childpi : pi.getChildren() ) {
-            if ( logger == null ) {
-              System.out.println("PID:"+childpi.getPid()+" PPID:"+childpi.getPPid()+" | ");
-            } else {
-              logger.trace("dump",null,"PID:"+childpi.getPid()+" PPID:"+childpi.getPPid()+" | ");
-            }
-          }
-          if ( logger == null ) {
-            System.out.println("\n");
+    String pid;
+
+    String ppid;
+
+    public RunningProcess(String pid, String ppid, String owner) {
+      this.pid = pid;
+      this.ppid = ppid;
+      this.owner = owner;
+    }
+
+    public String getPid() {
+      return pid;
+    }
+
+    public String getPpid() {
+      return ppid;
+    }
+
+    public String getOwner() {
+      return owner;
+    }
+
+    String owner;
 
-          } else {
-            logger.trace("dump",null,"\n");
-            
-          }
-        } 
-     }
   }
-  */
+
+  /*
+   * private void dump(Set<NodeUsersCollector.ProcessInfo> processList) { for(
+   * NodeUsersCollector.ProcessInfo pi: processList ) { if ( logger == null ) {
+   * System.out.println("Process PID:"+pi.getPid()+" PPID:"+pi.getPPid()); } else {
+   * logger.trace("dump",null,"Process PID:"+pi.getPid()+" PPID:"+pi.getPPid()); } if (
+   * pi.getChildren().size() > 0 ) { if ( logger == null ) { System.out.println("\t=>"); } else {
+   * logger.trace("dump",null,"\t=>"); } for(NodeUsersCollector.ProcessInfo childpi :
+   * pi.getChildren() ) { if ( logger == null ) {
+   * System.out.println("PID:"+childpi.getPid()+" PPID:"+childpi.getPPid()+" | "); } else {
+   * logger.trace("dump",null,"PID:"+childpi.getPid()+" PPID:"+childpi.getPPid()+" | "); } } if (
+   * logger == null ) { System.out.println("\n");
+   * 
+   * } else { logger.trace("dump",null,"\n");
+   * 
+   * } } } }
+   */
   public static void main(String[] args) {
-/*
-    try {
-      Set<NodeUsersCollector.ProcessInfo> processList = new HashSet<NodeUsersCollector.ProcessInfo>();
-      
-      NodeUsersCollector.ProcessInfo pi1 = new NodeUsersCollector.ProcessInfo(102,100);
-      NodeUsersCollector.ProcessInfo pi2 = new NodeUsersCollector.ProcessInfo(103,110);
-      NodeUsersCollector.ProcessInfo pi11 = new NodeUsersCollector.ProcessInfo(104,102);
-      NodeUsersCollector.ProcessInfo pi12 = new NodeUsersCollector.ProcessInfo(105,102);
-      NodeUsersCollector.ProcessInfo pi3 = new NodeUsersCollector.ProcessInfo(106,111);
-      
-      NodeUsersCollector collector = new NodeUsersCollector(null);
-      collector.aggregate(processList, pi1);
-//      collector.dump(processList);
-      collector.aggregate(processList, pi2);
-      collector.aggregate(processList, pi11);
-      collector.aggregate(processList, pi12);
-      collector.aggregate(processList, pi3);
-      collector.dump(processList);
-      
-    } catch( Exception e) {
-      e.printStackTrace();
-    }
-    */
+    /*
+     * try { Set<NodeUsersCollector.ProcessInfo> processList = new
+     * HashSet<NodeUsersCollector.ProcessInfo>();
+     * 
+     * NodeUsersCollector.ProcessInfo pi1 = new NodeUsersCollector.ProcessInfo(102,100);
+     * NodeUsersCollector.ProcessInfo pi2 = new NodeUsersCollector.ProcessInfo(103,110);
+     * NodeUsersCollector.ProcessInfo pi11 = new NodeUsersCollector.ProcessInfo(104,102);
+     * NodeUsersCollector.ProcessInfo pi12 = new NodeUsersCollector.ProcessInfo(105,102);
+     * NodeUsersCollector.ProcessInfo pi3 = new NodeUsersCollector.ProcessInfo(106,111);
+     * 
+     * NodeUsersCollector collector = new NodeUsersCollector(null); collector.aggregate(processList,
+     * pi1); // collector.dump(processList); collector.aggregate(processList, pi2);
+     * collector.aggregate(processList, pi11); collector.aggregate(processList, pi12);
+     * collector.aggregate(processList, pi3); collector.dump(processList);
+     * 
+     * } catch( Exception e) { e.printStackTrace(); }
+     */
   }
 }

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ProcessCpuUsageCollector.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ProcessCpuUsageCollector.java?rev=1864247&r1=1864246&r2=1864247&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ProcessCpuUsageCollector.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ProcessCpuUsageCollector.java Fri Aug  2 17:27:48 2019
@@ -25,26 +25,26 @@ import org.apache.uima.ducc.common.agent
 import org.apache.uima.ducc.common.agent.metrics.cpu.ProcessCpuUsage;
 import org.apache.uima.ducc.common.utils.DuccLogger;
 
-public class ProcessCpuUsageCollector implements
-		Callable<ProcessCpuUsage> {
-	private String containerId=null;
-	private CGroupsManager cgm=null;
-	
-	public ProcessCpuUsageCollector(DuccLogger logger, CGroupsManager mgr, String jobId ) {
-		this.containerId = jobId;
-		this.cgm = mgr;
-	}
+public class ProcessCpuUsageCollector implements Callable<ProcessCpuUsage> {
+  private String containerId = null;
 
-	public ProcessCpuUsage call() throws Exception {
-		try {
-			return new DuccProcessCpuUsage(collect());
-		} catch (Exception e) {
-			throw e;
-		}
-	}
-	
-	private long collect() throws Exception{
-		// use cgroups manager to collect cpu usage
-		return cgm.getCpuUsage(containerId);
-	}
+  private CGroupsManager cgm = null;
+
+  public ProcessCpuUsageCollector(DuccLogger logger, CGroupsManager mgr, String jobId) {
+    this.containerId = jobId;
+    this.cgm = mgr;
+  }
+
+  public ProcessCpuUsage call() throws Exception {
+    try {
+      return new DuccProcessCpuUsage(collect());
+    } catch (Exception e) {
+      throw e;
+    }
+  }
+
+  private long collect() throws Exception {
+    // use cgroups manager to collect cpu usage
+    return cgm.getCpuUsage(containerId);
+  }
 }

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ProcessMajorFaultCollector.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ProcessMajorFaultCollector.java?rev=1864247&r1=1864246&r2=1864247&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ProcessMajorFaultCollector.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ProcessMajorFaultCollector.java Fri Aug  2 17:27:48 2019
@@ -26,26 +26,27 @@ import org.apache.uima.ducc.common.agent
 import org.apache.uima.ducc.common.agent.metrics.swap.ProcessMemoryPageLoadUsage;
 import org.apache.uima.ducc.common.utils.DuccLogger;
 
-public class ProcessMajorFaultCollector implements
-		Callable<ProcessMemoryPageLoadUsage> {
-	private CGroupsManager cgm=null;
-	private String containerId=null;
-	
-	public ProcessMajorFaultCollector(DuccLogger logger, CGroupsManager mgr, String containerId ) {
-		this.cgm = mgr;
-		this.containerId = containerId;
-	}
+public class ProcessMajorFaultCollector implements Callable<ProcessMemoryPageLoadUsage> {
+  private CGroupsManager cgm = null;
 
-	public ProcessMemoryPageLoadUsage call() throws Exception {
-		try {
-			return new DuccProcessMemoryPageLoadUsage(collect());
-		} catch (Exception e) {
-			e.printStackTrace();
-			throw e;
-		}
-	}
-	private long collect() throws Exception{
-		// use cgroups manager to collect rss usage
-		return cgm.getUsageForMemoryStat(CgroupMemoryStat.FAULTS,containerId);
-	}
+  private String containerId = null;
+
+  public ProcessMajorFaultCollector(DuccLogger logger, CGroupsManager mgr, String containerId) {
+    this.cgm = mgr;
+    this.containerId = containerId;
+  }
+
+  public ProcessMemoryPageLoadUsage call() throws Exception {
+    try {
+      return new DuccProcessMemoryPageLoadUsage(collect());
+    } catch (Exception e) {
+      e.printStackTrace();
+      throw e;
+    }
+  }
+
+  private long collect() throws Exception {
+    // use cgroups manager to collect rss usage
+    return cgm.getUsageForMemoryStat(CgroupMemoryStat.FAULTS, containerId);
+  }
 }

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ProcessResidentMemoryCollector.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ProcessResidentMemoryCollector.java?rev=1864247&r1=1864246&r2=1864247&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ProcessResidentMemoryCollector.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ProcessResidentMemoryCollector.java Fri Aug  2 17:27:48 2019
@@ -26,22 +26,22 @@ import org.apache.uima.ducc.common.agent
 import org.apache.uima.ducc.common.agent.metrics.memory.ProcessResidentMemory;
 import org.apache.uima.ducc.common.utils.DuccLogger;
 
+public class ProcessResidentMemoryCollector implements Callable<ProcessResidentMemory> {
+  private String containerId = null;
 
-public class ProcessResidentMemoryCollector 
-		implements Callable<ProcessResidentMemory> {
-	private String containerId=null;
-	private CGroupsManager cgm=null;
+  private CGroupsManager cgm = null;
 
-	public ProcessResidentMemoryCollector(DuccLogger logger, CGroupsManager mgr, String jobId) {
-		this.containerId = jobId;
-		this.cgm = mgr;
-	}
+  public ProcessResidentMemoryCollector(DuccLogger logger, CGroupsManager mgr, String jobId) {
+    this.containerId = jobId;
+    this.cgm = mgr;
+  }
 
-	public ProcessResidentMemory call() throws Exception {
-		return new DuccProcessResidentMemory(collect());
-	}
-	private long collect() throws Exception{
-		// use cgroups manager to collect rss usage
-		return cgm.getUsageForMemoryStat(CgroupMemoryStat.RSS,containerId);
-	}
+  public ProcessResidentMemory call() throws Exception {
+    return new DuccProcessResidentMemory(collect());
+  }
+
+  private long collect() throws Exception {
+    // use cgroups manager to collect rss usage
+    return cgm.getUsageForMemoryStat(CgroupMemoryStat.RSS, containerId);
+  }
 }

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ProcessSwapUsageCollector.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ProcessSwapUsageCollector.java?rev=1864247&r1=1864246&r2=1864247&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ProcessSwapUsageCollector.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/metrics/collectors/ProcessSwapUsageCollector.java Fri Aug  2 17:27:48 2019
@@ -26,26 +26,27 @@ import org.apache.uima.ducc.common.agent
 import org.apache.uima.ducc.common.agent.metrics.swap.ProcessSwapSpaceUsage;
 import org.apache.uima.ducc.common.utils.DuccLogger;
 
-public class ProcessSwapUsageCollector implements
-		Callable<ProcessSwapSpaceUsage> {
-	private CGroupsManager cgm=null;
-	private String containerId=null;
+public class ProcessSwapUsageCollector implements Callable<ProcessSwapSpaceUsage> {
+  private CGroupsManager cgm = null;
 
-	public ProcessSwapUsageCollector(DuccLogger logger, CGroupsManager mgr, String jobId ) {
-		this.containerId = jobId;
-		this.cgm = mgr;
-	}
+  private String containerId = null;
 
-	public ProcessSwapSpaceUsage call() throws Exception {
-		try {
-			return new DuccProcessSwapSpaceUsage(collect());
-		} catch (Exception e) {
-			e.printStackTrace();
-			throw e;
-		}
-	}
-	private long collect() throws Exception{
-		// use cgroups manager to collect rss usage
-		return cgm.getUsageForMemoryStat(CgroupMemoryStat.SWAP,containerId);
-	}
+  public ProcessSwapUsageCollector(DuccLogger logger, CGroupsManager mgr, String jobId) {
+    this.containerId = jobId;
+    this.cgm = mgr;
+  }
+
+  public ProcessSwapSpaceUsage call() throws Exception {
+    try {
+      return new DuccProcessSwapSpaceUsage(collect());
+    } catch (Exception e) {
+      e.printStackTrace();
+      throw e;
+    }
+  }
+
+  private long collect() throws Exception {
+    // use cgroups manager to collect rss usage
+    return cgm.getUsageForMemoryStat(CgroupMemoryStat.SWAP, containerId);
+  }
 }

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/monitor/AgentMonitor.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/monitor/AgentMonitor.java?rev=1864247&r1=1864246&r2=1864247&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/monitor/AgentMonitor.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/monitor/AgentMonitor.java Fri Aug  2 17:27:48 2019
@@ -26,33 +26,36 @@ import org.apache.uima.ducc.common.ANode
 import org.apache.uima.ducc.common.Node;
 import org.apache.uima.ducc.common.utils.DuccLogger;
 
-
-public class AgentMonitor extends ANodeStability{
-  //private NodeAgent agent;
+public class AgentMonitor extends ANodeStability {
+  // private NodeAgent agent;
   private ProcessReaperTask reaperTask;
+
   DuccLogger logger;
+
   public AgentMonitor(NodeAgent agent, DuccLogger logger, int nodeStability, int agentMetricsRate) {
     super(nodeStability, agentMetricsRate);
-    //this.agent = agent;
+    // this.agent = agent;
     this.logger = logger;
-    reaperTask = new ProcessReaperTask(agent,logger);
+    reaperTask = new ProcessReaperTask(agent, logger);
   }
 
   public void nodeDeath(Map<Node, Node> nodes) {
-    logger.warn("AgentMonitor.nodeDeath", null,"Agent detected a network/borker problem. Proceeding to shutdown JPs");
+    logger.warn("AgentMonitor.nodeDeath", null,
+            "Agent detected a network/borker problem. Proceeding to shutdown JPs");
     Thread t = new Thread(reaperTask);
     t.setDaemon(true);
     t.start();
   }
 
   public void missedNode(Node n, int c) {
-    logger.info("missedNode",null,"Agent missed a ping ("+c+")");
+    logger.info("missedNode", null, "Agent missed a ping (" + c + ")");
   }
 
   public void ping(Node node) {
     super.nodeArrives(node);
   }
-  
-  public void nodeRecovers(Node n) {}
-  
+
+  public void nodeRecovers(Node n) {
+  }
+
 }

Modified: uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/processors/BaseProcessor.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/processors/BaseProcessor.java?rev=1864247&r1=1864246&r2=1864247&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/processors/BaseProcessor.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/processors/BaseProcessor.java Fri Aug  2 17:27:48 2019
@@ -19,7 +19,7 @@
 package org.apache.uima.ducc.agent.processors;
 
 public abstract class BaseProcessor {
-	public void stop() {
-		
-	}
+  public void stop() {
+
+  }
 }