[hornetq-commits] JBoss hornetq SVN: r8649 - trunk/src/main/org/hornetq/core/client/impl.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Dec 9 14:39:25 EST 2009
Author: clebert.suconic at jboss.com
Date: 2009-12-09 14:39:24 -0500 (Wed, 09 Dec 2009)
New Revision: 8649
Modified:
trunk/src/main/org/hornetq/core/client/impl/DelegatingSession.java
Log:
tweaks on finalize to avoid exceptions when finalize happened while closing didn't finish.
* Some weird behaviour observed on this thread: http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269860#4269860
Modified: trunk/src/main/org/hornetq/core/client/impl/DelegatingSession.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/DelegatingSession.java 2009-12-09 19:00:06 UTC (rev 8648)
+++ trunk/src/main/org/hornetq/core/client/impl/DelegatingSession.java 2009-12-09 19:39:24 UTC (rev 8649)
@@ -50,6 +50,8 @@
private final ClientSessionInternal session;
private final Exception creationStack;
+
+ private volatile boolean closed;
private static Set<DelegatingSession> sessions = new ConcurrentHashSet<DelegatingSession>();
@@ -68,7 +70,9 @@
@Override
protected void finalize() throws Throwable
{
- if (!session.isClosed())
+ // In some scenarios we have seen the JDK finalizing the DelegatingSession while the call to session.close() was still in progress
+ //
+ if (!closed && !session.isClosed())
{
DelegatingSession.log.warn("I'm closing a core ClientSession you left open. Please make sure you close all ClientSessions explicitly " + "before letting them go out of scope! " +
System.identityHashCode(this));
@@ -130,6 +134,8 @@
public void close() throws HornetQException
{
+ closed = true;
+
if (DelegatingSession.debug)
{
DelegatingSession.sessions.remove(this);
More information about the hornetq-commits
mailing list