public ProcessInfo(long pid, SigarProxy sigar) throws SystemInfoException { this.pid = pid; this.sigar = sigar; update(pid); }
public ProcessInfo(long pid, SigarProxy sigar) throws SystemInfoException { this.pid = pid; this.sigar = sigar; update(pid); }
/** * Takes a fresh snapshot of non static properties of the underlying process. This method internally serializes * calls so that it maintains a consistent view of the various Sigar call results. * * @throws SystemInfoException */ public void refresh() throws SystemInfoException { // Serializing is also important as in somes cases, the process could be reported up while being down. // See this thread on VMWare forum: http://communities.vmware.com/message/2187972#2187972 boolean acquiredLock = false; try { acquiredLock = refreshLock.tryLock(REFRESH_LOCK_ACQUIRE_TIMEOUT_SECONDS, TimeUnit.SECONDS); } catch (InterruptedException e) { LOG.error("Thread interrupted while trying to acquire ProcessInfo[" + this.pid + "] refresh lock", e); } if (!acquiredLock) { throw new RuntimeException("Could not acquire ProcessInfo[" + this.pid + "] refresh lock"); } try { // No need to update if the process has already been reported down, Sigar will only throw exceptions... if (priorSnaphot().isRunning()) { update(this.pid); } } finally { refreshLock.unlock(); } }
/** * Takes a fresh snapshot of non static properties of the underlying process. This method internally serializes * calls so that it maintains a consistent view of the various Sigar call results. * * @throws SystemInfoException */ public void refresh() throws SystemInfoException { // Serializing is also important as in somes cases, the process could be reported up while being down. // See this thread on VMWare forum: http://communities.vmware.com/message/2187972#2187972 boolean acquiredLock = false; try { acquiredLock = refreshLock.tryLock(REFRESH_LOCK_ACQUIRE_TIMEOUT_SECONDS, TimeUnit.SECONDS); } catch (InterruptedException e) { LOG.error("Thread interrupted while trying to acquire ProcessInfo[" + this.pid + "] refresh lock", e); } if (!acquiredLock) { throw new RuntimeException("Could not acquire ProcessInfo[" + this.pid + "] refresh lock"); } try { // No need to update if the process has already been reported down, Sigar will only throw exceptions... if (priorSnaphot().isRunning()) { update(this.pid); } } finally { refreshLock.unlock(); } }