We use a thread to monitor our application. This thread runs every x seconds (x can be configured). Another parameter is the query specified. This query remains the same during thread execution. However, we sometimes experience problems with this thread: it claims it can find no processes matching the query, althought the process is still running fine.
This is a simplified version of the code giving the problem:
private Sigar sigarImpl = null;
private SigarProxy proxy = null;
public MonitorThread()
{
this.sigarImpl = new Sigar();
this.proxy = SigarProxyCache.newInstance(this.sigarImpl, 1000);
}
private void monitor(String query)
{
logger.info("performing following query: " + query);
long[] processIds = ProcessFinder.find(proxy, query);
if (processIds.length == 0)
{
errorMessage = "No processes found matching query " + query);
}
}
Any help would be great !