本文整理汇总了Java中org.springframework.session.events.SessionDeletedEvent类的典型用法代码示例。如果您正苦于以下问题:Java SessionDeletedEvent类的具体用法?Java SessionDeletedEvent怎么用?Java SessionDeletedEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SessionDeletedEvent类属于org.springframework.session.events包,在下文中一共展示了SessionDeletedEvent类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deletedSessionTest
import org.springframework.session.events.SessionDeletedEvent; //导入依赖的package包/类
@Test
public void deletedSessionTest() throws InterruptedException {
S sessionToSave = repository.createSession();
repository.save(sessionToSave);
assertThat(registry.receivedEvent(sessionToSave.getId())).isTrue();
assertThat((EventObject) registry.getEvent(sessionToSave.getId()))
.isInstanceOf(SessionCreatedEvent.class);
registry.clear();
repository.delete(sessionToSave.getId());
assertThat(registry.receivedEvent(sessionToSave.getId())).isTrue();
assertThat((EventObject) registry.getEvent(sessionToSave.getId()))
.isInstanceOf(SessionDeletedEvent.class);
assertThat(repository.getSession(sessionToSave.getId())).isNull();
}
开发者ID:kazuhira-r,项目名称:spring-session-infinispan,代码行数:21,代码来源:AbstractEnableInfinispanHttpSessionEventsITests.java
示例2: deleteAndFireEvent
import org.springframework.session.events.SessionDeletedEvent; //导入依赖的package包/类
private void deleteAndFireEvent(final String id, boolean expired)
{
final ExpiringSession deletedSession = sessions.remove(id);
// Fire event
if (deletedSession != null)
{
if (expired)
{
applicationEventPublisher.publishEvent(new SessionExpiredEvent(this, id));
}
else
{
applicationEventPublisher.publishEvent(new SessionDeletedEvent(this, id));
}
}
}
示例3: deletedSessionTest
import org.springframework.session.events.SessionDeletedEvent; //导入依赖的package包/类
@Test
public void deletedSessionTest() throws InterruptedException {
S sessionToSave = this.repository.createSession();
this.repository.save(sessionToSave);
assertThat(this.registry.receivedEvent(sessionToSave.getId())).isTrue();
assertThat(this.registry.<SessionCreatedEvent>getEvent(sessionToSave.getId()))
.isInstanceOf(SessionCreatedEvent.class);
this.registry.clear();
this.repository.deleteById(sessionToSave.getId());
assertThat(this.registry.receivedEvent(sessionToSave.getId())).isTrue();
assertThat(this.registry.<SessionDeletedEvent>getEvent(sessionToSave.getId()))
.isInstanceOf(SessionDeletedEvent.class);
assertThat(this.repository.findById(sessionToSave.getId())).isNull();
}
示例4: onApplicationEvent
import org.springframework.session.events.SessionDeletedEvent; //导入依赖的package包/类
@Override
public void onApplicationEvent(AbstractSessionEvent event) {
if (event instanceof SessionCreatedEvent) {
sessionCreatedEvents++;
}
if (event instanceof SessionDeletedEvent) {
sessionDeletedEvents++;
}
if (event instanceof SessionExpiredEvent) {
sessionExpiredEvents++;
}
}
示例5: deleteById
import org.springframework.session.events.SessionDeletedEvent; //导入依赖的package包/类
/**
* 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();
}
开发者ID:spring-projects,项目名称:spring-session-data-mongodb,代码行数:16,代码来源:ReactiveMongoOperationsSessionRepository.java
示例6: deleteById
import org.springframework.session.events.SessionDeletedEvent; //导入依赖的package包/类
@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);
});
}
开发者ID:spring-projects,项目名称:spring-session-data-mongodb,代码行数:9,代码来源:MongoOperationsSessionRepository.java
示例7: entryRemoved
import org.springframework.session.events.SessionDeletedEvent; //导入依赖的package包/类
@CacheEntryRemoved
public void entryRemoved(CacheEntryRemovedEvent<String, ExpiringSession> event) {
if (logger.isDebugEnabled()) {
logger.debug("Session expired with id: " + event.getOldValue().getId());
}
eventPublisher.publishEvent(new SessionDeletedEvent(this, event.getOldValue()));
}
示例8: entryRemoved
import org.springframework.session.events.SessionDeletedEvent; //导入依赖的package包/类
@ClientCacheEntryRemoved
public void entryRemoved(ClientCacheEntryRemovedEvent<String> event) {
if (logger.isDebugEnabled()) {
logger.debug("Session expired with id: " + event.getKey());
}
eventPublisher.publishEvent(new SessionDeletedEvent(this, event.getKey()));
}
示例9: delete
import org.springframework.session.events.SessionDeletedEvent; //导入依赖的package包/类
@Override
public void delete(String id) {
CouchbaseSession session = getSession(id);
if (session == null) {
return;
}
deleteSession(session);
eventPublisher.publishEvent(new SessionDeletedEvent(this, session));
}
开发者ID:mkopylec,项目名称:session-couchbase-spring-boot-starter,代码行数:10,代码来源:CouchbaseSessionRepository.java
示例10: setup
import org.springframework.session.events.SessionDeletedEvent; //导入依赖的package包/类
@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);
}
示例11: entryRemoved
import org.springframework.session.events.SessionDeletedEvent; //导入依赖的package包/类
@Override
public void entryRemoved(EntryEvent<String, MapSession> event) {
if (logger.isDebugEnabled()) {
logger.debug("Session deleted with id: " + event.getOldValue().getId());
}
this.eventPublisher
.publishEvent(new SessionDeletedEvent(this, event.getOldValue()));
}
示例12: onSessionDeleted
import org.springframework.session.events.SessionDeletedEvent; //导入依赖的package包/类
@EventListener
public void onSessionDeleted(SessionDeletedEvent deletedEvent) {
sessionDeleted = true;
}
示例13: handleDeleted
import org.springframework.session.events.SessionDeletedEvent; //导入依赖的package包/类
private void handleDeleted(RedisSession session) {
publishEvent(new SessionDeletedEvent(this, session));
}