Skip to content

Commit

Permalink
(SIGAR-217) win32.EventLogThread needs to re-open EventLog if it has …
Browse files Browse the repository at this point in the history
…been cleared
  • Loading branch information
dougm committed May 19, 2010
1 parent e43244a commit ef5317a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bindings/java/src/org/hyperic/sigar/win32/EventLogThread.java
Expand Up @@ -158,7 +158,18 @@ public void run() {
// cleaner way to go, but we cannot interrupt
// a native system call.
int lastEvent = log.getNewestRecord();
if (lastEvent < curEvent) {
logger.debug(this.logName + " EventLog has changed, re-opening");
try { log.close(); } catch (Win32Exception e) {}
log.open(this.logName);
curEvent = log.getOldestRecord();
lastEvent = log.getNewestRecord();
}

if (lastEvent > curEvent) {
if (curEvent == -1) {
curEvent = 0; //log was cleared
}
handleEvents(log, curEvent, lastEvent);
}

Expand Down

0 comments on commit ef5317a

Please sign in to comment.