Issue #4027 Ensure AbstractSessionDataStore started or throws exception. (#4028)

* Issue #4027 Ensure AbstractSessionDataStore started or throws exception.

Signed-off-by: Jan Bartel <janb@webtide.com>
This commit is contained in:
Jan Bartel 2019-08-28 11:08:42 +10:00 committed by GitHub
parent a2fc9b113b
commit 37712d75a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -80,6 +80,9 @@ public abstract class AbstractSessionDataStore extends ContainerLifeCycle implem
@Override @Override
public SessionData load(String id) throws Exception public SessionData load(String id) throws Exception
{ {
if (!isStarted())
throw new IllegalStateException ("Not started");
final AtomicReference<SessionData> reference = new AtomicReference<SessionData>(); final AtomicReference<SessionData> reference = new AtomicReference<SessionData>();
final AtomicReference<Exception> exception = new AtomicReference<Exception>(); final AtomicReference<Exception> exception = new AtomicReference<Exception>();
@ -109,6 +112,9 @@ public abstract class AbstractSessionDataStore extends ContainerLifeCycle implem
@Override @Override
public void store(String id, SessionData data) throws Exception public void store(String id, SessionData data) throws Exception
{ {
if (!isStarted())
throw new IllegalStateException("Not started");
if (data == null) if (data == null)
return; return;
@ -154,6 +160,9 @@ public abstract class AbstractSessionDataStore extends ContainerLifeCycle implem
@Override @Override
public Set<String> getExpired(Set<String> candidates) public Set<String> getExpired(Set<String> candidates)
{ {
if (!isStarted())
throw new IllegalStateException ("Not started");
try try
{ {
return doGetExpired(candidates); return doGetExpired(candidates);

View File

@ -471,9 +471,9 @@ public class DefaultSessionIdManager extends ContainerLifeCycle implements Sessi
} }
/** /**
* Get SessionManager for every context. * Get SessionHandler for every context.
* *
* @return all session managers * @return all SessionHandlers that are running
*/ */
@Override @Override
public Set<SessionHandler> getSessionHandlers() public Set<SessionHandler> getSessionHandlers()
@ -484,6 +484,7 @@ public class DefaultSessionIdManager extends ContainerLifeCycle implements Sessi
{ {
for (Handler h : tmp) for (Handler h : tmp)
{ {
if (h.isStarted())
handlers.add((SessionHandler)h); handlers.add((SessionHandler)h);
} }
} }