Commit 81c1ef45 authored by Andre Freyssinet's avatar Andre Freyssinet
Browse files

Enhancements in CheckServer handling.

parent 96b8c245
/*
* Copyright (C) 2001 - 2020 ScalAgent Distributed Technologies
* Copyright (C) 2001 - 2021 ScalAgent Distributed Technologies
* Copyright (C) 2004 France Telecom R&D
* Copyright (C) 1996 - 2000 BULL
* Copyright (C) 1996 - 2000 INRIA
......@@ -461,6 +461,12 @@ public final class AgentServer {
checkServerTask.registerListener(listener);
}
public static void unregisterCheckServerListener(CheckServerListener listener) {
if (checkServerTask == null)
logmon.log(BasicLevel.ERROR, getName() + " cannot unregister CheckServerListener.");
checkServerTask.unregisterListener(listener);
}
static ThreadGroup tgroup = null;
public static ThreadGroup getThreadGroup() {
......@@ -1923,13 +1929,19 @@ class CheckServerTask extends TimerTask {
listeners = new Vector<CheckServerListener>();
}
public void registerListener(CheckServerListener listener) {
public synchronized void registerListener(CheckServerListener listener) {
logmon.log(BasicLevel.INFO,
AgentServer.getName() + " registers listener for CheckServer.");
listeners.addElement(listener);
}
private void throwListeners() {
public synchronized void unregisterListener(CheckServerListener listener) {
logmon.log(BasicLevel.INFO,
AgentServer.getName() + " unregisters listener for CheckServer.");
listeners.removeElement(listener);
}
private synchronized void throwListeners() {
for (CheckServerListener listener : listeners) {
logmon.log(BasicLevel.DEBUG,
AgentServer.getName() + " calls listener for CheckServer.");
......@@ -1974,8 +1986,8 @@ class CheckServerTask extends TimerTask {
if (! engine.isRunning()) {
// The engine does not run, just log a warn if needed
if (((now - lastEngineChangeDate) > dtwarn) && ((now - lastEngineWarnDate) > dtwarn)) {
logmon.log(BasicLevel.DEBUG,
AgentServer.getName() + ", engine is not started.");
logmon.log(BasicLevel.WARN,
AgentServer.getName() + ", engine is not running.");
lastEngineWarnDate = now;
}
return false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment