Commit 6123d048 authored by afreyssin's avatar afreyssin
Browse files

Cleans code setting the period of cleaning task.

parent 9c6c2294
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2016 ScalAgent Distributed Technologies
* Copyright (C) 2016 - 2017 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -80,14 +80,23 @@ public class Activator implements BundleActivator {
HttpContext httpContext = null;
// register the servlet
httpService.registerServlet(servletAlias, new ServletContainer(), jerseyServletParams, httpContext);
String period = bundleContext.getProperty(Helper.BUNDLE_CLEANER_PERIOD_PROP);
if (period != null && !period.isEmpty()) {
int period = Helper.DFLT_CLEANER_PERIOD;
String value = bundleContext.getProperty(Helper.BUNDLE_CLEANER_PERIOD_PROP);
if (value != null && !value.isEmpty()) {
try {
period = Integer.parseInt(value);
} catch (NumberFormatException exc) {
if (logger.isLoggable(BasicLevel.WARN))
logger.log(BasicLevel.WARN,
"Bad configuration property " + Helper.BUNDLE_CLEANER_PERIOD_PROP + ", should be a number: " + value, exc);
}
}
if (period > 0) {
cleanerTask = new CleanerTask();
cleanerTask.setPeriod(Integer.parseInt(period));
cleanerTask.setPeriod(period);
cleanerTask.start();
}
} finally {
Thread.currentThread().setContextClassLoader(originalContextClassLoader);
}
......
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