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();
}
}
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);
}
Aggregations