}
@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();