/** * Send TransactionInfo to indicate transaction has started * * @throws JMSException if some internal error occurs */ protected void doStartTransaction() throws JMSException { if (getTransacted() && !transactionContext.isInXATransaction()) { transactionContext.begin(); } }
protected void sendAck(MessageAck ack, boolean lazy) throws JMSException { if (lazy || connection.isSendAcksAsync() || getTransacted()) { asyncSendPacket(ack); } else { syncSendPacket(ack); } }
/** * Rolls back any messages done in this transaction and releases any locks * currently held. * * @throws JMSException if the JMS provider fails to roll back the * transaction due to some internal error. * @throws javax.jms.IllegalStateException if the method is not called by a * transacted session. */ @Override public void rollback() throws JMSException { checkClosed(); if (!getTransacted()) { throw new javax.jms.IllegalStateException("Not a transacted session"); } if (LOG.isDebugEnabled()) { LOG.debug(getSessionId() + " Transaction Rollback, txid:" + transactionContext.getTransactionId()); } transactionContext.rollback(); }
/** * Commits all messages done in this transaction and releases any locks * currently held. * * @throws JMSException if the JMS provider fails to commit the transaction * due to some internal error. * @throws TransactionRolledBackException if the transaction is rolled back * due to some internal error during commit. * @throws javax.jms.IllegalStateException if the method is not called by a * transacted session. */ @Override public void commit() throws JMSException { checkClosed(); if (!getTransacted()) { throw new javax.jms.IllegalStateException("Not a transacted session"); } if (LOG.isDebugEnabled()) { LOG.debug(getSessionId() + " Transaction Commit :" + transactionContext.getTransactionId()); } transactionContext.commit(); }
if (getTransacted()) { throw new IllegalStateException("This session is transacted");
/** * Acknowledge all the messages that have been delivered to the client up to * this point. * * @throws JMSException */ public void acknowledge() throws JMSException { clearDeliveredList(); waitForRedeliveries(); synchronized(deliveredMessages) { // Acknowledge all messages so far. MessageAck ack = makeAckForAllDeliveredMessages(MessageAck.STANDARD_ACK_TYPE); if (ack == null) { return; // no msgs } if (session.getTransacted()) { rollbackOnFailedRecoveryRedelivery(); session.doStartTransaction(); ack.setTransactionId(session.getTransactionContext().getTransactionId()); } pendingAck = null; session.sendAck(ack); // Adjust the counters deliveredCounter = Math.max(0, deliveredCounter - deliveredMessages.size()); additionalWindowSize = Math.max(0, additionalWindowSize - deliveredMessages.size()); if (!session.getTransacted()) { deliveredMessages.clear(); } } }
private void destroyConsumer() { if (consumer == null) { return; } try { if (session.getTransacted() && session.getTransactionContext().isInLocalTransaction()) { session.commit(); } consumer.close(); consumer = null; } catch (JMSException e) { e.printStackTrace(); } }
private void beforeMessageIsConsumed(MessageDispatch md) throws JMSException { md.setDeliverySequenceId(session.getNextDeliveryId()); lastDeliveredSequenceId = md.getMessage().getMessageId().getBrokerSequenceId(); if (!isAutoAcknowledgeBatch()) { synchronized(deliveredMessages) { deliveredMessages.addFirst(md); } if (session.getTransacted()) { if (transactedIndividualAck) { immediateIndividualTransactedAck(md); } else { ackLater(md, MessageAck.DELIVERED_ACK_TYPE); } } } }
private boolean redeliveryExceeded(MessageDispatch md) { try { return session.getTransacted() && redeliveryPolicy != null && redeliveryPolicy.isPreDispatchCheck() && redeliveryPolicy.getMaximumRedeliveries() != RedeliveryPolicy.NO_MAXIMUM_REDELIVERIES && md.getRedeliveryCounter() > redeliveryPolicy.getMaximumRedeliveries() // redeliveryCounter > x expected after resend via brokerRedeliveryPlugin && md.getMessage().getProperty("redeliveryDelay") == null; } catch (Exception ignored) { return false; } }
} else { stats.onMessage(); if (session.getTransacted()) {
if (session.getTransacted()) { registerSync();
if (!session.getTransacted()) { deliverAcks(); if (isAutoAcknowledgeBatch()) {
/** * Send TransactionInfo to indicate transaction has started * * @throws JMSException if some internal error occurs */ protected void doStartTransaction() throws JMSException { if (getTransacted() && !transactionContext.isInXATransaction()) { transactionContext.begin(); } }
/** * Send TransactionInfo to indicate transaction has started * * @throws JMSException if some internal error occurs */ protected void doStartTransaction() throws JMSException { if (getTransacted() && !transactionContext.isInXATransaction()) { transactionContext.begin(); } }
/** * Send TransactionInfo to indicate transaction has started * * @throws JMSException if some internal error occurs */ protected void doStartTransaction() throws JMSException { if (getTransacted() && !transactionContext.isInXATransaction()) { transactionContext.begin(); } }
protected void sendAck(MessageAck ack, boolean lazy) throws JMSException { if (lazy || connection.isSendAcksAsync() || getTransacted()) { asyncSendPacket(ack); } else { syncSendPacket(ack); } }
protected void sendAck(MessageAck ack, boolean lazy) throws JMSException { if (lazy || connection.isSendAcksAsync() || getTransacted()) { asyncSendPacket(ack); } else { syncSendPacket(ack); } }
protected void sendAck(MessageAck ack, boolean lazy) throws JMSException { if (lazy || connection.isSendAcksAsync() || getTransacted()) { asyncSendPacket(ack); } else { syncSendPacket(ack); } }
protected void sendAck(MessageAck ack, boolean lazy) throws JMSException { if (lazy || connection.isSendAcksAsync() || getTransacted()) { asyncSendPacket(ack); } else { syncSendPacket(ack); } }
private boolean redeliveryExceeded(MessageDispatch md) { try { return session.getTransacted() && redeliveryPolicy != null && redeliveryPolicy.isPreDispatchCheck() && redeliveryPolicy.getMaximumRedeliveries() != RedeliveryPolicy.NO_MAXIMUM_REDELIVERIES && md.getRedeliveryCounter() > redeliveryPolicy.getMaximumRedeliveries() // redeliveryCounter > x expected after resend via brokerRedeliveryPlugin && md.getMessage().getProperty("redeliveryDelay") == null; } catch (Exception ignored) { return false; } }