ARTEMIS-5218 StompHandler HeartBeat restarted after being stopped
This commit is contained in:
parent
5c1ecea69a
commit
54f99937bd
|
@ -266,6 +266,8 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements
|
||||||
|
|
||||||
private static final int MIN_SERVER_PING = 500;
|
private static final int MIN_SERVER_PING = 500;
|
||||||
|
|
||||||
|
private boolean previouslyStopped = false;
|
||||||
|
|
||||||
long serverPingPeriod = 0;
|
long serverPingPeriod = 0;
|
||||||
long clientPingResponse;
|
long clientPingResponse;
|
||||||
AtomicLong lastPingTimestamp = new AtomicLong(0);
|
AtomicLong lastPingTimestamp = new AtomicLong(0);
|
||||||
|
@ -321,7 +323,14 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements
|
||||||
|
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
this.stop();
|
this.stop();
|
||||||
|
previouslyStopped = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
if (!previouslyStopped) {
|
||||||
|
super.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pinged() {
|
public void pinged() {
|
||||||
|
|
|
@ -152,6 +152,10 @@ public class Wait {
|
||||||
assertTrue(failureMessage, () -> !condition.isSatisfied(), duration, SLEEP_MILLIS);
|
assertTrue(failureMessage, () -> !condition.isSatisfied(), duration, SLEEP_MILLIS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void assertFalse(Supplier<String> failureMessage, Condition condition, final long duration, final long sleep) {
|
||||||
|
assertTrue(failureMessage, () -> !condition.isSatisfied(), duration, sleep);
|
||||||
|
}
|
||||||
|
|
||||||
public static void assertFalse(Condition condition, final long duration, final long sleep) {
|
public static void assertFalse(Condition condition, final long duration, final long sleep) {
|
||||||
assertTrue(DEFAULT_FAILURE_MESSAGE, () -> !condition.isSatisfied(), duration, sleep);
|
assertTrue(DEFAULT_FAILURE_MESSAGE, () -> !condition.isSatisfied(), duration, sleep);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2255,6 +2255,8 @@ public class StompV11Test extends StompTestBase {
|
||||||
subFrame.addHeader("destination", getTopicPrefix() + getTopicName());
|
subFrame.addHeader("destination", getTopicPrefix() + getTopicName());
|
||||||
subFrame.addHeader("id", "0");
|
subFrame.addHeader("id", "0");
|
||||||
|
|
||||||
|
Wait.assertTrue(() -> "HeartBeater is not running!! -> " + System.identityHashCode(stompFrameHandler.getHeartBeater()), () -> stompFrameHandler.getHeartBeater().isStarted(), 5000, 100);
|
||||||
|
|
||||||
ClientStompFrame f = conn.sendFrame(subFrame);
|
ClientStompFrame f = conn.sendFrame(subFrame);
|
||||||
f = conn.sendFrame(subFrame);
|
f = conn.sendFrame(subFrame);
|
||||||
|
|
||||||
|
@ -2269,7 +2271,7 @@ public class StompV11Test extends StompTestBase {
|
||||||
|
|
||||||
Wait.assertEquals(0, () -> server.getRemotingService().getConnections().size());
|
Wait.assertEquals(0, () -> server.getRemotingService().getConnections().size());
|
||||||
|
|
||||||
Wait.assertFalse("HeartBeater is still running!!", () -> stompFrameHandler.getHeartBeater().isStarted());
|
Wait.assertFalse(() -> "HeartBeater is still running!! -> " + System.identityHashCode(stompFrameHandler.getHeartBeater()), () -> stompFrameHandler.getHeartBeater().isStarted(), 5000, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue