Skip to content

Commit

Permalink
feat: add shutdown hook (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
caojiajun committed Dec 19, 2024
1 parent 2460656 commit 9ff36e7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public void run() {
}
}

static {
Runtime.getRuntime().addShutdownHook(new Thread(CamelliaDelayQueueServerStatus::invokeOfflineCallback));
}

private static Status status = Status.ONLINE;
private static long lastUseTime = System.currentTimeMillis();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public enum Status {
;
}

static {
Runtime.getRuntime().addShutdownHook(new Thread(ServerStatus::invokeOfflineCallback));
}

public static Status getStatus() {
return status;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public enum Status {
;
}

static {
Runtime.getRuntime().addShutdownHook(new Thread(ServerStatus::invokeOfflineCallback));
}

public static Status getStatus() {
return status;
}
Expand Down

0 comments on commit 9ff36e7

Please sign in to comment.