/** * 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(); } }
/** * @deprecated as of 4.6. For similar purpose, call {@link #priorSnaphot()} and then corresponding method * from the returned {@link ProcessInfoSnapshot}. */ @Deprecated public boolean isRunning() throws SystemInfoException { return priorSnaphot().isRunning(); }
if (!processInfo.priorSnaphot().isRunning()) {
} else { ProcessInfo processInfo = context.getNativeProcess(); if (processInfo != null && processInfo.priorSnaphot().isRunning()) { availabilityType = previousAvailabilityType; } else {
private boolean isRediscoveryRequired(ProcessInfo processInfo) { return processInfo == null || !processInfo.freshSnapshot().isRunning(); }
/** * @deprecated as of 4.6. For similar purpose, call {@link #priorSnaphot()} and then corresponding method * from the returned {@link ProcessInfoSnapshot}. */ @Deprecated public boolean isRunning() throws SystemInfoException { return priorSnaphot().isRunning(); }