Source:
private void internalSend(ActiveMQDestination[] actualDestinations, ServerMessage originalCoreMsg, final Runnable onComplete) throws Exception { Runnable runToUse; if (actualDestinations.length <= 1 || onComplete == null) { runToUse = onComplete; } else { final AtomicInteger count = new AtomicInteger(actualDestinations.length); runToUse = new Runnable() { @Override public void run() { if (count.decrementAndGet() == 0) { onComplete.run(); } } }; } SimpleString[] addresses = new SimpleString[actualDestinations.length]; PagingStore[] pagingStores = new PagingStore[actualDestinations.length]; for (int i = 0; i < actualDestinations.length; i++) { ActiveMQDestination dest = actualDestinations[i]; addresses[i] = OpenWireUtil.toCoreAddress(dest); pagingStores[i] = server.getPagingManager().getPageStore(addresses[i]); if (pagingStores[i].getAddressFullMessagePolicy() == AddressFullMessagePolicy.FAIL && pagingStores[i].isFull()) { throw new ResourceAllocationException("Queue is full"); } } for (int i = 0; i < actualDestinations.length; i++) { ServerMessage coreMsg = originalCoreMsg.copy(); coreMsg.setAddress(addresses[i]); PagingStore store = pagingStores[i]; if (store.isFull()) { connection.getTransportConnection().setAutoRead(false); } QueueQueryResult result = getCoreSession().executeQueueQuery(addresses[i]); if (!result.isExists() && actualDestinations[i].isQueue()) { if (!result.isAutoCreateJmsQueues() || actualDestinations[i].isTemporary()) { throw new Exception("Cannot publish to a deleted Destination: " + actualDestinations[i]); } } getCoreSession().send(coreMsg, false); if (runToUse != null) { store.checkMemory(runToUse); } } }

Target:
private void internalSend(ActiveMQDestination[] actualDestinations, ServerMessage originalCoreMsg, final Runnable onComplete) throws Exception { Runnable runToUse; if (actualDestinations.length <= 1 || onComplete == null) { runToUse = onComplete; } else { final AtomicInteger count = new AtomicInteger(actualDestinations.length); runToUse = new Runnable() { @Override public void run() { if (count.decrementAndGet() == 0) { onComplete.run(); } } }; } SimpleString[] addresses = new SimpleString[actualDestinations.length]; PagingStore[] pagingStores = new PagingStore[actualDestinations.length]; for (int i = 0; i < actualDestinations.length; i++) { ActiveMQDestination dest = actualDestinations[i]; addresses[i] = OpenWireUtil.toCoreAddress(dest); pagingStores[i] = server.getPagingManager().getPageStore(addresses[i]); if (pagingStores[i].getAddressFullMessagePolicy() == AddressFullMessagePolicy.FAIL && pagingStores[i].isFull()) { throw new ResourceAllocationException("Queue is full"); } } for (int i = 0; i < actualDestinations.length; i++) { ServerMessage coreMsg = originalCoreMsg.copy(); coreMsg.setAddress(addresses[i]); PagingStore store = pagingStores[i]; if (store.isFull()) { connection.getTransportConnection().setAutoRead(false); } RoutingStatus result = getCoreSession().send(coreMsg, false, actualDestinations[i].isTemporary()); if (result == RoutingStatus.NO_BINDINGS && actualDestinations[i].isQueue()) { throw new InvalidDestinationException("Cannot publish to a non-existent Destination: " + actualDestinations[i]); } if (runToUse != null) { store.checkMemory(runToUse); } } }