Session control fixes

This commit is contained in:
crschnick
2024-04-19 10:05:05 +00:00
parent 385068a3de
commit e04c63d36f
2 changed files with 12 additions and 12 deletions

View File

@@ -17,20 +17,20 @@ public interface SingletonSessionStore<T extends SingletonSessionStore.Session>
stopSessionIfNeeded();
}
default void setEnabled(boolean value) {
default void setSessionEnabled(boolean value) {
setCache("sessionEnabled", value);
}
default boolean isRunning() {
default boolean isSessionRunning() {
return getCache("sessionRunning", Boolean.class, false);
}
default boolean isEnabled() {
default boolean isSessionEnabled() {
return getCache("sessionEnabled", Boolean.class, false);
}
default void onSessionUpdate(boolean active) {
setEnabled(active);
setSessionEnabled(active);
setCache("sessionRunning", active);
}
@@ -46,7 +46,7 @@ public interface SingletonSessionStore<T extends SingletonSessionStore.Session>
default void startSessionIfNeeded() throws Exception {
synchronized (this) {
var s = getSession();
setEnabled(true);
setSessionEnabled(true);
if (s != null) {
if (s.isRunning()) {
return;
@@ -66,7 +66,7 @@ public interface SingletonSessionStore<T extends SingletonSessionStore.Session>
default void stopSessionIfNeeded() throws Exception {
synchronized (this) {
var ex = getSession();
setEnabled(false);
setSessionEnabled(false);
if (ex != null) {
ex.stop();
setCache("session", null);