[FindBugs] Ensure proper lazy-initialization even if this costs some performance

This commit is contained in:
Greg Wilkins 2014-07-17 08:35:40 +10:00
parent cecb8d6d04
commit c19a14a4a2
3 changed files with 8 additions and 8 deletions

View File

@ -227,10 +227,10 @@ public abstract class AbstractSessionManager extends ContainerLifeCycle implemen
_context=ContextHandler.getCurrentContext();
_loader=Thread.currentThread().getContextClassLoader();
if (_sessionIdManager==null)
final Server server=getSessionHandler().getServer();
synchronized (server)
{
final Server server=getSessionHandler().getServer();
synchronized (server)
if (_sessionIdManager==null)
{
_sessionIdManager=server.getSessionIdManager();
if (_sessionIdManager==null)

View File

@ -307,9 +307,9 @@ public class HashSessionManager extends AbstractSessionManager
_scavengePeriodMs=period;
if (_timer!=null && (period!=old_period || _task==null))
synchronized (this)
{
synchronized (this)
if (_timer!=null && (period!=old_period || _task==null))
{
if (_task!=null)
{

View File

@ -778,10 +778,10 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
if (LOG.isDebugEnabled())
LOG.debug("Scavenging every "+_scavengeIntervalMs+" ms");
//if (_timer!=null && (period!=old_period || _task==null))
if (_scheduler != null && (period!=old_period || _task==null))
synchronized (this)
{
synchronized (this)
//if (_timer!=null && (period!=old_period || _task==null))
if (_scheduler != null && (period!=old_period || _task==null))
{
if (_task!=null)
_task.cancel();