Search in sources :

Example 6 with UserSessionUpdateTask

use of org.keycloak.models.sessions.infinispan.changes.UserSessionUpdateTask in project keycloak by keycloak.

the class UserSessionAdapter method setNote.

@Override
public void setNote(String name, String value) {
    UserSessionUpdateTask task = new UserSessionUpdateTask() {

        @Override
        public void runUpdate(UserSessionEntity entity) {
            if (value == null) {
                if (entity.getNotes().containsKey(name)) {
                    removeNote(name);
                }
                return;
            }
            entity.getNotes().put(name, value);
        }
    };
    update(task);
}
Also used : UserSessionUpdateTask(org.keycloak.models.sessions.infinispan.changes.UserSessionUpdateTask) UserSessionEntity(org.keycloak.models.sessions.infinispan.entities.UserSessionEntity)

Aggregations

UserSessionUpdateTask (org.keycloak.models.sessions.infinispan.changes.UserSessionUpdateTask)6 UserSessionEntity (org.keycloak.models.sessions.infinispan.entities.UserSessionEntity)6 UUID (java.util.UUID)1 SessionEntityWrapper (org.keycloak.models.sessions.infinispan.changes.SessionEntityWrapper)1 CrossDCLastSessionRefreshChecker (org.keycloak.models.sessions.infinispan.changes.sessions.CrossDCLastSessionRefreshChecker)1