@Override public void duplicateFromStore(Message message, Subscription subscription) { ConnectionContext connectionContext = createConnectionContext(); getLog().warn("{}{}, redirecting {} for dlq processing", DUPLICATE_FROM_STORE_MSG_PREFIX, destination, message.getMessageId()); Throwable cause = new Throwable(DUPLICATE_FROM_STORE_MSG_PREFIX + destination); message.setRegionDestination(this); broker.getRoot().sendToDeadLetterQueue(connectionContext, message, null, cause); MessageAck messageAck = new MessageAck(message, MessageAck.POSION_ACK_TYPE, 1); messageAck.setPoisonCause(cause); try { acknowledge(connectionContext, subscription, messageAck, message); } catch (IOException e) { getLog().error("Failed to acknowledge duplicate message {} from {} with {}", message.getMessageId(), destination, messageAck); } }
protected final void waitForSpace(ConnectionContext context, ProducerBrokerExchange producerBrokerExchange, Usage<?> usage, int highWaterMark, String warning) throws IOException, InterruptedException, ResourceAllocationException { if (!context.isNetworkConnection() && systemUsage.isSendFailIfNoSpace()) { if (isFlowControlLogRequired()) { getLog().info("sendFailIfNoSpace, forcing exception on send, usage: {}: {}", usage, warning); } else { getLog().debug("sendFailIfNoSpace, forcing exception on send, usage: {}: {}", usage, warning); if (!usage.waitForSpace(systemUsage.getSendFailIfNoSpaceAfterTimeout(), highWaterMark)) { if (isFlowControlLogRequired()) { getLog().info("sendFailIfNoSpaceAfterTimeout expired, forcing exception on send, usage: {}: {}", usage, warning); } else { getLog().debug("sendFailIfNoSpaceAfterTimeout expired, forcing exception on send, usage: {}: {}", usage, warning); getLog().warn("{}: {} (blocking for: {}s)", new Object[]{ usage, warning, new Long(((System.currentTimeMillis() - start) / 1000))}); } else { getLog().debug("{}: {} (blocking for: {}s)", new Object[]{ usage, warning, new Long(((System.currentTimeMillis() - start) / 1000))});
Logger log = LOG; if (dest instanceof BaseDestination) { log = ((BaseDestination) dest).getLog();
protected final void waitForSpace(ConnectionContext context, Usage<?> usage, int highWaterMark, String warning) throws IOException, InterruptedException, ResourceAllocationException { if (systemUsage.isSendFailIfNoSpace()) { getLog().debug("sendFailIfNoSpace, forcing exception on send: " + warning); throw new ResourceAllocationException(warning); } if (systemUsage.getSendFailIfNoSpaceAfterTimeout() != 0) { if (!usage.waitForSpace(systemUsage.getSendFailIfNoSpaceAfterTimeout(), highWaterMark)) { getLog().debug("sendFailIfNoSpaceAfterTimeout expired, forcing exception on send: " + warning); throw new ResourceAllocationException(warning); } } else { long start = System.currentTimeMillis(); long nextWarn = start; while (!usage.waitForSpace(1000, highWaterMark)) { if (context.getStopping().get()) { throw new IOException("Connection closed, send aborted."); } long now = System.currentTimeMillis(); if (now >= nextWarn) { getLog().info(warning + " (blocking for: " + (now - start) / 1000 + "s)"); nextWarn = now + blockedProducerWarningInterval; } } } }
@Override public void duplicateFromStore(Message message, Subscription durableSub) { ConnectionContext connectionContext = createConnectionContext(); getLog().warn("duplicate message from store {}, redirecting for dlq processing", message.getMessageId()); Throwable cause = new Throwable("duplicate from store for " + destination); message.setRegionDestination(this); broker.getRoot().sendToDeadLetterQueue(connectionContext, message, null, cause); MessageAck messageAck = new MessageAck(message, MessageAck.POSION_ACK_TYPE, 1); messageAck.setPoisonCause(cause); try { acknowledge(connectionContext, durableSub, messageAck, message); } catch (IOException e) { getLog().error("Failed to acknowledge duplicate message {} from {} with {}", message.getMessageId(), destination, messageAck); } }
@Override public void duplicateFromStore(Message message, Subscription durableSub) { ConnectionContext connectionContext = createConnectionContext(); getLog().warn("duplicate message from store {}, redirecting for dlq processing", message.getMessageId()); Throwable cause = new Throwable("duplicate from store for " + destination); message.setRegionDestination(this); broker.getRoot().sendToDeadLetterQueue(connectionContext, message, null, cause); MessageAck messageAck = new MessageAck(message, MessageAck.POSION_ACK_TYPE, 1); messageAck.setPoisonCause(cause); try { acknowledge(connectionContext, durableSub, messageAck, message); } catch (IOException e) { getLog().error("Failed to acknowledge duplicate message {} from {} with {}", message.getMessageId(), destination, messageAck); } }
@Override public void duplicateFromStore(Message message, Subscription durableSub) { ConnectionContext connectionContext = createConnectionContext(); getLog().warn("duplicate message from store {}, redirecting for dlq processing", message.getMessageId()); Throwable cause = new Throwable("duplicate from store for " + destination); message.setRegionDestination(this); broker.getRoot().sendToDeadLetterQueue(connectionContext, message, null, cause); MessageAck messageAck = new MessageAck(message, MessageAck.POSION_ACK_TYPE, 1); messageAck.setPoisonCause(cause); try { acknowledge(connectionContext, durableSub, messageAck, message); } catch (IOException e) { getLog().error("Failed to acknowledge duplicate message {} from {} with {}", message.getMessageId(), destination, messageAck); } }
protected final void waitForSpace(ConnectionContext context, ProducerBrokerExchange producerBrokerExchange, Usage<?> usage, int highWaterMark, String warning) throws IOException, InterruptedException, ResourceAllocationException { if (!context.isNetworkConnection() && systemUsage.isSendFailIfNoSpace()) { getLog().debug("sendFailIfNoSpace, forcing exception on send, usage: {}: {}", usage, warning); throw new ResourceAllocationException(warning); } if (!context.isNetworkConnection() && systemUsage.getSendFailIfNoSpaceAfterTimeout() != 0) { if (!usage.waitForSpace(systemUsage.getSendFailIfNoSpaceAfterTimeout(), highWaterMark)) { getLog().debug("sendFailIfNoSpaceAfterTimeout expired, forcing exception on send, usage: {}: {}", usage, warning); throw new ResourceAllocationException(warning); } } else { long start = System.currentTimeMillis(); producerBrokerExchange.blockingOnFlowControl(true); destinationStatistics.getBlockedSends().increment(); while (!usage.waitForSpace(1000, highWaterMark)) { if (context.getStopping().get()) { throw new IOException("Connection closed, send aborted."); } if (isFlowControlLogRequired()) { getLog().info("{}: {} (blocking for: {}s)", new Object[]{ usage, warning, new Long(((System.currentTimeMillis() - start) / 1000))}); } } long finish = System.currentTimeMillis(); long totalTimeBlocked = finish - start; destinationStatistics.getBlockedTime().addTime(totalTimeBlocked); producerBrokerExchange.incrementTimeBlocked(this,totalTimeBlocked); producerBrokerExchange.blockingOnFlowControl(false); } }
Logger log = LOG; if (dest instanceof BaseDestination) { log = ((BaseDestination) dest).getLog();
protected final void waitForSpace(ConnectionContext context, ProducerBrokerExchange producerBrokerExchange, Usage<?> usage, int highWaterMark, String warning) throws IOException, InterruptedException, ResourceAllocationException { if (!context.isNetworkConnection() && systemUsage.isSendFailIfNoSpace()) { getLog().debug("sendFailIfNoSpace, forcing exception on send, usage: {}: {}", usage, warning); throw new ResourceAllocationException(warning); } if (!context.isNetworkConnection() && systemUsage.getSendFailIfNoSpaceAfterTimeout() != 0) { if (!usage.waitForSpace(systemUsage.getSendFailIfNoSpaceAfterTimeout(), highWaterMark)) { getLog().debug("sendFailIfNoSpaceAfterTimeout expired, forcing exception on send, usage: {}: {}", usage, warning); throw new ResourceAllocationException(warning); } } else { long start = System.currentTimeMillis(); producerBrokerExchange.blockingOnFlowControl(true); destinationStatistics.getBlockedSends().increment(); while (!usage.waitForSpace(1000, highWaterMark)) { if (context.getStopping().get()) { throw new IOException("Connection closed, send aborted."); } if (isFlowControlLogRequired()) { getLog().info("{}: {} (blocking for: {}s)", new Object[]{ usage, warning, new Long(((System.currentTimeMillis() - start) / 1000))}); } } long finish = System.currentTimeMillis(); long totalTimeBlocked = finish - start; destinationStatistics.getBlockedTime().addTime(totalTimeBlocked); producerBrokerExchange.incrementTimeBlocked(this,totalTimeBlocked); producerBrokerExchange.blockingOnFlowControl(false); } }
protected final void waitForSpace(ConnectionContext context, ProducerBrokerExchange producerBrokerExchange, Usage<?> usage, int highWaterMark, String warning) throws IOException, InterruptedException, ResourceAllocationException { if (!context.isNetworkConnection() && systemUsage.isSendFailIfNoSpace()) { getLog().debug("sendFailIfNoSpace, forcing exception on send, usage: {}: {}", usage, warning); throw new ResourceAllocationException(warning); } if (!context.isNetworkConnection() && systemUsage.getSendFailIfNoSpaceAfterTimeout() != 0) { if (!usage.waitForSpace(systemUsage.getSendFailIfNoSpaceAfterTimeout(), highWaterMark)) { getLog().debug("sendFailIfNoSpaceAfterTimeout expired, forcing exception on send, usage: {}: {}", usage, warning); throw new ResourceAllocationException(warning); } } else { long start = System.currentTimeMillis(); producerBrokerExchange.blockingOnFlowControl(true); destinationStatistics.getBlockedSends().increment(); while (!usage.waitForSpace(1000, highWaterMark)) { if (context.getStopping().get()) { throw new IOException("Connection closed, send aborted."); } if (isFlowControlLogRequired()) { getLog().info("{}: {} (blocking for: {}s)", new Object[]{ usage, warning, new Long(((System.currentTimeMillis() - start) / 1000))}); } } long finish = System.currentTimeMillis(); long totalTimeBlocked = finish - start; destinationStatistics.getBlockedTime().addTime(totalTimeBlocked); producerBrokerExchange.incrementTimeBlocked(this,totalTimeBlocked); producerBrokerExchange.blockingOnFlowControl(false); } }
Logger log = LOG; if (dest instanceof BaseDestination) { log = ((BaseDestination) dest).getLog();
Logger log = LOG; if (dest instanceof BaseDestination) { log = ((BaseDestination) dest).getLog();
dest.getLog().info( dest.getName() + " Inactive for longer than " + dest.getInactiveTimoutBeforeGC() + " ms - removing ...");