Skip to content

Commit

Permalink
minor. some exit-early for conversation handling when there is nothin…
Browse files Browse the repository at this point in the history
…g to do.

git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@1781 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
nickarls committed Mar 6, 2009
1 parent 6208d1f commit 496e54b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Expand Up @@ -77,6 +77,10 @@ public static ConversationEntry of(ConversationImpl conversation, Future<?> term
*/
public boolean cancelTermination()
{
if (terminationHandle.isCancelled())
{
return true;
}
boolean success = terminationHandle.cancel(false);
if (success)
{
Expand Down Expand Up @@ -135,6 +139,10 @@ public boolean lock(long timeout) throws InterruptedException
*/
public boolean unlock()
{
if (!concurrencyLock.isLocked())
{
return true;
}
if (concurrencyLock.isHeldByCurrentThread())
{
concurrencyLock.unlock();
Expand Down
Expand Up @@ -172,10 +172,10 @@ public void cleanupConversation()
// canceled in the
// beginConversation) or the case where we have a completely new
// long-running conversation.
if (longRunningConversations.containsKey(currentConversation.getId()))
if (longRunningConversations.containsKey(cid))
{
longRunningConversations.get(currentConversation.getId()).unlock();
longRunningConversations.get(currentConversation.getId()).reScheduleTermination(terminationHandle);
longRunningConversations.get(cid).unlock();
longRunningConversations.get(cid).reScheduleTermination(terminationHandle);
}
else
{
Expand Down

0 comments on commit 496e54b

Please sign in to comment.