private void registerRemoveSync(ConnectionContext context, final MessageReference node) { // setup a Synchronization to remove nodes from the // dispatched list. context.getTransaction().addSynchronization( new Synchronization() { @Override public void afterCommit() throws Exception { Destination nodeDest = (Destination) node.getRegionDestination(); synchronized (dispatchLock) { getSubscriptionStatistics().getDequeues().increment(); if (dispatched.remove(node)) { // if consumer is removed, dispatched will be empty and inflight will // already have been adjusted getSubscriptionStatistics().getInflightMessageSize().addSize(-node.getSize()); nodeDest.getDestinationStatistics().getInflight().decrement(); } } contractPrefetchExtension(1); nodeDest.wakeup(); dispatchPending(); } @Override public void afterRollback() throws Exception { contractPrefetchExtension(1); } }); }
private void updateStatsOnAck(final ConnectionContext context, final MessageAck ack) { if (context.isInTransaction()) { context.getTransaction().addSynchronization(new Synchronization() { @Override public void afterRollback() { contractPrefetchExtension(ack.getMessageCount()); } @Override public void afterCommit() throws Exception { contractPrefetchExtension(ack.getMessageCount()); updateStatsOnAck(ack); dispatchMatched(); } }); } else { updateStatsOnAck(ack); } }
private void registerSync(ActiveMQDestination destination, Transaction transaction, BaseCommand command) { Synchronization sync = new PreparedDestinationCompletion(this, destination, command.isMessage()); // ensure one per destination in the list Synchronization existing = transaction.findMatching(sync); if (existing != null) { ((PreparedDestinationCompletion)existing).incrementOpCount(); } else { transaction.addSynchronization(sync); } }
context.getTransaction().addSynchronization(new Synchronization() { public void afterCommit() throws Exception { if (debug) {
context.getTransaction().addSynchronization(new Synchronization() { public void afterCommit() throws Exception { if (debug) {
acknowledge(context, sub, ack, reference); } finally { context.getTransaction().addSynchronization(new Synchronization() {
private boolean tryOrderedCursorAdd(Message message, ConnectionContext context) throws Exception { boolean result = true; if (context.isInTransaction()) { context.getTransaction().addSynchronization(new CursorAddSync(new MessageContext(context, message, null))); } else if (store != null && message.isPersistent()) { doPendingCursorAdditions(); } else { // no ordering issue with non persistent messages result = tryCursorAdd(message); messageSent(context, message); } return result; }
context.getTransaction().addSynchronization(new Synchronization() { @Override public void afterCommit() throws Exception {
context.getTransaction().addSynchronization(new Synchronization() { @Override public void afterCommit() throws Exception {
context.getTransaction().addSynchronization(new Synchronization() { @Override public void afterCommit() throws Exception {
private void registerRemoveSync(ConnectionContext context, final MessageReference node) { // setup a Synchronization to remove nodes from the // dispatched list. context.getTransaction().addSynchronization( new Synchronization() { @Override public void afterCommit() throws Exception { Destination nodeDest = (Destination) node.getRegionDestination(); synchronized (dispatchLock) { getSubscriptionStatistics().getDequeues().increment(); dispatched.remove(node); getSubscriptionStatistics().getInflightMessageSize().addSize(-node.getSize()); nodeDest.getDestinationStatistics().getInflight().decrement(); } contractPrefetchExtension(1); nodeDest.wakeup(); dispatchPending(); } @Override public void afterRollback() throws Exception { contractPrefetchExtension(1); } }); }
private void updateStatsOnAck(final ConnectionContext context, final MessageAck ack) { if (context.isInTransaction()) { context.getTransaction().addSynchronization(new Synchronization() { @Override public void afterRollback() { contractPrefetchExtension(ack.getMessageCount()); } @Override public void afterCommit() throws Exception { contractPrefetchExtension(ack.getMessageCount()); updateStatsOnAck(ack); dispatchMatched(); } }); } else { updateStatsOnAck(ack); } }
private void updateStatsOnAck(final ConnectionContext context, final MessageAck ack) { if (context.isInTransaction()) { context.getTransaction().addSynchronization(new Synchronization() { @Override public void afterRollback() { contractPrefetchExtension(ack.getMessageCount()); } @Override public void afterCommit() throws Exception { contractPrefetchExtension(ack.getMessageCount()); updateStatsOnAck(ack); dispatchMatched(); } }); } else { updateStatsOnAck(ack); } }
private void updateStatsOnAck(final ConnectionContext context, final MessageAck ack) { if (context.isInTransaction()) { context.getTransaction().addSynchronization(new Synchronization() { @Override public void afterRollback() { contractPrefetchExtension(ack.getMessageCount()); } @Override public void afterCommit() throws Exception { contractPrefetchExtension(ack.getMessageCount()); updateStatsOnAck(ack); dispatchMatched(); } }); } else { updateStatsOnAck(ack); } }
private void registerSync(Destination destination, Transaction transaction, BaseCommand command) { Synchronization sync = new PreparedDestinationCompletion(destination, command.isMessage()); // ensure one per destination in the list Synchronization existing = transaction.findMatching(sync); if (existing != null) { ((PreparedDestinationCompletion)existing).incrementOpCount(); } else { transaction.addSynchronization(sync); } }
private void registerSync(Destination destination, Transaction transaction, BaseCommand command) { Synchronization sync = new PreparedDestinationCompletion(destination, command.isMessage()); // ensure one per destination in the list Synchronization existing = transaction.findMatching(sync); if (existing != null) { ((PreparedDestinationCompletion)existing).incrementOpCount(); } else { transaction.addSynchronization(sync); } }
private void registerSync(Destination destination, Transaction transaction, BaseCommand command) { Synchronization sync = new PreparedDestinationCompletion(destination, command.isMessage()); // ensure one per destination in the list Synchronization existing = transaction.findMatching(sync); if (existing != null) { ((PreparedDestinationCompletion)existing).incrementOpCount(); } else { transaction.addSynchronization(sync); } }
private boolean tryOrderedCursorAdd(Message message, ConnectionContext context) throws Exception { boolean result = true; if (context.isInTransaction()) { context.getTransaction().addSynchronization(new CursorAddSync(new MessageContext(context, message, null))); } else if (store != null && message.isPersistent()) { doPendingCursorAdditions(); } else { // no ordering issue with non persistent messages result = tryCursorAdd(message); messageSent(context, message); } return result; }
private boolean tryOrderedCursorAdd(Message message, ConnectionContext context) throws Exception { boolean result = true; if (context.isInTransaction()) { context.getTransaction().addSynchronization(new CursorAddSync(new MessageContext(context, message, null))); } else if (store != null && message.isPersistent()) { doPendingCursorAdditions(); } else { // no ordering issue with non persistent messages result = tryCursorAdd(message); messageSent(context, message); } return result; }
private boolean tryOrderedCursorAdd(Message message, ConnectionContext context) throws Exception { boolean result = true; if (context.isInTransaction()) { context.getTransaction().addSynchronization(new CursorAddSync(new MessageContext(context, message, null))); } else if (store != null && message.isPersistent()) { doPendingCursorAdditions(); } else { // no ordering issue with non persistent messages result = tryCursorAdd(message); messageSent(context, message); } return result; }