[hornetq-commits] JBoss hornetq SVN: r11786 - branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Nov 29 09:57:56 EST 2011
Author: clebert.suconic at jboss.com
Date: 2011-11-29 09:57:55 -0500 (Tue, 29 Nov 2011)
New Revision: 11786
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
Log:
JBPAPP-7614 - server.stop would be interrupted if a transaction was committed/rolledback while the server is shutting down
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-11-29 14:28:20 UTC (rev 11785)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-11-29 14:57:55 UTC (rev 11786)
@@ -498,12 +498,24 @@
// But at least we will do our best to avoid it on regular shutdowns
for (ServerSession session : sessions.values())
{
- session.close(true);
- if (!criticalIOError)
+ try
{
- session.waitContextCompletion();
+ storageManager.setContext(session.getSessionContext());
+ session.close(true);
+ if (!criticalIOError)
+ {
+ session.waitContextCompletion();
+ }
}
+ catch (Exception e)
+ {
+ // If anything went wrong with closing sessions.. we should ignore it
+ // such as transactions.. etc.
+ log.warn(e.getMessage(), e);
+ }
}
+
+ storageManager.clearContext();
remotingService.stop();
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2011-11-29 14:28:20 UTC (rev 11785)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2011-11-29 14:57:55 UTC (rev 11786)
@@ -289,7 +289,14 @@
{
// We only rollback local txs on close, not XA tx branches
- rollback(failed);
+ try
+ {
+ rollback(failed);
+ }
+ catch (Exception e)
+ {
+ log.warn(e.getMessage(), e);
+ }
}
Set<ServerConsumer> consumersClone = new HashSet<ServerConsumer>(consumers.values());
@@ -605,7 +612,7 @@
}
}
- public void commit() throws Exception
+ public synchronized void commit() throws Exception
{
if (isTrace)
{
@@ -621,7 +628,7 @@
}
}
- public void rollback(final boolean considerLastMessageAsDelivered) throws Exception
+ public synchronized void rollback(final boolean considerLastMessageAsDelivered) throws Exception
{
if (tx == null)
{
@@ -642,7 +649,7 @@
}
}
- public void xaCommit(final Xid xid, final boolean onePhase) throws Exception
+ public synchronized void xaCommit(final Xid xid, final boolean onePhase) throws Exception
{
if (tx != null && tx.getXid().equals(xid))
{
@@ -690,7 +697,7 @@
}
}
- public void xaEnd(final Xid xid) throws Exception
+ public synchronized void xaEnd(final Xid xid) throws Exception
{
if (tx != null && tx.getXid().equals(xid))
{
@@ -735,7 +742,7 @@
}
}
- public void xaForget(final Xid xid) throws Exception
+ public synchronized void xaForget(final Xid xid) throws Exception
{
long id = resourceManager.removeHeuristicCompletion(xid);
@@ -758,7 +765,7 @@
}
}
- public void xaJoin(final Xid xid) throws Exception
+ public synchronized void xaJoin(final Xid xid) throws Exception
{
Transaction theTx = resourceManager.getTransaction(xid);
@@ -781,7 +788,7 @@
}
}
- public void xaResume(final Xid xid) throws Exception
+ public synchronized void xaResume(final Xid xid) throws Exception
{
if (tx != null)
{
@@ -816,7 +823,7 @@
}
}
- public void xaRollback(final Xid xid) throws Exception
+ public synchronized void xaRollback(final Xid xid) throws Exception
{
if (tx != null && tx.getXid().equals(xid))
{
@@ -865,7 +872,7 @@
}
}
- public void xaStart(final Xid xid) throws Exception
+ public synchronized void xaStart(final Xid xid) throws Exception
{
if (tx != null)
{
@@ -888,7 +895,7 @@
}
}
- public void xaSuspend() throws Exception
+ public synchronized void xaSuspend() throws Exception
{
if (tx == null)
{
@@ -913,7 +920,7 @@
}
}
- public void xaPrepare(final Xid xid) throws Exception
+ public synchronized void xaPrepare(final Xid xid) throws Exception
{
if (tx != null && tx.getXid().equals(xid))
{
More information about the hornetq-commits
mailing list