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
public SessionData load(String id) throws Exception
{
if (!isStarted())
throw new IllegalStateException ("Not started");
final AtomicReference<SessionData> reference = new AtomicReference<SessionData>();
final AtomicReference<Exception> exception = new AtomicReference<Exception>();
@ -109,6 +112,9 @@ public abstract class AbstractSessionDataStore extends ContainerLifeCycle implem
@Override
public void store(String id, SessionData data) throws Exception
{
if (!isStarted())
throw new IllegalStateException("Not started");
if (data == null)
return;
@ -154,6 +160,9 @@ public abstract class AbstractSessionDataStore extends ContainerLifeCycle implem
@Override
public Set<String> getExpired(Set<String> candidates)
{
if (!isStarted())
throw new IllegalStateException ("Not started");
try
{
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
public Set<SessionHandler> getSessionHandlers()
@ -484,7 +484,8 @@ public class DefaultSessionIdManager extends ContainerLifeCycle implements Sessi
{
for (Handler h : tmp)
{
handlers.add((SessionHandler)h);
if (h.isStarted())
handlers.add((SessionHandler)h);
}
}
return handlers;