private void handleDeleted(RedisSession session) { publishEvent(new SessionDeletedEvent(this, session)); }
@Override public void entryRemoved(EntryEvent<String, MapSession> event) { MapSession session = event.getOldValue(); if (session != null) { if (logger.isDebugEnabled()) { logger.debug("Session deleted with id: " + session.getId()); } this.eventPublisher.publishEvent(new SessionDeletedEvent(this, session)); } }
if (session.load()) { session.clearPrincipal(); publishEvent(new SessionDeletedEvent(this, session)); } else { publishEvent(new SessionDeletedEvent(this, id));
if (session.load()) { session.clearPrincipal(); publishEvent(new SessionDeletedEvent(this, session)); } else { publishEvent(new SessionDeletedEvent(this, id));
@Before public void setup() { String sessionId = "session-id"; MapSession session = new MapSession(sessionId); this.attributes = new HashMap<>(); SessionRepositoryMessageInterceptor.setSessionId(this.attributes, sessionId); given(this.wsSession.getAttributes()).willReturn(this.attributes); given(this.wsSession.getPrincipal()).willReturn(this.principal); given(this.wsSession.getId()).willReturn("wsSession-id"); given(this.wsSession2.getAttributes()).willReturn(this.attributes); given(this.wsSession2.getPrincipal()).willReturn(this.principal); given(this.wsSession2.getId()).willReturn("wsSession-id2"); Map<String, Object> headers = new HashMap<>(); headers.put(SimpMessageHeaderAccessor.SESSION_ATTRIBUTES, this.attributes); given(this.message.getHeaders()).willReturn(new MessageHeaders(headers)); this.listener = new WebSocketRegistryListener(); this.connect = new SessionConnectEvent(this.listener, this.wsSession); this.connect2 = new SessionConnectEvent(this.listener, this.wsSession2); this.disconnect = new SessionDisconnectEvent(this.listener, this.message, this.wsSession.getId(), CloseStatus.NORMAL); this.deleted = new SessionDeletedEvent(this.listener, session); this.expired = new SessionExpiredEvent(this.listener, session); }
protected void emitSessionDeletedEvent(String sessionId) { logger.debugf("Emitting session deleted %s", sessionId); springEventsPublisher.ifPresent(p -> p.publishEvent(new SessionDeletedEvent(eventSource, sessionId))); }
/** * Constructs a new {@link SessionDeletedEvent} initialized with the given {@link Session}, * using the {@link #getSessionRepository() SessionRepository} as the event source. * * @param session {@link Session} that is the subject of the {@link AbstractSessionEvent event}. * @return a new {@link SessionDeletedEvent}. * @see org.springframework.session.events.SessionDeletedEvent * @see org.springframework.session.Session * @see #getSessionRepository() */ protected SessionDeletedEvent newSessionDeletedEvent(Session session) { return new SessionDeletedEvent(getSessionRepository(), session); }
@Override public void entryRemoved(EntryEvent<String, MapSession> event) { MapSession session = event.getOldValue(); if (session != null) { if (logger.isDebugEnabled()) { logger.debug("Session deleted with id: " + session.getId()); } this.eventPublisher.publishEvent(new SessionDeletedEvent(this, session)); } }
@Override public void deleteById(String id) { Optional.ofNullable(findSession(id)) .ifPresent(document -> { publishEvent(new SessionDeletedEvent(this, convertToSession(this.mongoSessionConverter, document))); this.mongoOperations.remove(document, this.collectionName); }); }
/** * Deletes the {@link MongoSession} with the given {@link MongoSession#getId()} or does nothing * if the {@link MongoSession} is not found. * * @param id the {@link MongoSession#getId()} to delete */ @Override public Mono<Void> deleteById(String id) { return findSession(id) .flatMap(document -> this.mongoOperations.remove(document, this.collectionName).then(Mono.just(document))) .map(document -> convertToSession(this.mongoSessionConverter, document)) .map(mongoSession -> Mono.fromRunnable(() -> publishEvent(new SessionDeletedEvent(this, mongoSession)))) .then(); }
session.clearPrincipal(); publishEvent(new SessionDeletedEvent(this, session)); } else if (expiredTopic.getPatternNames().contains(pattern.toString())) { if (!body.startsWith(keyPrefix)) {