Commit f4a39f12 authored by Andre Freyssinet's avatar Andre Freyssinet

Logging enhancement: INFO about start and stop.

parent bc7ce4d9
......@@ -39,12 +39,11 @@ import org.objectweb.util.monolog.api.Logger;
import fr.dyade.aaa.common.Debug;
public class CleanerTask implements Callable<Boolean> {
public static Logger logger = Debug.getLogger(CleanerTask.class.getName());
private ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(2);
private int period = 60; //in seconds
private int timeOut = 3600; //in seconds
private int period = 60; // in seconds
private int timeOut = 3600; // in seconds
private ScheduledFuture<?> callableHandle;
private HashMap<String, RestClientContext> restClientCtxs = Helper.getInstance().getRestClientCtxs();
......@@ -79,8 +78,8 @@ public class CleanerTask implements Callable<Boolean> {
}
public void start() {
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "cleanerTask.start period = " + period);
if (logger.isLoggable(BasicLevel.INFO))
logger.log(BasicLevel.INFO, "cleanerTask.start period = " + period);
if (scheduler != null && scheduler.isTerminated())
scheduler = Executors.newScheduledThreadPool(2);
......@@ -95,14 +94,17 @@ public class CleanerTask implements Callable<Boolean> {
}
public void stop() {
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "cleanerTask.stop");
if (logger.isLoggable(BasicLevel.INFO))
logger.log(BasicLevel.INFO, "cleanerTask.stop");
if (callableHandle != null)
callableHandle.cancel(true);
scheduler.shutdown();
}
public void submitCallTask() {
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "cleanerTask activated");
Boolean res = false;
Future<Boolean> future = scheduler.submit(this);
try {
......@@ -122,6 +124,8 @@ public class CleanerTask implements Callable<Boolean> {
@Override
public Boolean call() throws Exception {
helper.setLastCleanTime();
ArrayList<String> toClose = new ArrayList<String>();
for (RestClientContext restClientCtx : restClientCtxs.values()) {
if (restClientCtx.getIdleTimeout() < 1) {
......
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