summaryrefslogtreecommitdiff
path: root/java/client/src/test
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2009-09-04 16:27:54 +0000
committerMartin Ritchie <ritchiem@apache.org>2009-09-04 16:27:54 +0000
commit61f551d4782033e4ed40661f2cccc04502190925 (patch)
treec3f8b5662679618ae6ea6ac6f62903aadf7939dd /java/client/src/test
parent067053041000736b8c47469e4d6746551551d5ba (diff)
downloadqpid-python-61f551d4782033e4ed40661f2cccc04502190925.tar.gz
QPID-1809 - The incorrect expcetions were due to a race condition between the mina exception notification thread and the clients main thread blocking for a frame. Occasionally, the client will start blocking just after the notification and so will Timeout. This update ensures that blocking does not occur if the connection has been marked closing or is closed. The lastException set on the StateManager is thrown instead.
The connection close also needed to take into consideration this fact. The syncWrite on for ChannelClose and ConnectionClose are now only down if we are not in a closing situation. As the 0-10 code path does not use the StateManager the changes were applied to the 0-8 Session. Further testing may be needed to validate that the 0-10 client code path does not also have this race condition. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@811471 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src/test')
-rw-r--r--java/client/src/test/java/org/apache/qpid/client/MockAMQConnection.java2
-rw-r--r--java/client/src/test/java/org/apache/qpid/client/protocol/AMQProtocolHandlerTest.java11
2 files changed, 3 insertions, 10 deletions
diff --git a/java/client/src/test/java/org/apache/qpid/client/MockAMQConnection.java b/java/client/src/test/java/org/apache/qpid/client/MockAMQConnection.java
index ce79080e97..da44822ec3 100644
--- a/java/client/src/test/java/org/apache/qpid/client/MockAMQConnection.java
+++ b/java/client/src/test/java/org/apache/qpid/client/MockAMQConnection.java
@@ -85,7 +85,7 @@ public class MockAMQConnection extends AMQConnection
}
@Override
- public ProtocolVersion makeBrokerConnection(BrokerDetails brokerDetail) throws IOException, AMQException
+ public ProtocolVersion makeBrokerConnection(BrokerDetails brokerDetail) throws IOException
{
_connected = true;
_protocolHandler.getStateManager().changeState(AMQState.CONNECTION_OPEN);
diff --git a/java/client/src/test/java/org/apache/qpid/client/protocol/AMQProtocolHandlerTest.java b/java/client/src/test/java/org/apache/qpid/client/protocol/AMQProtocolHandlerTest.java
index 10ec220d9e..fc7f8148f0 100644
--- a/java/client/src/test/java/org/apache/qpid/client/protocol/AMQProtocolHandlerTest.java
+++ b/java/client/src/test/java/org/apache/qpid/client/protocol/AMQProtocolHandlerTest.java
@@ -200,15 +200,8 @@ public class AMQProtocolHandlerTest extends TestCase
_handler.getStateManager().error(trigger);
_logger.info("Setting state to be CONNECTION_CLOSED.");
- try
- {
- _handler.getStateManager().changeState(AMQState.CONNECTION_CLOSED);
- }
- catch (AMQException e)
- {
- _logger.error("Unable to change the state to closed.", e);
- fail("Unable to change the state to closed due to :"+e.getMessage());
- }
+
+ _handler.getStateManager().changeState(AMQState.CONNECTION_CLOSED);
_logger.info("Firing exception");
_handler.propagateExceptionToFrameListeners(trigger);