Refine search
@Override public void activate() { if (!isAssociated()) { throw ConversationLogger.LOG.mustCallAssociateBeforeActivate(); } if (!isActive()) { super.setActive(true); } else { ConversationLogger.LOG.contextAlreadyActive(getRequest()); } // Reset the initialized flag - a thread which is not cleaned up properly (e.g. async processing on // Tomcat) may break the lazy initialization otherwise this.initialized.set(null); }
@Override public void begin(String id) { verifyConversationContextActive(); if (!_transient) { throw ConversationLogger.LOG.beginCalledOnLongRunningConversation(); } if (getActiveConversationContext().getConversation(id) != null) { throw ConversationLogger.LOG.conversationIdAlreadyInUse(id); } _transient = false; this.id = id; notifyConversationContext(); ConversationLogger.LOG.promotedTransientConversation(id); }
@Override public boolean lock(long timeout) { verifyConversationContextActive(); boolean success; try { success = concurrencyLock.tryLock(timeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); success = false; } if (success) { ConversationLogger.LOG.conversationLocked(this); } else { ConversationLogger.LOG.conversationUnavailable(timeout, this); } return success; }
public static String determineConversationId(HttpServletRequest request, String parameterName) { if (request == null) { throw ConversationLogger.LOG.mustCallAssociateBeforeActivate(); } if (request.getParameter(NO_CID) != null) { return null; // ignore cid; WELD-919 } if (CONVERSATION_PROPAGATION_NONE.equals(request.getParameter(CONVERSATION_PROPAGATION))) { return null; // conversationPropagation=none (CDI-135) } String cidName = parameterName; String cid = request.getParameter(cidName); ConversationLogger.LOG.foundConversationFromRequest(cid); return cid; } }
throw ConversationLogger.LOG.mustCallAssociateBeforeDeactivate(); if (getCurrentConversation().isTransient() && getRequestAttribute(getRequest(), ConversationNamingScheme.PARAMETER_NAME) != null) { getCurrentConversation().touch(); if (!getBeanStore().isAttached()) { throw ConversationLogger.LOG.conversationNamingSchemeNotFound(); .getId()); throw ConversationLogger.LOG.contextNotActive();
protected void initialize(String cid) { // Attach the conversation // WELD-1315 Don't try to restore the long-running conversation if cid param is empty if (cid != null && !cid.isEmpty()) { ManagedConversation conversation = getConversation(cid); if (conversation != null && !isExpired(conversation)) { boolean lock = lock(conversation); if (lock) { // WELD-1690 Don't associate a conversation which was ended (race condition) if (conversation.isTransient()) { associateRequestWithNewConversation(); throw ConversationLogger.LOG.noConversationFoundToRestore(cid); } associateRequest(conversation); } else { // CDI 6.7.4 we must activate a new transient conversation before we throw the exception associateRequestWithNewConversation(); throw ConversationLogger.LOG.conversationLockTimedout(cid); } } else { // CDI 6.7.4 we must activate a new transient conversation before we throw the exception associateRequestWithNewConversation(); throw ConversationLogger.LOG.noConversationFoundToRestore(cid); } } else { associateRequestWithNewConversation(); } }
@Override public void begin() { verifyConversationContextActive(); if (!_transient) { throw ConversationLogger.LOG.beginCalledOnLongRunningConversation(); } _transient = false; if (this.id == null) { // This a conversation that was made transient previously in this request this.id = getActiveConversationContext().generateConversationId(); } notifyConversationContext(); ConversationLogger.LOG.promotedTransientConversation(id); }
protected ConversationIdGenerator getConversationIdGenerator() { final R request = associated.get(); if (request == null) { throw ConversationLogger.LOG.mustCallAssociateBeforeGeneratingId(); } Object conversationIdGenerator = getRequestAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME); if (conversationIdGenerator == null) { conversationIdGenerator = getSessionAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, false); if(conversationIdGenerator == null) { conversationIdGenerator = new ConversationIdGenerator(); setRequestAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, conversationIdGenerator); setSessionAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, conversationIdGenerator, false); } else { setRequestAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, conversationIdGenerator); } } if (!(conversationIdGenerator instanceof ConversationIdGenerator)) { throw ConversationLogger.LOG.conversationIdGeneratorNotFound(); } return (ConversationIdGenerator) conversationIdGenerator; }
throw ConversationLogger.LOG.mustCallAssociateBeforeDeactivate(); if (getCurrentConversation().isTransient() && getRequestAttribute(getRequest(), ConversationNamingScheme.PARAMETER_NAME) != null) { getCurrentConversation().touch(); if (!getBeanStore().isAttached()) { throw ConversationLogger.LOG.conversationNamingSchemeNotFound(); .getId()); throw ConversationLogger.LOG.contextNotActive();
protected void initialize(String cid) { // Attach the conversation // WELD-1315 Don't try to restore the long-running conversation if cid param is empty if (cid != null && !cid.isEmpty()) { ManagedConversation conversation = getConversation(cid); if (conversation != null && !isExpired(conversation)) { boolean lock = lock(conversation); if (lock) { // WELD-1690 Don't associate a conversation which was ended (race condition) if (conversation.isTransient()) { associateRequestWithNewConversation(); throw ConversationLogger.LOG.noConversationFoundToRestore(cid); } associateRequest(conversation); } else { // CDI 6.7.4 we must activate a new transient conversation before we throw the exception associateRequestWithNewConversation(); throw ConversationLogger.LOG.conversationLockTimedout(cid); } } else { // CDI 6.7.4 we must activate a new transient conversation before we throw the exception associateRequestWithNewConversation(); throw ConversationLogger.LOG.noConversationFoundToRestore(cid); } } else { associateRequestWithNewConversation(); } }
@Override public void begin() { verifyConversationContextActive(); if (!_transient) { throw ConversationLogger.LOG.beginCalledOnLongRunningConversation(); } _transient = false; if (this.id == null) { // This a conversation that was made transient previously in this request this.id = getActiveConversationContext().generateConversationId(); } notifyConversationContext(); ConversationLogger.LOG.promotedTransientConversation(id); }
protected ConversationIdGenerator getConversationIdGenerator() { final R request = associated.get(); if (request == null) { throw ConversationLogger.LOG.mustCallAssociateBeforeGeneratingId(); } Object conversationIdGenerator = getRequestAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME); if (conversationIdGenerator == null) { conversationIdGenerator = getSessionAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, false); if (conversationIdGenerator == null) { conversationIdGenerator = new ConversationIdGenerator(); setRequestAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, conversationIdGenerator); setSessionAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, conversationIdGenerator, false); } else { setRequestAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, conversationIdGenerator); } } if (!(conversationIdGenerator instanceof ConversationIdGenerator)) { throw ConversationLogger.LOG.conversationIdGeneratorNotFound(); } return (ConversationIdGenerator) conversationIdGenerator; }
public static String determineConversationId(HttpServletRequest request, String parameterName) { if (request == null) { throw ConversationLogger.LOG.mustCallAssociateBeforeActivate(); } if (request.getParameter(NO_CID) != null) { return null; // ignore cid; WELD-919 } if (CONVERSATION_PROPAGATION_NONE.equals(request.getParameter(CONVERSATION_PROPAGATION))) { return null; // conversationPropagation=none (CDI-135) } String cidName = parameterName; String cid = request.getParameter(cidName); ConversationLogger.LOG.foundConversationFromRequest(cid); return cid; } }
@Override public boolean lock(long timeout) { verifyConversationContextActive(); boolean success; try { success = concurrencyLock.tryLock(timeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); success = false; } if (success) { ConversationLogger.LOG.conversationLocked(this); } else { ConversationLogger.LOG.conversationUnavailable(timeout, this); } return success; }
throw ConversationLogger.LOG.mustCallAssociateBeforeDeactivate(); if (getCurrentConversation().isTransient() && getRequestAttribute(getRequest(), ConversationNamingScheme.PARAMETER_NAME) != null) { getCurrentConversation().touch(); if (!getBeanStore().isAttached()) { throw ConversationLogger.LOG.conversationNamingSchemeNotFound(); .getId()); throw ConversationLogger.LOG.contextNotActive();
protected void initialize(String cid) { // Attach the conversation // WELD-1315 Don't try to restore the long-running conversation if cid param is empty if (cid != null && !cid.isEmpty()) { ManagedConversation conversation = getConversation(cid); if (conversation != null && !isExpired(conversation)) { boolean lock = lock(conversation); if (lock) { // WELD-1690 Don't associate a conversation which was ended (race condition) if(conversation.isTransient()) { associateRequestWithNewConversation(); throw ConversationLogger.LOG.noConversationFoundToRestore(cid); } associateRequest(conversation); } else { // CDI 6.7.4 we must activate a new transient conversation before we throw the exception associateRequestWithNewConversation(); throw ConversationLogger.LOG.conversationLockTimedout(cid); } } else { // CDI 6.7.4 we must activate a new transient conversation before we throw the exception associateRequestWithNewConversation(); throw ConversationLogger.LOG.noConversationFoundToRestore(cid); } } else { associateRequestWithNewConversation(); } }
@Override public void begin(String id) { verifyConversationContextActive(); if (!_transient) { throw ConversationLogger.LOG.beginCalledOnLongRunningConversation(); } if (getActiveConversationContext().getConversation(id) != null) { throw ConversationLogger.LOG.conversationIdAlreadyInUse(id); } _transient = false; this.id = id; notifyConversationContext(); ConversationLogger.LOG.promotedTransientConversation(id); }
@Override public void activate() { if (!isAssociated()) { throw ConversationLogger.LOG.mustCallAssociateBeforeActivate(); } if (!isActive()) { super.setActive(true); } else { ConversationLogger.LOG.contextAlreadyActive(getRequest()); } // Reset the initialized flag - a thread which is not cleaned up properly (e.g. async processing on // Tomcat) may break the lazy initialization otherwise this.initialized.set(null); }
@Override public void begin() { verifyConversationContextActive(); if (!_transient) { throw ConversationLogger.LOG.beginCalledOnLongRunningConversation(); } _transient = false; if (this.id == null) { // This a conversation that was made transient previously in this request this.id = getActiveConversationContext().generateConversationId(); } notifyConversationContext(); ConversationLogger.LOG.promotedTransientConversation(id); }
protected ConversationIdGenerator getConversationIdGenerator() { final R request = associated.get(); if (request == null) { throw ConversationLogger.LOG.mustCallAssociateBeforeGeneratingId(); } Object conversationIdGenerator = getRequestAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME); if (conversationIdGenerator == null) { conversationIdGenerator = getSessionAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, false); if (conversationIdGenerator == null) { conversationIdGenerator = new ConversationIdGenerator(); setRequestAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, conversationIdGenerator); setSessionAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, conversationIdGenerator, false); } else { setRequestAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, conversationIdGenerator); } } if (!(conversationIdGenerator instanceof ConversationIdGenerator)) { throw ConversationLogger.LOG.conversationIdGeneratorNotFound(); } return (ConversationIdGenerator) conversationIdGenerator; }