@Override
public AvailabilityType getAvailability() {
try {
// Get a fresh snapshot of the process
ProcessInfoSnapshot processInfoSnapshot = (this.processInfo == null) ? null : this.processInfo
.freshSnapshot();
if (processInfoSnapshot == null || !processInfoSnapshot.isRunning()) {
this.processInfo = getSSHDProcess();
// Safe to get prior snapshot here, we've just recreated the process info instance
processInfoSnapshot = (this.processInfo == null) ? null : this.processInfo.priorSnaphot();
}
return (this.processInfo != null && processInfoSnapshot.isRunning()) ? AvailabilityType.UP
: AvailabilityType.DOWN;
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug("failed to get availability: " + ThrowableUtil.getAllMessages(e));
}