final Message message = iter.next().getMessage();
cmd.run(ctx);
final Message message = iter.next().getMessage();
final Message message = iter.next().getMessage();
final Message message = iter.next().getMessage();
/** * @throws IOException */ public void commit() throws IOException { ConnectionContext ctx = new ConnectionContext(); persistenceAdapter.beginTransaction(ctx); try { // Do all the message adds. for (Iterator<AddMessageCommand> iter = messages.iterator(); iter.hasNext();) { AddMessageCommand cmd = iter.next(); cmd.run(ctx); } // And removes.. for (Iterator<RemoveMessageCommand> iter = acks.iterator(); iter.hasNext();) { RemoveMessageCommand cmd = iter.next(); cmd.run(ctx); } } catch ( IOException e ) { persistenceAdapter.rollbackTransaction(ctx); throw e; } persistenceAdapter.commitTransaction(ctx); } }
/** * @throws IOException */ public void commit() throws IOException { ConnectionContext ctx = new ConnectionContext(); persistenceAdapter.beginTransaction(ctx); try { // Do all the message adds. for (Iterator<AddMessageCommand> iter = messages.iterator(); iter.hasNext();) { AddMessageCommand cmd = iter.next(); cmd.run(ctx); } // And removes.. for (Iterator<RemoveMessageCommand> iter = acks.iterator(); iter.hasNext();) { RemoveMessageCommand cmd = iter.next(); cmd.run(ctx); } } catch (IOException e) { persistenceAdapter.rollbackTransaction(ctx); throw e; } persistenceAdapter.commitTransaction(ctx); } }
/** * @throws IOException */ public void commit() throws IOException { ConnectionContext ctx = new ConnectionContext(); persistenceAdapter.beginTransaction(ctx); try { // Do all the message adds. for (Iterator<AddMessageCommand> iter = messages.iterator(); iter.hasNext();) { AddMessageCommand cmd = iter.next(); cmd.run(ctx); } // And removes.. for (Iterator<RemoveMessageCommand> iter = acks.iterator(); iter.hasNext();) { RemoveMessageCommand cmd = iter.next(); cmd.run(ctx); } } catch (IOException e) { persistenceAdapter.rollbackTransaction(ctx); throw e; } persistenceAdapter.commitTransaction(ctx); } }
/** * @throws IOException */ public void commit() throws IOException { ConnectionContext ctx = new ConnectionContext(); persistenceAdapter.beginTransaction(ctx); try { // Do all the message adds. for (Iterator<AddMessageCommand> iter = messages.iterator(); iter.hasNext();) { AddMessageCommand cmd = iter.next(); cmd.run(ctx); } // And removes.. for (Iterator<RemoveMessageCommand> iter = acks.iterator(); iter.hasNext();) { RemoveMessageCommand cmd = iter.next(); cmd.run(ctx); } } catch (IOException e) { persistenceAdapter.rollbackTransaction(ctx); throw e; } persistenceAdapter.commitTransaction(ctx); } }
@Override protected void onRecovered(Tx tx) { for (RemoveMessageCommand removeMessageCommand: tx.acks) { if (removeMessageCommand instanceof LastAckCommand) { LastAckCommand lastAckCommand = (LastAckCommand) removeMessageCommand; JDBCTopicMessageStore jdbcTopicMessageStore = (JDBCTopicMessageStore) topicStores.get(lastAckCommand.getMessageAck().getDestination()); jdbcTopicMessageStore.pendingCompletion(lastAckCommand.getClientId(), lastAckCommand.getSubName(), lastAckCommand.getSequence(), lastAckCommand.getPriority()); lastAckCommand.setMessageStore(jdbcTopicMessageStore); } else { // when reading the store we ignore messages with non null XIDs but should include those with XIDS starting in - (pending acks in an xa transaction), // but the sql is non portable to match BLOB with LIKE etc // so we make up for it when we recover the ack ((JDBCPersistenceAdapter)persistenceAdapter).getBrokerService().getRegionBroker().getDestinationMap().get(removeMessageCommand.getMessageAck().getDestination()).getDestinationStatistics().getMessages().increment(); } } for (AddMessageCommand addMessageCommand : tx.messages) { ActiveMQDestination destination = addMessageCommand.getMessage().getDestination(); addMessageCommand.setMessageStore(destination.isQueue() ? queueStores.get(destination) : topicStores.get(destination)); } }
@Override protected void onRecovered(Tx tx) { for (RemoveMessageCommand removeMessageCommand: tx.acks) { if (removeMessageCommand instanceof LastAckCommand) { LastAckCommand lastAckCommand = (LastAckCommand) removeMessageCommand; JDBCTopicMessageStore jdbcTopicMessageStore = (JDBCTopicMessageStore) topicStores.get(lastAckCommand.getMessageAck().getDestination()); jdbcTopicMessageStore.pendingCompletion(lastAckCommand.getClientId(), lastAckCommand.getSubName(), lastAckCommand.getSequence(), lastAckCommand.getPriority()); lastAckCommand.setMessageStore(jdbcTopicMessageStore); } else { // when reading the store we ignore messages with non null XIDs but should include those with XIDS starting in - (pending acks in an xa transaction), // but the sql is non portable to match BLOB with LIKE etc // so we make up for it when we recover the ack ((JDBCPersistenceAdapter)persistenceAdapter).getBrokerService().getRegionBroker().getDestinationMap().get(removeMessageCommand.getMessageAck().getDestination()).getDestinationStatistics().getMessages().increment(); } } for (AddMessageCommand addMessageCommand : tx.messages) { ActiveMQDestination destination = addMessageCommand.getMessage().getDestination(); addMessageCommand.setMessageStore(destination.isQueue() ? queueStores.get(destination) : topicStores.get(destination)); } }
@Override protected void onRecovered(Tx tx) { for (RemoveMessageCommand removeMessageCommand: tx.acks) { if (removeMessageCommand instanceof LastAckCommand) { LastAckCommand lastAckCommand = (LastAckCommand) removeMessageCommand; JDBCTopicMessageStore jdbcTopicMessageStore = (JDBCTopicMessageStore) topicStores.get(lastAckCommand.getMessageAck().getDestination()); jdbcTopicMessageStore.pendingCompletion(lastAckCommand.getClientId(), lastAckCommand.getSubName(), lastAckCommand.getSequence(), lastAckCommand.getPriority()); lastAckCommand.setMessageStore(jdbcTopicMessageStore); } else { // when reading the store we ignore messages with non null XIDs but should include those with XIDS starting in - (pending acks in an xa transaction), // but the sql is non portable to match BLOB with LIKE etc // so we make up for it when we recover the ack ((JDBCPersistenceAdapter)persistenceAdapter).getBrokerService().getRegionBroker().getDestinationMap().get(removeMessageCommand.getMessageAck().getDestination()).getDestinationStatistics().getMessages().increment(); } } for (AddMessageCommand addMessageCommand : tx.messages) { ActiveMQDestination destination = addMessageCommand.getMessage().getDestination(); addMessageCommand.setMessageStore(destination.isQueue() ? queueStores.get(destination) : topicStores.get(destination)); } }
public CommitAddOutcome(AddMessageCommand addMessageCommand) { this((JDBCMessageStore)addMessageCommand.getMessageStore(), addMessageCommand.getMessage()); }
public Message[] getMessages() { Message rc[] = new Message[messages.size()]; int count = 0; for (Iterator<AddMessageCommand> iter = messages.iterator(); iter.hasNext();) { AddMessageCommand cmd = iter.next(); rc[count++] = cmd.getMessage(); } return rc; }
public CommitAddOutcome(AddMessageCommand addMessageCommand) { this((JDBCMessageStore)addMessageCommand.getMessageStore(), addMessageCommand.getMessage()); }
public CommitAddOutcome(AddMessageCommand addMessageCommand) { this((JDBCMessageStore)addMessageCommand.getMessageStore(), addMessageCommand.getMessage()); }
public Message[] getMessages() { Message rc[] = new Message[messages.size()]; int count = 0; for (Iterator<AddMessageCommand> iter = messages.iterator(); iter.hasNext();) { AddMessageCommand cmd = iter.next(); rc[count++] = cmd.getMessage(); } return rc; }