| | |
| | | // Test connection |
| | | boolean connected = false; |
| | | if (rd != null) |
| | | { |
| | | connected = rd.isConnected(); |
| | | } |
| | | else |
| | | { |
| | | connected = rb.isConnected(); |
| | | } |
| | | |
| | | if (connected) |
| | | { |
| | |
| | | } finally |
| | | { |
| | | endTest(); |
| | | if (bw != null) bw.shutdown(); |
| | | if (br3 != null) br3.shutdown(); |
| | | if (br2 != null) br2.shutdown(); |
| | | if (bw != null) |
| | | { |
| | | bw.shutdown(); |
| | | } |
| | | if (br3 != null) |
| | | { |
| | | br3.shutdown(); |
| | | } |
| | | if (br2 != null) |
| | | { |
| | | br2.shutdown(); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | // Finalize test |
| | | endTest(); |
| | | if (bw != null) bw.shutdown(); |
| | | if (br != null) br.shutdown(); |
| | | if (bw != null) |
| | | { |
| | | bw.shutdown(); |
| | | } |
| | | if (br != null) |
| | | { |
| | | br.shutdown(); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | public void pause() |
| | | { |
| | | if (isPaused()) |
| | | { |
| | | return; // Already suspended |
| | | } |
| | | suspended.set(true); |
| | | // Wait for all messages sent |
| | | while (!sessionDone.get()) |
| | |
| | | ReplicationMsg msg = rb.receive(); // Allow more messages to be sent by broker writer |
| | | rb.updateWindowAfterReplay(); // Allow RS to send more messages to broker |
| | | if (msg != null) |
| | | { |
| | | debugInfo("Broker " + serverId + " reader received: " + msg); |
| | | } |
| | | lastMsg = msg; |
| | | } catch (SocketTimeoutException ex) |
| | | { |
| | | if (shutdown) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | debugInfo("Broker " + serverId + " reader thread is dying"); |