diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java index 30071582d85..d9166033607 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java @@ -200,10 +200,6 @@ public class NettyConnector extends AbstractConnector { private boolean httpEnabled; - private long httpMaxClientIdleTime; - - private long httpClientIdleScanPeriod; - private boolean httpRequiresSessionId; // if true, after the connection, the connector will send @@ -368,8 +364,6 @@ public NettyConnector(final Map configuration, httpEnabled = ConfigurationHelper.getBooleanProperty(TransportConstants.HTTP_ENABLED_PROP_NAME, TransportConstants.DEFAULT_HTTP_ENABLED, configuration); servletPath = ConfigurationHelper.getStringProperty(TransportConstants.SERVLET_PATH, TransportConstants.DEFAULT_SERVLET_PATH, configuration); if (httpEnabled) { - httpMaxClientIdleTime = ConfigurationHelper.getLongProperty(TransportConstants.HTTP_CLIENT_IDLE_PROP_NAME, TransportConstants.DEFAULT_HTTP_CLIENT_IDLE_TIME, configuration); - httpClientIdleScanPeriod = ConfigurationHelper.getLongProperty(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, TransportConstants.DEFAULT_HTTP_CLIENT_SCAN_PERIOD, configuration); httpRequiresSessionId = ConfigurationHelper.getBooleanProperty(TransportConstants.HTTP_REQUIRES_SESSION_ID, TransportConstants.DEFAULT_HTTP_REQUIRES_SESSION_ID, configuration); httpHeaders = new HashMap<>(); for (Map.Entry header : configuration.entrySet()) { @@ -378,8 +372,6 @@ public NettyConnector(final Map configuration, } } } else { - httpMaxClientIdleTime = 0; - httpClientIdleScanPeriod = -1; httpRequiresSessionId = false; httpHeaders = Collections.emptyMap(); } @@ -1120,14 +1112,6 @@ public boolean awaitHandshake() { public class HttpHandler extends ChannelDuplexHandler { - private Channel channel; - - private long lastSendTime = 0; - - private boolean waitingGet = false; - - private HttpIdleTimer task; - private final String url; private final FutureLatch handShakeFuture = new FutureLatch(); @@ -1148,26 +1132,6 @@ public Map getHeaders() { return headers; } - @Override - public void channelActive(final ChannelHandlerContext ctx) throws Exception { - super.channelActive(ctx); - channel = ctx.channel(); - if (httpClientIdleScanPeriod > 0) { - task = new HttpIdleTimer(); - java.util.concurrent.Future future = scheduledThreadPool.scheduleAtFixedRate(task, httpClientIdleScanPeriod, httpClientIdleScanPeriod, TimeUnit.MILLISECONDS); - task.setFuture(future); - } - } - - @Override - public void channelInactive(final ChannelHandlerContext ctx) throws Exception { - if (task != null) { - task.close(); - } - - super.channelInactive(ctx); - } - @Override public void channelRead(final ChannelHandlerContext ctx, final Object msg) throws Exception { FullHttpResponse response = (FullHttpResponse) msg; @@ -1183,12 +1147,12 @@ public void channelRead(final ChannelHandlerContext ctx, final Object msg) throw active = true; handShakeFuture.run(); } - waitingGet = false; ctx.fireChannelRead(response.content()); } @Override public void write(final ChannelHandlerContext ctx, final Object msg, ChannelPromise promise) throws Exception { + Object toSend = msg; if (msg instanceof ByteBuf buf) { if (httpRequiresSessionId && !active) { if (handshaking) { @@ -1208,48 +1172,9 @@ public void write(final ChannelHandlerContext ctx, final Object msg, ChannelProm httpRequest.headers().add(HttpHeaderNames.COOKIE, cookie); } httpRequest.headers().add(HttpHeaderNames.CONTENT_LENGTH, String.valueOf(buf.readableBytes())); - ctx.write(httpRequest, promise); - lastSendTime = System.currentTimeMillis(); - } else { - ctx.write(msg, promise); - lastSendTime = System.currentTimeMillis(); - } - } - - private class HttpIdleTimer implements Runnable { - - private boolean closed = false; - - private java.util.concurrent.Future future; - - @Override - public synchronized void run() { - if (closed) { - return; - } - - if (!waitingGet && System.currentTimeMillis() > lastSendTime + httpMaxClientIdleTime) { - FullHttpRequest httpRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, url); - httpRequest.headers().add(HttpHeaderNames.HOST, String.format("%s:%d", host, port)); - for (Map.Entry header : headers.entrySet()) { - httpRequest.headers().add(header.getKey(), header.getValue()); - } - waitingGet = true; - channel.writeAndFlush(httpRequest); - } - } - - public synchronized void setFuture(final java.util.concurrent.Future future) { - this.future = future; - } - - public void close() { - if (future != null) { - future.cancel(false); - } - - closed = true; + toSend = httpRequest; } + ctx.write(toSend, promise); } } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java index 2456590795e..85206672a17 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java @@ -44,14 +44,18 @@ public class TransportConstants { public static final String HTTP_ENABLED_PROP_NAME = "httpEnabled"; + @Deprecated(forRemoval = true) public static final String HTTP_CLIENT_IDLE_PROP_NAME = "httpClientIdleTime"; + @Deprecated(forRemoval = true) public static final String HTTP_CLIENT_IDLE_SCAN_PERIOD = "httpClientIdleScanPeriod"; public static final String NETTY_HTTP_HEADER_PREFIX = "nettyHttpHeader."; + @Deprecated(forRemoval = true) public static final String HTTP_RESPONSE_TIME_PROP_NAME = "httpResponseTime"; + @Deprecated(forRemoval = true) public static final String HTTP_SERVER_SCAN_PERIOD_PROP_NAME = "httpServerScanPeriod"; public static final String HTTP_REQUIRES_SESSION_ID = "httpRequiresSessionId"; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java index b0ed7a167ab..9a3e5a14a5d 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java @@ -20,7 +20,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; @@ -43,7 +42,6 @@ import org.apache.activemq.artemis.core.remoting.impl.netty.ConnectionCreator; import org.apache.activemq.artemis.core.remoting.impl.netty.HAProxyMessageEnforcer; import org.apache.activemq.artemis.core.remoting.impl.netty.HttpAcceptorHandler; -import org.apache.activemq.artemis.core.remoting.impl.netty.HttpKeepAliveRunnable; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector; import org.apache.activemq.artemis.core.remoting.impl.netty.NettySNIHostnameHandler; @@ -68,8 +66,6 @@ public class ProtocolHandler { private ScheduledExecutorService scheduledThreadPool; - private HttpKeepAliveRunnable httpKeepAliveRunnable; - private final List websocketSubprotocolIds; public ProtocolHandler(Map protocolMap, @@ -95,16 +91,6 @@ public ChannelHandler getProtocolDecoder() { return new ProtocolDecoder(true, false); } - public HttpKeepAliveRunnable getHttpKeepAliveRunnable() { - return httpKeepAliveRunnable; - } - - public void close() { - if (httpKeepAliveRunnable != null) { - httpKeepAliveRunnable.close(); - } - } - public ProtocolManager getProtocol(String name) { return this.protocolMap.get(name); } @@ -288,16 +274,8 @@ private void switchToHttp(ChannelHandlerContext ctx) { p.addLast("http-decoder", new HttpRequestDecoder()); p.addLast("http-aggregator", new HttpObjectAggregator(Integer.MAX_VALUE)); p.addLast("http-encoder", new HttpResponseEncoder()); - //create it lazily if and when we need it - if (httpKeepAliveRunnable == null) { - long httpServerScanPeriod = ConfigurationHelper.getLongProperty(TransportConstants.HTTP_SERVER_SCAN_PERIOD_PROP_NAME, TransportConstants.DEFAULT_HTTP_SERVER_SCAN_PERIOD, nettyAcceptor.getConfiguration()); - httpKeepAliveRunnable = new HttpKeepAliveRunnable(); - Future future = scheduledThreadPool.scheduleAtFixedRate(httpKeepAliveRunnable, httpServerScanPeriod, httpServerScanPeriod, TimeUnit.MILLISECONDS); - httpKeepAliveRunnable.setFuture(future); - } - long httpResponseTime = ConfigurationHelper.getLongProperty(TransportConstants.HTTP_RESPONSE_TIME_PROP_NAME, TransportConstants.DEFAULT_HTTP_RESPONSE_TIME, nettyAcceptor.getConfiguration()); - HttpAcceptorHandler httpHandler = new HttpAcceptorHandler(httpKeepAliveRunnable, httpResponseTime, ctx.channel()); - ctx.pipeline().addLast(HTTP_HANDLER, httpHandler); + HttpAcceptorHandler httpHandler = new HttpAcceptorHandler(ctx.channel()); + p.addLast(HTTP_HANDLER, httpHandler); p.addLast(new ProtocolDecoder(false, true)); p.remove(this); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpAcceptorHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpAcceptorHandler.java index 2176d606c7d..360eba7a3b3 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpAcceptorHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpAcceptorHandler.java @@ -23,7 +23,6 @@ import java.util.concurrent.TimeUnit; import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import io.netty.channel.Channel; import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandlerContext; @@ -42,39 +41,26 @@ */ public class HttpAcceptorHandler extends ChannelDuplexHandler { - private final BlockingQueue responses = new LinkedBlockingQueue<>(); + private final BlockingQueue responses = new LinkedBlockingQueue<>(); private final BlockingQueue delayedResponses = new LinkedBlockingQueue<>(); private final ExecutorService executor = new ThreadPoolExecutor(1, 1, 0, TimeUnit.SECONDS, delayedResponses); - private final HttpKeepAliveRunnable httpKeepAliveTask; - - private final long responseTime; - private Channel channel; - public HttpAcceptorHandler(final HttpKeepAliveRunnable httpKeepAliveTask, final long responseTime, Channel channel) { + public HttpAcceptorHandler(Channel channel) { super(); - this.responseTime = responseTime; - this.httpKeepAliveTask = httpKeepAliveTask; this.channel = channel; - httpKeepAliveTask.registerKeepAliveHandler(this); } @Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { super.channelInactive(ctx); - httpKeepAliveTask.unregisterKeepAliveHandler(this); + shutdown(); channel = null; } - @Override - public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { - super.handlerRemoved(ctx); - httpKeepAliveTask.unregisterKeepAliveHandler(this); - } - @Override public void channelRead(final ChannelHandlerContext ctx, final Object msg) throws Exception { FullHttpRequest request = (FullHttpRequest) msg; @@ -83,7 +69,7 @@ public void channelRead(final ChannelHandlerContext ctx, final Object msg) throw if (method.equals(HttpMethod.POST)) { ctx.fireChannelRead(ReferenceCountUtil.retain(((FullHttpRequest) msg).content())); // add a new response - responses.put(new ResponseHolder(System.currentTimeMillis() + responseTime, new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK))); + responses.put(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK)); ReferenceCountUtil.release(msg); return; } @@ -100,21 +86,6 @@ public void write(final ChannelHandlerContext ctx, final Object msg, ChannelProm } } - public void keepAlive(final long time) { - // send some responses to catch up thus avoiding any timeout. - int lateResponses = 0; - for (ResponseHolder response : responses) { - if (response.timeReceived < time) { - lateResponses++; - } else { - break; - } - } - for (int i = 0; i < lateResponses; i++) { - executor.execute(new ResponseRunner()); - } - } - /** * this is prompted to delivery when a response is available in the response queue. */ @@ -132,32 +103,26 @@ final class ResponseRunner implements Runnable { this.promise = promise; } - ResponseRunner() { - bogusResponse = true; - buffer = Unpooled.buffer(0); - promise = channel.newPromise(); - } - @Override public void run() { - ResponseHolder responseHolder = null; + FullHttpResponse response = null; do { try { - responseHolder = responses.take(); + response = responses.take(); } catch (InterruptedException e) { if (executor.isShutdown()) return; // otherwise ignore, we'll just try again } } - while (responseHolder == null); + while (response == null); if (!bogusResponse) { - piggyBackResponses(responseHolder.response.content()); + piggyBackResponses(response.content()); } else { - responseHolder.response.content().writeBytes(buffer); + response.content().writeBytes(buffer); } - responseHolder.response.headers().set(HttpHeaderNames.CONTENT_LENGTH, String.valueOf(responseHolder.response.content().readableBytes())); - channel.writeAndFlush(responseHolder.response, promise); + response.headers().set(HttpHeaderNames.CONTENT_LENGTH, String.valueOf(response.content().readableBytes())); + channel.writeAndFlush(response, promise); buffer.release(); @@ -199,20 +164,4 @@ public void shutdown() { } responses.clear(); } - - /** - * a holder class so we know what time the request first arrived - */ - private static final class ResponseHolder { - - final FullHttpResponse response; - - final long timeReceived; - - private ResponseHolder(final long timeReceived, final FullHttpResponse response) { - this.timeReceived = timeReceived; - this.response = response; - } - } - } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpKeepAliveRunnable.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpKeepAliveRunnable.java deleted file mode 100644 index 0cbee526c04..00000000000 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpKeepAliveRunnable.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.artemis.core.remoting.impl.netty; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.Future; - -/** - * A simple Runnable to allow {@link HttpAcceptorHandler}s to be called intermittently. - */ -public class HttpKeepAliveRunnable implements Runnable { - - private final List handlers = new ArrayList<>(); - - private boolean closed = false; - - private Future future; - - @Override - public synchronized void run() { - if (closed) { - return; - } - - long time = System.currentTimeMillis(); - for (HttpAcceptorHandler handler : handlers) { - handler.keepAlive(time); - } - } - - public List getHandlers() { - return Collections.unmodifiableList(handlers); - } - - public synchronized void registerKeepAliveHandler(final HttpAcceptorHandler httpAcceptorHandler) { - handlers.add(httpAcceptorHandler); - } - - public synchronized void unregisterKeepAliveHandler(final HttpAcceptorHandler httpAcceptorHandler) { - handlers.remove(httpAcceptorHandler); - httpAcceptorHandler.shutdown(); - } - - public void close() { - for (HttpAcceptorHandler handler : handlers) { - handler.shutdown(); - } - if (future != null) { - future.cancel(true); - } - - closed = true; - } - - public synchronized void setFuture(final Future future) { - this.future = future; - } -} diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java index 7770a0ac22b..e4fb9fd2188 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java @@ -786,10 +786,6 @@ public synchronized void asyncStop(Runnable callback) { } try { - if (protocolHandler != null) { - protocolHandler.close(); - } - if (batchFlusherFuture != null) { batchFlusherFuture.cancel(false); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpAcceptorHandlerTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpAcceptorHandlerTest.java deleted file mode 100644 index a23d0f27318..00000000000 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpAcceptorHandlerTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.artemis.core.remoting.impl.netty; - -import io.netty.channel.embedded.EmbeddedChannel; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mockito; -import org.mockito.junit.jupiter.MockitoExtension; - -import static org.mockito.Mockito.spy; - -@ExtendWith(MockitoExtension.class) -public class HttpAcceptorHandlerTest { - - private static final String HTTP_HANDLER = "http-handler"; - - private HttpKeepAliveRunnable spy; - - @BeforeEach - public void setUp() throws Exception { - spy = spy(new HttpKeepAliveRunnable()); - } - - @Test - public void testUnregisterIsCalledTwiceWhenChannelIsInactive() { - EmbeddedChannel channel = new EmbeddedChannel(); - - HttpAcceptorHandler httpHandler = new HttpAcceptorHandler(spy, 1000, channel); - channel.pipeline().addLast(HTTP_HANDLER, httpHandler); - - channel.close(); - - Mockito.verify(spy, Mockito.times(2)).unregisterKeepAliveHandler(httpHandler); - } - - @Test - public void testUnregisterIsCalledWhenHandlerIsRemovedFromPipeline() { - EmbeddedChannel channel = new EmbeddedChannel(); - - HttpAcceptorHandler httpHandler = new HttpAcceptorHandler(spy, 1000, channel); - channel.pipeline().addLast(HTTP_HANDLER, httpHandler); - - channel.pipeline().remove(HTTP_HANDLER); - - Mockito.verify(spy).unregisterKeepAliveHandler(httpHandler); - } -} diff --git a/docs/user-manual/configuring-transports.adoc b/docs/user-manual/configuring-transports.adoc index 9a364be7244..1cc7bce5076 100644 --- a/docs/user-manual/configuring-transports.adoc +++ b/docs/user-manual/configuring-transports.adoc @@ -507,21 +507,9 @@ Activates HTTP on the client. This is not needed on the broker. With single port support the broker will now automatically detect if HTTP is being used and configure itself. -httpClientIdleTime:: -How long a client can be idle before sending an empty HTTP request to keep the connection alive - -httpClientIdleScanPeriod:: -How often, in milliseconds, to scan for idle clients - -httpResponseTime:: -How long the server can wait before sending an empty HTTP response to keep the connection alive - -httpServerScanPeriod:: -How often, in milliseconds, to scan for clients needing responses - httpRequiresSessionId:: If `true` the client will wait after the first call to receive a session id. -Used the HTTP connector is connecting to servlet acceptor (not recommended) +Used when the HTTP connector is connecting to servlet acceptor (not recommended). === Configuring Netty SOCKS Proxy diff --git a/docs/user-manual/versions.adoc b/docs/user-manual/versions.adoc index 661d5afde62..3a9fa80d3f6 100644 --- a/docs/user-manual/versions.adoc +++ b/docs/user-manual/versions.adoc @@ -28,6 +28,16 @@ https://artemis.apache.org/artemis-tlp-groupid-migration[Click here] for more de * Due to https://issues.apache.org/jira/browse/ARTEMIS-5770[ARTEMIS-5770] the formatting of the "Local Address" field has changed. This field is available on the "Connections," "Sessions," "Consumers," and "Producers" tabs. This may impact users filtering results based on this field. +* Due to https://issues.apache.org/jira/browse/ARTEMIS-5819[ARTEMIS-5819] the following HTTP-specific transport configuration parameters have been deprecated: +** `httpClientIdleTime` +** `httpClientIdleScanPeriod` +** `httpResponseTime` +** `httpServerScanPeriod` + ++ + +The functionality previously provided via these parameters was non-functional and ultimately unnecessary. +Idle connection management should be done through xref:connection-ttl.adoc#detecting-dead-connections[existing parameters]. == 2.44.0 diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/WebSocketConnectionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/WebSocketConnectionTest.java index 867bc4cb528..200519d5429 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/WebSocketConnectionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/WebSocketConnectionTest.java @@ -16,9 +16,6 @@ */ package org.apache.activemq.artemis.tests.integration.amqp; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; @@ -26,11 +23,12 @@ import javax.jms.Queue; import javax.jms.Session; -import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor; import org.apache.qpid.jms.JmsConnection; import org.apache.qpid.jms.JmsConnectionFactory; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertNotNull; + /** * Test connections can be established to remote peers via WebSockets */ @@ -46,8 +44,6 @@ public void testSingleKeepAliveIsReleasedWhenWebSocketUpgradeHappens() throws Ex JmsConnectionFactory factory = new JmsConnectionFactory(getBrokerQpidJMSConnectionURI()); produceAndConsumeInNewConnection(factory); - - assertKeepAliveCounterIsZero(); } @Test @@ -59,8 +55,6 @@ public void testMultipleKeepAliveAreReleasedWhenWebSocketUpgradeHappens() throws produceAndConsumeInNewConnection(factory); produceAndConsumeInNewConnection(factory); produceAndConsumeInNewConnection(factory); - - assertKeepAliveCounterIsZero(); } private void produceAndConsumeInNewConnection(JmsConnectionFactory factory) throws JMSException { @@ -84,12 +78,4 @@ private void produceAndConsumeInNewConnection(JmsConnectionFactory factory) thro connection.close(); } } - - private void assertKeepAliveCounterIsZero() { - NettyAcceptor nettyAcceptor = (NettyAcceptor) server.getRemotingService().getAcceptor(NETTY_ACCEPTOR); - - int httpAcceptorHandlerCount = nettyAcceptor.getProtocolHandler().getHttpKeepAliveRunnable().getHandlers().size(); - - assertEquals(0, httpAcceptorHandlerCount); - } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/http/CoreClientOverHttpTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/http/CoreClientOverHttpTest.java index f0e23cc07b7..64d6d7c11b9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/http/CoreClientOverHttpTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/http/CoreClientOverHttpTest.java @@ -55,7 +55,7 @@ public void setUp() throws Exception { Map params = new HashMap<>(); params.put(TransportConstants.HTTP_ENABLED_PROP_NAME, true); - conf = createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params)); + conf = createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY)); server = addServer(ActiveMQServers.newActiveMQServer(conf, false)); server.start();