| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Terracotta
Revision: 9965
Author: mgovinda
Date: 04 Sep 2008 07:46:52
Changes:Wait for Server to send final Tx ACK in test
Files:| ... | ...@@ -16,6 +16,7 @@ | |
| 16 | 16 | import com.tc.net.protocol.transport.DefaultConnectionIdFactory; |
| 17 | 17 | import com.tc.net.protocol.transport.NullConnectionPolicy; |
| 18 | 18 | import com.tc.object.session.NullSessionManager; |
| 19 | import com.tc.util.concurrent.ThreadUtil; | |
| 19 | 20 | |
| 20 | 21 | import java.util.HashSet; |
| 21 | 22 | import java.util.Set; |
| ... | ...@@ -118,13 +119,24 @@ | |
| 118 | 119 | |
| 119 | 120 | ClientMessageChannel channel; |
| 120 | 121 | channel = clientComms |
| 121 | .createClientChannel(sessionManager, 0, TCSocketAddress.LOOPBACK_IP, lsnr.getBindPort(), 3000, | |
| 122 | new ConnectionAddressProvider(new ConnectionInfo[] { new ConnectionInfo("localhost", lsnr | |
| 123 | .getBindPort()) })); | |
| 122 | .createClientChannel( | |
| 123 | sessionManager, | |
| 124 | 0, | |
| 125 | TCSocketAddress.LOOPBACK_IP, | |
| 126 | lsnr.getBindPort(), | |
| 127 | 3000, | |
| 128 | new ConnectionAddressProvider( | |
| 129 | new ConnectionInfo[] { new ConnectionInfo( | |
| 130 | "localhost", | |
| 131 | lsnr | |
| 132 | .getBindPort()) })); | |
| 124 | 133 | channel.open(); |
| 125 | 134 | assertTrue(channel.isConnected()); |
| 126 | 135 | |
| 127 | assertEquals(1, channelManager.getChannels().length); | |
| 136 | while (!channelManager.getChannels()[0].isConnected()) { | |
| 137 | System.out.println("waiting for server to send final Tx ACK for client connection"); | |
| 138 | ThreadUtil.reallySleep(1000); | |
| 139 | } | |
| 128 | 140 | clientComms.getConnectionManager().closeAllConnections(5000); |
| 129 | 141 | assertFalse(channel.isConnected()); |
| 130 | 142 | |
| ... | ...@@ -187,8 +199,8 @@ | |
| 187 | 199 | } |
| 188 | 200 | |
| 189 | 201 | public short getStackLayerFlag() { |
| 190 | //its a test | |
| 191 | //do nothing | |
| 202 | // its a test | |
| 203 | // do nothing | |
| 192 | 204 | throw new ImplementMe(); |
| 193 | 205 | } |
| 194 | 206 |
| ... | ...@@ -89,12 +89,14 @@ | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | public void closeEvent(TCConnectionEvent event) { |
| 92 | if (status.isEstablished()) { | |
| 93 | status.reset(); | |
| 94 | super.closeEvent(event); | |
| 95 | } else { | |
| 96 | // DEV-1856 : Don't bother for connections which actually didn't make up to Transport Establishment. | |
| 97 | logger.warn("Connection : " + event.getSource() + ", which was not Transport Established, got closed"); | |
| 92 | synchronized (status) { | |
| 93 | if (status.isEstablished()) { | |
| 94 | status.reset(); | |
| 95 | super.closeEvent(event); | |
| 96 | } else { | |
| 97 | // DEV-1856 : Don't bother for connections which actually didn't make up to Transport Establishment. | |
| 98 | logger.warn("Connection : " + event.getSource() + ", which was not Transport Established, got closed"); | |
| 99 | } | |
| 98 | 100 | } |
| 99 | 101 | } |
| 100 | 102 |