summaryrefslogtreecommitdiff
path: root/java/common/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/common/src')
-rw-r--r--java/common/src/main/java/org/apache/qpidity/transport/ChannelDelegate.java3
-rw-r--r--java/common/src/main/java/org/apache/qpidity/transport/Session.java21
2 files changed, 20 insertions, 4 deletions
diff --git a/java/common/src/main/java/org/apache/qpidity/transport/ChannelDelegate.java b/java/common/src/main/java/org/apache/qpidity/transport/ChannelDelegate.java
index 5361613e1e..9470520937 100644
--- a/java/common/src/main/java/org/apache/qpidity/transport/ChannelDelegate.java
+++ b/java/common/src/main/java/org/apache/qpidity/transport/ChannelDelegate.java
@@ -42,9 +42,6 @@ class ChannelDelegate extends MethodDelegate<Channel>
public @Override void sessionDetached(Channel channel, SessionDetached closed)
{
channel.getSession().closed();
- // XXX: should we remove the channel from the connection? It
- // could have an external reference to it. Maybe we need a
- // weak hash map in connection.
}
public @Override void sessionDetach(Channel channel, SessionDetach dtc)
diff --git a/java/common/src/main/java/org/apache/qpidity/transport/Session.java b/java/common/src/main/java/org/apache/qpidity/transport/Session.java
index a7de66c1a7..c11ef46d36 100644
--- a/java/common/src/main/java/org/apache/qpidity/transport/Session.java
+++ b/java/common/src/main/java/org/apache/qpidity/transport/Session.java
@@ -459,7 +459,23 @@ public class Session extends Invoker
{
sessionRequestTimeout(0);
sessionDetach(name);
- // XXX: channel.close();
+ synchronized (commands)
+ {
+ long start = System.currentTimeMillis();
+ long elapsed = 0;
+ try
+ {
+ while (!closed.get() && elapsed < timeout)
+ {
+ commands.wait(timeout - elapsed);
+ elapsed = System.currentTimeMillis() - start;
+ }
+ }
+ catch (InterruptedException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
}
public void exception(Throwable t)
@@ -484,6 +500,9 @@ public class Session extends Invoker
}
}
}
+ channel.close();
+ channel.setSession(null);
+ channel = null;
}
public String toString()