当前位置: 首页>>代码示例>>Java>>正文


Java SessionDeletedEvent类代码示例

本文整理汇总了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));
		}
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh-webui-api,代码行数:18,代码来源:FixedMapSessionRepository.java

示例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();
}
 
开发者ID:spring-projects,项目名称:spring-session,代码行数:20,代码来源:EnableHazelcastHttpSessionEventsTests.java

示例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++;
    }
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:13,代码来源:SessionEventsListener.java

示例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()));
}
 
开发者ID:kazuhira-r,项目名称:spring-session-infinispan,代码行数:8,代码来源:EmbeddedSessionEntryListener.java

示例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()));
}
 
开发者ID:kazuhira-r,项目名称:spring-session-infinispan,代码行数:8,代码来源:RemoteSessionEntryListener.java

示例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);
}
 
开发者ID:spring-projects,项目名称:spring-session,代码行数:29,代码来源:WebSocketRegistryListenerTests.java

示例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()));
}
 
开发者ID:spring-projects,项目名称:spring-session,代码行数:9,代码来源:HazelcastSessionRepository.java

示例12: onSessionDeleted

import org.springframework.session.events.SessionDeletedEvent; //导入依赖的package包/类
@EventListener
public void onSessionDeleted(SessionDeletedEvent deletedEvent) {
    sessionDeleted = true;
}
 
开发者ID:mkopylec,项目名称:session-couchbase-spring-boot-starter,代码行数:5,代码来源:SessionEventConsumer.java

示例13: handleDeleted

import org.springframework.session.events.SessionDeletedEvent; //导入依赖的package包/类
private void handleDeleted(RedisSession session) {
	publishEvent(new SessionDeletedEvent(this, session));
}
 
开发者ID:spring-projects,项目名称:spring-session,代码行数:4,代码来源:RedisOperationsSessionRepository.java


注:本文中的org.springframework.session.events.SessionDeletedEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。