diff options
| author | Robert Godfrey <rgodfrey@apache.org> | 2010-09-12 12:46:11 +0000 |
|---|---|---|
| committer | Robert Godfrey <rgodfrey@apache.org> | 2010-09-12 12:46:11 +0000 |
| commit | 6419a424b54eb27d02260de5b73ab3214e1fdd9f (patch) | |
| tree | 1cc2f8698c9c0ea64eed0c79bfe1f35bdb2b3607 /java/common/src | |
| parent | 8d12e2a70d026176edc6d717fac645b9571d89ec (diff) | |
| download | qpid-python-6419a424b54eb27d02260de5b73ab3214e1fdd9f.tar.gz | |
QPID-2855 : Broker Transport should not block on awaiting session close confirmation
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@996303 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common/src')
| -rw-r--r-- | java/common/src/main/java/org/apache/qpid/transport/Session.java | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/java/common/src/main/java/org/apache/qpid/transport/Session.java b/java/common/src/main/java/org/apache/qpid/transport/Session.java index 9b84ff422b..e989849477 100644 --- a/java/common/src/main/java/org/apache/qpid/transport/Session.java +++ b/java/common/src/main/java/org/apache/qpid/transport/Session.java @@ -543,7 +543,7 @@ public class Session extends SessionInvoker } } - if (state != OPEN && state != CLOSED) + if (state != OPEN && state != CLOSED && state != CLOSING) { Thread current = Thread.currentThread(); if (!current.equals(resumer)) @@ -568,6 +568,7 @@ public class Session extends SessionInvoker ("timed out waiting for resume to finish"); } break; + case CLOSING: case CLOSED: ExecutionException exc = getException(); if (exc != null) @@ -906,18 +907,23 @@ public class Session extends SessionInvoker sessionRequestTimeout(0); sessionDetach(name.getBytes()); - Waiter w = new Waiter(commands, timeout); - while (w.hasTime() && state != CLOSED) - { - w.await(); - } - - if (state != CLOSED) - { - throw new SessionException("close() timed out"); - } + awaitClose(); - connection.removeSession(this); + + } + } + + protected void awaitClose() + { + Waiter w = new Waiter(commands, timeout); + while (w.hasTime() && state != CLOSED) + { + w.await(); + } + + if (state != CLOSED) + { + throw new SessionException("close() timed out"); } } @@ -960,6 +966,16 @@ public class Session extends SessionInvoker delegate.detached(this); } } + + if(state == CLOSED) + { + connection.removeSession(this); + } + } + + public boolean isClosing() + { + return state == CLOSED || state == CLOSING; } public String toString() |
