Skip to content

Commit

Permalink
added timer stop on undeploy, removed logs
Browse files Browse the repository at this point in the history
  • Loading branch information
anatolysatanovskiy-mobius committed Sep 26, 2017
1 parent 74b97d8 commit 101d281
Showing 1 changed file with 14 additions and 6 deletions.
Expand Up @@ -35,14 +35,15 @@
public class StatisticsResourceAdaptor implements ResourceAdaptor
{
private static final String TIMER_INTERVAL_IN_SECONDS = "org.restcomm.slee.resource.statistics.TIMER_INTERVAL_IN_SECONDS";

private transient Tracer tracer;

private ResourceAdaptorContext raContext;
private SleeContainer sleeContainer;
private ResourceManagement resourceManagement;

private Integer timerInterval;
private StatisticsTimerTask timerTask;

public StatisticsResourceAdaptor()
{
Expand Down Expand Up @@ -75,10 +76,11 @@ public void setResourceAdaptorContext(ResourceAdaptorContext raContext)

public void raConfigure(ConfigProperties properties)
{
if (tracer.isFineEnabled()) {
tracer.fine("Configuring RA.");
}

if (tracer.isFineEnabled())
{
tracer.fine("Configuring RA.");
}

this.timerInterval = (Integer) properties.getProperty(TIMER_INTERVAL_IN_SECONDS).getValue();
}

Expand Down Expand Up @@ -119,7 +121,8 @@ public void raActive()

if (resourceManagement != null)
{
raContext.getTimer().schedule(new StatisticsTimerTask(resourceManagement, tracer, statsReporter, countersFacility), 0, TimeUnit.MILLISECONDS.convert(timerInterval, TimeUnit.SECONDS));
timerTask = new StatisticsTimerTask(resourceManagement, tracer, statsReporter, countersFacility);
raContext.getTimer().schedule(timerTask, 0, TimeUnit.MILLISECONDS.convert(timerInterval, TimeUnit.SECONDS));
}
}

Expand All @@ -136,6 +139,11 @@ public void raInactive()
public void raUnconfigure()
{
this.timerInterval = null;
if (this.timerTask != null)
{
this.timerTask.cancel();
this.timerTask = null;
}
}

public void unsetResourceAdaptorContext()
Expand Down

0 comments on commit 101d281

Please sign in to comment.