brusdev commented on code in PR #4482:
URL: https://github.com/apache/activemq-artemis/pull/4482#discussion_r1198540063
##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ServerLocatorConnectTest.java:
##########
@@ -47,6 +52,47 @@ public void setUp() throws Exception {
server.start();
}
+ @Test
+ public void testFailFastConnectOnClosing() throws Exception {
+ CountDownLatch connectLatch = new CountDownLatch(1);
+ CountDownLatch subscribeLatch = new CountDownLatch(1);
+ AtomicBoolean connectTimedOut = new AtomicBoolean(false);
+
+ ServerLocator locator =
createNonHALocator(isNetty()).setCallTimeout(30000);
+ try (ClientSessionFactory csf = locator.createSessionFactory()) {
+ Assert.assertFalse(csf.isClosed());
+ }
+
+ server.getRemotingService().addIncomingInterceptor((Interceptor)
(packet, connection) -> {
+ if (packet.getType() == PacketImpl.SUBSCRIBE_TOPOLOGY_V2) {
+ subscribeLatch.countDown();
+ return false;
+ }
+ return true;
+ });
+
+ new Thread(() -> {
+ try {
+ locator.createSessionFactory();
+ } catch (Exception e) {
+ connectTimedOut.set(e.getClass() ==
ActiveMQConnectionTimedOutException.class);
Review Comment:
I used `ActiveMQObjectClosedException` when ServerLocatorImpl is closed on
waiting for the topology.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]