Avoid breaking change in UserSessionModel (#24134)

closes #24096


Co-authored-by: Michal Hajas <mhajas@redhat.com>
This commit is contained in:
Marek Posolda 2023-10-20 18:06:07 +02:00 committed by GitHub
parent d4a5391013
commit 829b7090fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View file

@ -205,8 +205,8 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {
AuthenticatedClientSessionAdapter adapter = new AuthenticatedClientSessionAdapter(session, this, entity, client, userSession, clientSessionUpdateTx, false); AuthenticatedClientSessionAdapter adapter = new AuthenticatedClientSessionAdapter(session, this, entity, client, userSession, clientSessionUpdateTx, false);
// For now, the clientSession is considered transient in case that userSession was transient // For now, the clientSession is considered transient in case that userSession was transient
UserSessionModel.SessionPersistenceState persistenceState = (userSession instanceof UserSessionAdapter && ((UserSessionAdapter) userSession).getPersistenceState() != null) ? UserSessionModel.SessionPersistenceState persistenceState = userSession.getPersistenceState() != null ?
((UserSessionAdapter) userSession).getPersistenceState() : UserSessionModel.SessionPersistenceState.PERSISTENT; userSession.getPersistenceState() : UserSessionModel.SessionPersistenceState.PERSISTENT;
SessionUpdateTask<AuthenticatedClientSessionEntity> createClientSessionTask = Tasks.addIfAbsentSync(); SessionUpdateTask<AuthenticatedClientSessionEntity> createClientSessionTask = Tasks.addIfAbsentSync();
clientSessionUpdateTx.addTask(clientSessionId, createClientSessionTask, entity, persistenceState); clientSessionUpdateTx.addTask(clientSessionId, createClientSessionTask, entity, persistenceState);

View file

@ -232,11 +232,6 @@ public class PersistentUserSessionAdapter implements OfflineUserSessionModel {
return State.valueOf(state); return State.valueOf(state);
} }
@Override
public SessionPersistenceState getPersistenceState() {
return SessionPersistenceState.PERSISTENT;
}
@Override @Override
public void setState(State state) { public void setState(State state) {
String stateStr = state==null ? null : state.toString(); String stateStr = state==null ? null : state.toString();

View file

@ -135,7 +135,12 @@ public interface UserSessionModel {
} }
} }
SessionPersistenceState getPersistenceState(); /**
* @return Persistence state of the session
*/
default SessionPersistenceState getPersistenceState() {
return SessionPersistenceState.PERSISTENT;
}
/** /**
* Flag used when creating user session * Flag used when creating user session