Skip to content

Commit

Permalink
Issue #5081 Changes after review
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Bartel <[email protected]>
  • Loading branch information
janbartel committed Aug 3, 2020
1 parent 6849c54 commit cc68ed7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ public void run()
}
finally
{
if (_scheduler != null && _scheduler.isRunning())
_task = _scheduler.schedule(this, _intervalMs, TimeUnit.MILLISECONDS);
synchronized (HouseKeeper.this)
{
if (_scheduler != null && _scheduler.isRunning())
_task = _scheduler.schedule(this, _intervalMs, TimeUnit.MILLISECONDS);
}
}
}
}
Expand All @@ -76,12 +79,11 @@ public void run()
*/
public void setSessionIdManager(SessionIdManager sessionIdManager)
{
if (isStarted())
throw new IllegalStateException("HouseKeeper started");
_sessionIdManager = sessionIdManager;
}

/**
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
*/
@Override
protected void doStart() throws Exception
{
Expand Down Expand Up @@ -153,13 +155,10 @@ protected void stopScavenging() throws Exception
_scheduler.stop();
_scheduler = null;
}
_runner = null;
}
_runner = null;
}

/**
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStop()
*/
@Override
protected void doStop() throws Exception
{
Expand Down Expand Up @@ -223,7 +222,10 @@ public void setIntervalSec(long sec) throws Exception
@ManagedAttribute(value = "secs between scavenge cycles", readonly = true)
public long getIntervalSec()
{
return _intervalMs / 1000;
synchronized (this)
{
return _intervalMs / 1000;
}
}

/**
Expand Down Expand Up @@ -255,12 +257,12 @@ public void scavenge()
}
}

/**
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{
return super.toString() + "[interval=" + _intervalMs + ", ownscheduler=" + _ownScheduler + "]";
synchronized (this)
{
return super.toString() + "[interval=" + _intervalMs + ", ownscheduler=" + _ownScheduler + "]";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

/**
* HouseKeeperTest
*
*/
public class HouseKeeperTest
{
Expand Down

0 comments on commit cc68ed7

Please sign in to comment.