Search in sources :

Example 11 with LinkEndpoint

use of org.apache.qpid.server.protocol.v1_0.LinkEndpoint in project qpid-broker-j by apache.

the class Session_1_0 method receiveDisposition.

public void receiveDisposition(final Disposition disposition) {
    Role dispositionRole = disposition.getRole();
    DeliveryRegistry unsettledDeliveries;
    if (dispositionRole == Role.RECEIVER) {
        unsettledDeliveries = _outgoingDeliveryRegistry;
    } else {
        unsettledDeliveries = _incomingDeliveryRegistry;
    }
    SequenceNumber deliveryId = new SequenceNumber(disposition.getFirst().intValue());
    SequenceNumber last;
    if (disposition.getLast() == null) {
        last = new SequenceNumber(deliveryId.intValue());
    } else {
        last = new SequenceNumber(disposition.getLast().intValue());
    }
    while (deliveryId.compareTo(last) <= 0) {
        UnsignedInteger deliveryIdUnsigned = UnsignedInteger.valueOf(deliveryId.intValue());
        UnsettledDelivery unsettledDelivery = unsettledDeliveries.getDelivery(deliveryIdUnsigned);
        if (unsettledDelivery != null) {
            LinkEndpoint<?, ?> linkEndpoint = unsettledDelivery.getLinkEndpoint();
            linkEndpoint.receiveDeliveryState(unsettledDelivery.getDeliveryTag(), disposition.getState(), disposition.getSettled());
            if (Boolean.TRUE.equals(disposition.getSettled())) {
                unsettledDeliveries.removeDelivery(deliveryIdUnsigned);
            }
        }
        deliveryId.incr();
    }
}
Also used : Role(org.apache.qpid.server.protocol.v1_0.type.transport.Role) UnsettledDelivery(org.apache.qpid.server.protocol.v1_0.delivery.UnsettledDelivery) UnsignedInteger(org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger) DeliveryRegistry(org.apache.qpid.server.protocol.v1_0.delivery.DeliveryRegistry)

Example 12 with LinkEndpoint

use of org.apache.qpid.server.protocol.v1_0.LinkEndpoint in project qpid-broker-j by apache.

the class TxnCoordinatorReceivingLinkEndpoint method establishLink.

@Override
protected void establishLink(final Attach attach) throws AmqpErrorException {
    if (getSource() != null || getTarget() != null) {
        throw new IllegalStateException("LinkEndpoint and Termini should be null when establishing a Link.");
    }
    Coordinator target = new Coordinator();
    Source source = (Source) attach.getSource();
    getLink().setTermini(source, target);
    attachReceived(attach);
}
Also used : Coordinator(org.apache.qpid.server.protocol.v1_0.type.transaction.Coordinator) Source(org.apache.qpid.server.protocol.v1_0.type.messaging.Source)

Aggregations

UnsignedInteger (org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger)6 AmqpError (org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError)5 Error (org.apache.qpid.server.protocol.v1_0.type.transport.Error)5 LinkError (org.apache.qpid.server.protocol.v1_0.type.transport.LinkError)5 BaseSource (org.apache.qpid.server.protocol.v1_0.type.BaseSource)3 SessionError (org.apache.qpid.server.protocol.v1_0.type.transport.SessionError)3 BaseTarget (org.apache.qpid.server.protocol.v1_0.type.BaseTarget)2 Source (org.apache.qpid.server.protocol.v1_0.type.messaging.Source)2 Role (org.apache.qpid.server.protocol.v1_0.type.transport.Role)2 HashSet (java.util.HashSet)1 ExecutionException (java.util.concurrent.ExecutionException)1 MessageSource (org.apache.qpid.server.message.MessageSource)1 DeliveryRegistry (org.apache.qpid.server.protocol.v1_0.delivery.DeliveryRegistry)1 UnsettledDelivery (org.apache.qpid.server.protocol.v1_0.delivery.UnsettledDelivery)1 AmqpErrorException (org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException)1 Binary (org.apache.qpid.server.protocol.v1_0.type.Binary)1 Coordinator (org.apache.qpid.server.protocol.v1_0.type.transaction.Coordinator)1 Detach (org.apache.qpid.server.protocol.v1_0.type.transport.Detach)1 End (org.apache.qpid.server.protocol.v1_0.type.transport.End)1 ConnectionScopedRuntimeException (org.apache.qpid.server.util.ConnectionScopedRuntimeException)1