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); } }
context.getTransaction().addSynchronization(new Synchronization() { public void afterCommit() throws Exception { if (debug) {
ack.setSubscritionName(subscriptionName); ack.setClientId(clientId); ack.setTransactionId(context.getTransaction() != null ? context.getTransaction().getTransactionId() : null); final RecordLocation location = peristenceAdapter.writeCommand(ack, false); context.getTransaction().addSynchronization(new Synchronization() { @Override public void afterCommit() throws Exception {
context.getTransaction().addSynchronization(new Synchronization() { public void afterCommit() throws Exception { if (debug) {
public void send(ProducerBrokerExchange producerExchange, final Message message) throws Exception { // This method may be invoked recursively. // Track original tx so that it can be restored. final ConnectionContext context = producerExchange.getConnectionContext(); Transaction originalTx = context.getTransaction(); Transaction transaction = null; if (message.getTransactionId() != null) { transaction = getTransaction(context, message.getTransactionId(), false); } context.setTransaction(transaction); try { next.send(producerExchange, message); } finally { context.setTransaction(originalTx); } }
public void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception { // This method may be invoked recursively. // Track original tx so that it can be restored. final ConnectionContext context = consumerExchange.getConnectionContext(); Transaction originalTx = context.getTransaction(); Transaction transaction = null; if (ack.isInTransaction()) { transaction = getTransaction(context, ack.getTransactionId(), false); } context.setTransaction(transaction); try { next.acknowledge(consumerExchange, ack); } finally { context.setTransaction(originalTx); } }
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 {
if (context.getTransaction().getState() > IN_USE_STATE) { throw new JMSException("Send transaction completed while waiting for space");
context.getTransaction().addSynchronization(new Synchronization() { @Override public void afterCommit() throws Exception {
int size = context.getTransaction().size(); LOG.warn("Waiting for space to send transacted message - transaction elements = {} need more space to commit. Message = {}", size, message);
public void send(ProducerBrokerExchange producerExchange, final Message message) throws Exception { // This method may be invoked recursively. // Track original tx so that it can be restored. final ConnectionContext context = producerExchange.getConnectionContext(); Transaction originalTx = context.getTransaction(); Transaction transaction = null; if (message.getTransactionId() != null) { transaction = getTransaction(context, message.getTransactionId(), false); } context.setTransaction(transaction); try { next.send(producerExchange, message); } finally { context.setTransaction(originalTx); } }
public void send(ProducerBrokerExchange producerExchange, final Message message) throws Exception { // This method may be invoked recursively. // Track original tx so that it can be restored. final ConnectionContext context = producerExchange.getConnectionContext(); Transaction originalTx = context.getTransaction(); Transaction transaction = null; if (message.getTransactionId() != null) { transaction = getTransaction(context, message.getTransactionId(), false); } context.setTransaction(transaction); try { next.send(producerExchange, message); } finally { context.setTransaction(originalTx); } }
public void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception { // This method may be invoked recursively. // Track original tx so that it can be restored. final ConnectionContext context = consumerExchange.getConnectionContext(); Transaction originalTx = context.getTransaction(); Transaction transaction = null; if (ack.isInTransaction()) { transaction = getTransaction(context, ack.getTransactionId(), false); } context.setTransaction(transaction); try { next.acknowledge(consumerExchange, ack); } finally { context.setTransaction(originalTx); } }
public void send(ProducerBrokerExchange producerExchange, final Message message) throws Exception { // This method may be invoked recursively. // Track original tx so that it can be restored. final ConnectionContext context = producerExchange.getConnectionContext(); Transaction originalTx = context.getTransaction(); Transaction transaction = null; if (message.getTransactionId() != null) { transaction = getTransaction(context, message.getTransactionId(), false); } context.setTransaction(transaction); try { next.send(producerExchange, message); } finally { context.setTransaction(originalTx); } }
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; }