ARTEMIS-5218 StompHandler HeartBeat restarted after being stopped

This commit is contained in:
Clebert Suconic 2024-12-16 20:06:43 -05:00 committed by Justin Bertram
parent 5c1ecea69a
commit 54f99937bd
3 changed files with 16 additions and 1 deletions

View File

@ -266,6 +266,8 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements
private static final int MIN_SERVER_PING = 500;
private boolean previouslyStopped = false;
long serverPingPeriod = 0;
long clientPingResponse;
AtomicLong lastPingTimestamp = new AtomicLong(0);
@ -321,7 +323,14 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements
public void shutdown() {
this.stop();
previouslyStopped = true;
}
@Override
public void start() {
if (!previouslyStopped) {
super.start();
}
}
public void pinged() {

View File

@ -152,6 +152,10 @@ public class Wait {
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) {
assertTrue(DEFAULT_FAILURE_MESSAGE, () -> !condition.isSatisfied(), duration, sleep);
}

View File

@ -2255,6 +2255,8 @@ public class StompV11Test extends StompTestBase {
subFrame.addHeader("destination", getTopicPrefix() + getTopicName());
subFrame.addHeader("id", "0");
Wait.assertTrue(() -> "HeartBeater is not running!! -> " + System.identityHashCode(stompFrameHandler.getHeartBeater()), () -> stompFrameHandler.getHeartBeater().isStarted(), 5000, 100);
ClientStompFrame 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.assertFalse("HeartBeater is still running!!", () -> stompFrameHandler.getHeartBeater().isStarted());
Wait.assertFalse(() -> "HeartBeater is still running!! -> " + System.identityHashCode(stompFrameHandler.getHeartBeater()), () -> stompFrameHandler.getHeartBeater().isStarted(), 5000, 100);
}