[FindBugs] Ensure proper lazy-initialization even if this costs some performance
This commit is contained in:
parent
cecb8d6d04
commit
c19a14a4a2
|
@ -227,10 +227,10 @@ public abstract class AbstractSessionManager extends ContainerLifeCycle implemen
|
||||||
_context=ContextHandler.getCurrentContext();
|
_context=ContextHandler.getCurrentContext();
|
||||||
_loader=Thread.currentThread().getContextClassLoader();
|
_loader=Thread.currentThread().getContextClassLoader();
|
||||||
|
|
||||||
if (_sessionIdManager==null)
|
|
||||||
{
|
|
||||||
final Server server=getSessionHandler().getServer();
|
final Server server=getSessionHandler().getServer();
|
||||||
synchronized (server)
|
synchronized (server)
|
||||||
|
{
|
||||||
|
if (_sessionIdManager==null)
|
||||||
{
|
{
|
||||||
_sessionIdManager=server.getSessionIdManager();
|
_sessionIdManager=server.getSessionIdManager();
|
||||||
if (_sessionIdManager==null)
|
if (_sessionIdManager==null)
|
||||||
|
|
|
@ -307,9 +307,9 @@ public class HashSessionManager extends AbstractSessionManager
|
||||||
|
|
||||||
_scavengePeriodMs=period;
|
_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)
|
if (_task!=null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -778,10 +778,10 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("Scavenging every "+_scavengeIntervalMs+" ms");
|
LOG.debug("Scavenging every "+_scavengeIntervalMs+" ms");
|
||||||
|
|
||||||
|
synchronized (this)
|
||||||
|
{
|
||||||
//if (_timer!=null && (period!=old_period || _task==null))
|
//if (_timer!=null && (period!=old_period || _task==null))
|
||||||
if (_scheduler != null && (period!=old_period || _task==null))
|
if (_scheduler != null && (period!=old_period || _task==null))
|
||||||
{
|
|
||||||
synchronized (this)
|
|
||||||
{
|
{
|
||||||
if (_task!=null)
|
if (_task!=null)
|
||||||
_task.cancel();
|
_task.cancel();
|
||||||
|
|
Loading…
Reference in New Issue