Java Code Examples for org.apache.qpid.proton.amqp.messaging.Released#getInstance()

The following examples show how to use org.apache.qpid.proton.amqp.messaging.Released#getInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FastPathDispositionType.java    From qpid-proton-j with Apache License 2.0 5 votes vote down vote up
private byte deduceEncodingCode(Disposition value, int elementCount) {
    if (value.getState() == null) {
        return EncodingCodes.LIST8;
    } else if (value.getState() == Accepted.getInstance() || value.getState() == Released.getInstance()) {
        return EncodingCodes.LIST8;
    } else {
        return EncodingCodes.LIST32;
    }
}
 
Example 2
Source File: ReleasedType.java    From qpid-proton-j with Apache License 2.0 4 votes vote down vote up
public Released newInstance(Object described)
{
    return Released.getInstance();
}
 
Example 3
Source File: AmqpConsumer.java    From qpid-jms with Apache License 2.0 4 votes vote down vote up
/**
 * Called to acknowledge all messages that have been marked as delivered but
 * have not yet been marked consumed.  Usually this is called as part of an
 * client acknowledge session operation.
 *
 * Only messages that have already been acknowledged as delivered by the JMS
 * framework will be in the delivered Map.  This means that the link credit
 * would already have been given for these so we just need to settle them.
 *
 * @param ackType the type of acknowledgement to perform
 */
public void acknowledge(ACK_TYPE ackType) {
    LOG.trace("Session Acknowledge for consumer {} with ack type {}", getResourceInfo().getId(), ackType);
    Delivery delivery = getEndpoint().head();
    while (delivery != null) {
        Delivery current = delivery;
        delivery = delivery.next();

        if (!(current.getContext() instanceof JmsInboundMessageDispatch)) {
            LOG.debug("{} Found incomplete delivery with no context during session acknowledge processing", AmqpConsumer.this);
            continue;
        }

        JmsInboundMessageDispatch envelope = (JmsInboundMessageDispatch) current.getContext();
        if(ackType == ACK_TYPE.SESSION_SHUTDOWN && (envelope.isDelivered() || envelope.isRecovered())) {
            handleDisposition(envelope, current, MODIFIED_FAILED);
        } else if (envelope.isDelivered()) {
            final DeliveryState disposition;

            switch (ackType) {
                case ACCEPTED:
                    disposition = Accepted.getInstance();
                    break;
                case RELEASED:
                    disposition = Released.getInstance();
                    break;
                case REJECTED:
                    disposition = REJECTED;
                    break;
                case MODIFIED_FAILED:
                    disposition = MODIFIED_FAILED;
                    break;
                case MODIFIED_FAILED_UNDELIVERABLE:
                    disposition = MODIFIED_FAILED_UNDELIVERABLE;
                    break;
                default:
                    throw new IllegalArgumentException("Invalid acknowledgement type specified: " + ackType);
            }

            handleDisposition(envelope, current, disposition);
        }
    }

    tryCompleteDeferredClose();
}