Author: clebert.suconic(a)jboss.com
Date: 2012-01-12 15:02:37 -0500 (Thu, 12 Jan 2012)
New Revision: 12020
Modified:
branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java
branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/stomp/StompConnection.java
branches/Branch_2_2_AS7/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
branches/Branch_2_2_AS7/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java
Log:
https://issues.jboss.org/browse/JBPAPP-7205 - merging changes into AS7 branch
Modified:
branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java
===================================================================
---
branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java 2012-01-12
19:59:37 UTC (rev 12019)
+++
branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java 2012-01-12
20:02:37 UTC (rev 12020)
@@ -361,7 +361,7 @@
callClosingListeners();
}
- public void disconnect()
+ public void disconnect(final boolean criticalError)
{
Channel channel0 = getChannel(0, -1);
@@ -371,13 +371,25 @@
Set<Channel> allChannels = new HashSet<Channel>(channels.values());
- removeAllChannels();
+ if (!criticalError)
+ {
+ removeAllChannels();
+ }
+ else
+ {
+ // We can't hold a lock if a critical error is happening...
+ // as other threads will be holding the lock while hanging on IO
+ channels.clear();
+ }
// Now we are 100% sure that no more packets will be processed we can flush then
send the disconnect
- for (Channel channel: allChannels)
+ if (!criticalError)
{
- channel.flushConfirmations();
+ for (Channel channel: allChannels)
+ {
+ channel.flushConfirmations();
+ }
}
Packet disconnect = new DisconnectMessage(nodeID);
Modified:
branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/stomp/StompConnection.java
===================================================================
---
branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/stomp/StompConnection.java 2012-01-12
19:59:37 UTC (rev 12019)
+++
branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/stomp/StompConnection.java 2012-01-12
20:02:37 UTC (rev 12020)
@@ -209,7 +209,7 @@
manager.cleanup(this);
}
- public void disconnect()
+ public void disconnect(final boolean criticalError)
{
}
Modified:
branches/Branch_2_2_AS7/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
===================================================================
---
branches/Branch_2_2_AS7/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2012-01-12
19:59:37 UTC (rev 12019)
+++
branches/Branch_2_2_AS7/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2012-01-12
20:02:37 UTC (rev 12020)
@@ -307,7 +307,7 @@
log.trace("Sending connection.disconnection packet to " + conn);
}
- conn.disconnect();
+ conn.disconnect(criticalError);
}
for (Acceptor acceptor : acceptors)
Modified:
branches/Branch_2_2_AS7/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java
===================================================================
---
branches/Branch_2_2_AS7/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java 2012-01-12
19:59:37 UTC (rev 12019)
+++
branches/Branch_2_2_AS7/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java 2012-01-12
20:02:37 UTC (rev 12020)
@@ -151,7 +151,7 @@
/**
* Disconnect the connection, closing all channels
*/
- void disconnect();
+ void disconnect(boolean criticalError);
/**
* returns true if any data has been received since the last time this method was
called.