private void waitForOnMessageToComplete(boolean waitForOnMessage) { if (handler == null) { return; } if (!waitForOnMessage || Thread.currentThread() == onMessageThread) { // If called from inside onMessage then return immediately - otherwise would block return; } FutureLatch future = new FutureLatch(); sessionExecutor.execute(future); boolean ok = future.await(ClientConsumerImpl.CLOSE_TIMEOUT_MILLISECONDS); if (!ok) { ActiveMQClientLogger.LOGGER.timeOutWaitingForProcessing(); } }
@Override public void write(final ChannelHandlerContext ctx, final Object msg, ChannelPromise promise) throws Exception { if (msg instanceof ByteBuf) { if (httpRequiresSessionId && !active) { if (handshaking) { handshaking = true; } else { if (!handShakeFuture.await(5000)) { throw new RuntimeException("Handshake failed after timeout"); } } } ByteBuf buf = (ByteBuf) msg; FullHttpRequest httpRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, url, buf); httpRequest.headers().add(HttpHeaderNames.HOST, NettyConnector.this.host); if (cookie != null) { 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(); } }
@Override public void flushExecutor() { // Wait for any create objects runnable to complete FutureLatch future = new FutureLatch(); executor.execute(future); boolean ok = future.await(10000); if (!ok) { ActiveMQServerLogger.LOGGER.timedOutWaitingToStopBridge(); } }
private void waitForOnMessageToComplete(boolean waitForOnMessage) { if (handler == null) { return; } if (!waitForOnMessage || Thread.currentThread() == onMessageThread) { // If called from inside onMessage then return immediately - otherwise would block return; } FutureLatch future = new FutureLatch(); sessionExecutor.execute(future); boolean ok = future.await(ClientConsumerImpl.CLOSE_TIMEOUT_MILLISECONDS); if (!ok) { ActiveMQClientLogger.LOGGER.timeOutWaitingForProcessing(); } }
private void waitForOnMessageToComplete(boolean waitForOnMessage) { if (handler == null) { return; } if (!waitForOnMessage || Thread.currentThread() == onMessageThread) { // If called from inside onMessage then return immediately - otherwise would block return; } FutureLatch future = new FutureLatch(); sessionExecutor.execute(future); boolean ok = future.await(ClientConsumerImpl.CLOSE_TIMEOUT_MILLISECONDS); if (!ok) { ActiveMQClientLogger.LOGGER.timeOutWaitingForProcessing(); } }
private void waitForOnMessageToComplete(boolean waitForOnMessage) { if (handler == null) { return; } if (!waitForOnMessage || Thread.currentThread() == onMessageThread) { // If called from inside onMessage then return immediately - otherwise would block return; } FutureLatch future = new FutureLatch(); sessionExecutor.execute(future); boolean ok = future.await(ClientConsumerImpl.CLOSE_TIMEOUT_MILLISECONDS); if (!ok) { ActiveMQClientLogger.LOGGER.timeOutWaitingForProcessing(); } }
private void waitForOnMessageToComplete(boolean waitForOnMessage) { if (handler == null) { return; } if (!waitForOnMessage || Thread.currentThread() == onMessageThread) { // If called from inside onMessage then return immediately - otherwise would block return; } FutureLatch future = new FutureLatch(); sessionExecutor.execute(future); boolean ok = future.await(ClientConsumerImpl.CLOSE_TIMEOUT_MILLISECONDS); if (!ok) { ActiveMQClientLogger.LOGGER.timeOutWaitingForProcessing(); } }
private void waitForOnMessageToComplete(boolean waitForOnMessage) { if (handler == null) { return; } if (!waitForOnMessage || Thread.currentThread() == onMessageThread) { // If called from inside onMessage then return immediately - otherwise would block return; } FutureLatch future = new FutureLatch(); sessionExecutor.execute(future); boolean ok = future.await(ClientConsumerImpl.CLOSE_TIMEOUT_MILLISECONDS); if (!ok) { ActiveMQClientLogger.LOGGER.timeOutWaitingForProcessing(); } }
private void waitForOnMessageToComplete(boolean waitForOnMessage) { if (handler == null) { return; } if (!waitForOnMessage || Thread.currentThread() == onMessageThread) { // If called from inside onMessage then return immediately - otherwise would block return; } FutureLatch future = new FutureLatch(); sessionExecutor.execute(future); boolean ok = future.await(ClientConsumerImpl.CLOSE_TIMEOUT_MILLISECONDS); if (!ok) { ActiveMQClientLogger.LOGGER.timeOutWaitingForProcessing(); } }
@Override public void write(final ChannelHandlerContext ctx, final Object msg, ChannelPromise promise) throws Exception { if (msg instanceof ByteBuf) { if (httpRequiresSessionId && !active) { if (handshaking) { handshaking = true; } else { if (!handShakeFuture.await(5000)) { throw new RuntimeException("Handshake failed after timeout"); } } } ByteBuf buf = (ByteBuf) msg; FullHttpRequest httpRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, url, buf); httpRequest.headers().add(HttpHeaderNames.HOST, NettyConnector.this.host); if (cookie != null) { 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(); } }
@Override public void write(final ChannelHandlerContext ctx, final Object msg, ChannelPromise promise) throws Exception { if (msg instanceof ByteBuf) { if (httpRequiresSessionId && !active) { if (handshaking) { handshaking = true; } else { if (!handShakeFuture.await(5000)) { throw new RuntimeException("Handshake failed after timeout"); } } } ByteBuf buf = (ByteBuf) msg; FullHttpRequest httpRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, url, buf); httpRequest.headers().add(HttpHeaderNames.HOST, NettyConnector.this.host); if (cookie != null) { 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(); } }
@Override public void write(final ChannelHandlerContext ctx, final Object msg, ChannelPromise promise) throws Exception { if (msg instanceof ByteBuf) { if (httpRequiresSessionId && !active) { if (handshaking) { handshaking = true; } else { if (!handShakeFuture.await(5000)) { throw new RuntimeException("Handshake failed after timeout"); } } } ByteBuf buf = (ByteBuf) msg; FullHttpRequest httpRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, url, buf); httpRequest.headers().add(HttpHeaderNames.HOST, NettyConnector.this.host); if (cookie != null) { 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(); } }
@Override public void write(final ChannelHandlerContext ctx, final Object msg, ChannelPromise promise) throws Exception { if (msg instanceof ByteBuf) { if (httpRequiresSessionId && !active) { if (handshaking) { handshaking = true; } else { if (!handShakeFuture.await(5000)) { throw new RuntimeException("Handshake failed after timeout"); } } } ByteBuf buf = (ByteBuf) msg; FullHttpRequest httpRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, url, buf); httpRequest.headers().add(HttpHeaderNames.HOST, NettyConnector.this.host); if (cookie != null) { 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(); } }
@Override public void write(final ChannelHandlerContext ctx, final Object msg, ChannelPromise promise) throws Exception { if (msg instanceof ByteBuf) { if (httpRequiresSessionId && !active) { if (handshaking) { handshaking = true; } else { if (!handShakeFuture.await(5000)) { throw new RuntimeException("Handshake failed after timeout"); } } } ByteBuf buf = (ByteBuf) msg; FullHttpRequest httpRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, url, buf); httpRequest.headers().add(HttpHeaderNames.HOST, NettyConnector.this.host); if (cookie != null) { 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(); } }
@Override public void flushExecutor() { FutureLatch future = new FutureLatch(); executor.execute(future); if (!future.await(10000)) { ActiveMQServerLogger.LOGGER.couldNotFinishExecutor(this.toString()); server.threadDump(); } }
public void flushExecutor() { FutureLatch future = new FutureLatch(); executor.execute(future); if (!future.await(10000)) { ActiveMQServerLogger.LOGGER.couldNotFlushClusterManager(this.toString()); server.threadDump(); } }
private void awaitExecution() { FutureLatch future = new FutureLatch(); executor.execute(future); future.await(10000); }
@Override public void flushExecutors() { cursorProvider.flushExecutors(); FutureLatch future = new FutureLatch(); executor.execute(future); if (!future.await(60000)) { ActiveMQServerLogger.LOGGER.pageStoreTimeout(address); } }
@Override public void setTransferring(final boolean transferring) { synchronized (lock) { // This is to make sure that the delivery process has finished any pending delivery // otherwise a message may sneak in on the client while we are trying to stop the consumer boolean locked = lockDelivery(); try { this.transferring = transferring; } finally { if (locked) { lockDelivery.writeLock().unlock(); } } } // Outside the lock if (transferring) { // And we must wait for any force delivery to be executed - this is executed async so we add a future to the // executor and // wait for it to complete FutureLatch future = new FutureLatch(); messageQueue.getExecutor().execute(future); boolean ok = future.await(10000); if (!ok) { ActiveMQServerLogger.LOGGER.errorTransferringConsumer(); } } if (!transferring) { promptDelivery(); } }
@Override public void write(final ChannelHandlerContext ctx, final Object msg, ChannelPromise promise) throws Exception { if (msg instanceof ByteBuf) { if (httpRequiresSessionId && !active) { if (handshaking) { handshaking = true; } else { if (!handShakeFuture.await(5000)) { throw new RuntimeException("Handshake failed after timeout"); } } } ByteBuf buf = (ByteBuf) msg; FullHttpRequest httpRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, url, buf); httpRequest.headers().add(HttpHeaderNames.HOST, NettyConnector.this.host); if (cookie != null) { 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(); } }