Skip to content

Commit

Permalink
Merge pull request #1713 from deadmoose/use_trigger_update
Browse files Browse the repository at this point in the history
When an AbstractNodeMonitorDescriptor doesn't have a result, request it via triggerUpdate()
  • Loading branch information
daniel-beck committed Jul 1, 2015
2 parents 76c1e77 + 4299e83 commit 2557e58
Showing 1 changed file with 6 additions and 7 deletions.
Expand Up @@ -170,12 +170,7 @@ protected Map<Computer,T> monitor() throws InterruptedException {
public T get(Computer c) {
if(record==null || !record.data.containsKey(c)) {
// if we don't have the data, schedule the check now
if(!isInProgress()) {
synchronized(this) {
if(!isInProgress())
new Record().start();
}
}
triggerUpdate();
return null;
}
return record.data.get(c);
Expand Down Expand Up @@ -257,7 +252,11 @@ protected boolean markOffline(Computer c) {
*/
/*package*/ synchronized Thread triggerUpdate() {
if (inProgress != null) {
if (System.currentTimeMillis() > inProgressStarted + getMonitoringTimeOut() + 1000) {
if (!inProgress.isAlive()) {
LOGGER.log(Level.WARNING, "Previous {0} monitoring activity died without cleaning up after itself",
getDisplayName());
inProgress = null;
} else if (System.currentTimeMillis() > inProgressStarted + getMonitoringTimeOut() + 1000) {
// maybe it got stuck?
LOGGER.log(Level.WARNING, "Previous {0} monitoring activity still in progress. Interrupting",
getDisplayName());
Expand Down

0 comments on commit 2557e58

Please sign in to comment.