conversationContext.invalidate(); conversationContext.deactivate(); conversationContext.dissociate(boundRequests.get());
conversationContext.invalidate(); conversationContext.deactivate(); conversationContext.dissociate(boundRequests.get());
void stopConversationScope() { RequestContextHolder rcHolder = requestContexts.get(); if (rcHolder == null) { startRequestScope(); rcHolder = requestContexts.get(); } if (conversationContext.isActive()) { conversationContext.invalidate(); conversationContext.deactivate(); conversationContext.dissociate(new MutableBoundRequest(rcHolder.getRequestMap(), sessionMaps.get())); } }
void stopConversationScope() { RequestContextHolder rcHolder = requestContexts.get(); if (rcHolder == null) { startRequestScope(); rcHolder = requestContexts.get(); } if (conversationContext.isActive()) { conversationContext.invalidate(); conversationContext.deactivate(); conversationContext.dissociate(new MutableBoundRequest(rcHolder.getRequestMap(), sessionMaps.get())); } }
void stopConversationScope() { if (conversationContext.isActive()) { conversationContext.invalidate(); conversationContext.deactivate(); conversationContext.dissociate(new MutableBoundRequest(requestMap,sessionMap)); } }
@Inject private BoundConversationContext boundConversationContext; public void onMessage(Message message) { BoundRequest boundRequest = null; try { boundRequest = new MutableBoundRequest(new HashMap<String, Object>(), new HashMap<String, Object>()); boundConversationContext.associate(boundRequest); if (!boundConversationContext.isActive()) boundConversationContext.activate(); // DO YOUR BUSINESS LOGIC HERE } finally { if (boundConversationContext != null) { if (boundRequest != null) boundConversationContext.dissociate(boundRequest); if (boundConversationContext.isActive()) { boundConversationContext.deactivate(); } } } }
@Override public void deactivateContext() { final ConversationState conversationState = CURRENT_CONVERSATION_STATE.get(); final ManagedConversation currentConversation = boundConversationContext.getCurrentConversation(); if (!currentConversation.isTransient() && !conversationState.isLongRunning()) { startLongRunningConversation(conversationState, currentConversation); } else if (currentConversation.isTransient() && conversationState.isLongRunning()) { endLongRunningConversation(conversationState); } else if (currentConversation.getId() != null && !currentConversation.getId().equals(conversationState.getConversationId())) { LOGGER.warn("current conversation id: {} and registered: {}. There shouldn't be two activated conversations", currentConversation.getId(), conversationState.getConversationId()); } boundConversationContext.deactivate(); boundConversationContext.dissociate(CURRENT_BOUND_REQUEST.get()); CURRENT_BOUND_REQUEST.remove(); CURRENT_CONVERSATION_STATE.remove(); }
public void callback(Context context, Event event) throws Exception { WeldManager manager = context.get(WeldManager.class); BoundConversationContext conversationContext = manager.instance().select(BoundConversationContext.class).get(); if (!conversationContext.getCurrentConversation().isTransient()) { context.add(CDIConversationID.class, new CDIConversationID(conversationContext.getCurrentConversation().getId())); } else { context.add(CDIConversationID.class, new CDIConversationID(null)); } BoundRequest request = context.get(BoundRequest.class); try { conversationContext.invalidate(); conversationContext.deactivate(); } finally { conversationContext.dissociate(request); } } }
conversationContext.dissociate(request);