Search in sources :

Example 1 with OversizeFrameException

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

the class Session_1_0 method sendTransfer.

void sendTransfer(final Transfer xfr, final SendingLinkEndpoint endpoint) {
    _nextOutgoingId.incr();
    final boolean settled = Boolean.TRUE.equals(xfr.getSettled());
    UnsignedInteger deliveryId = UnsignedInteger.valueOf(_nextOutgoingDeliveryId++);
    xfr.setDeliveryId(deliveryId);
    if (!settled) {
        final UnsettledDelivery delivery = new UnsettledDelivery(xfr.getDeliveryTag(), endpoint);
        _outgoingDeliveryRegistry.addDelivery(deliveryId, delivery);
    }
    _remoteIncomingWindow--;
    try (QpidByteBuffer payload = xfr.getPayload()) {
        long remaining = payload == null ? 0 : (long) payload.remaining();
        int payloadSent = _connection.sendFrame(_sendingChannel, xfr, payload);
        if (payload != null) {
            while (payloadSent < remaining && payloadSent >= 0) {
                Transfer continuationTransfer = new Transfer();
                continuationTransfer.setHandle(xfr.getHandle());
                continuationTransfer.setRcvSettleMode(xfr.getRcvSettleMode());
                continuationTransfer.setState(xfr.getState());
                continuationTransfer.setPayload(payload);
                _nextOutgoingId.incr();
                _remoteIncomingWindow--;
                remaining = (long) payload.remaining();
                payloadSent = _connection.sendFrame(_sendingChannel, continuationTransfer, payload);
                continuationTransfer.dispose();
            }
        }
    } catch (OversizeFrameException e) {
        throw new ConnectionScopedRuntimeException(e);
    }
}
Also used : OversizeFrameException(org.apache.qpid.server.protocol.v1_0.framing.OversizeFrameException) ConnectionScopedRuntimeException(org.apache.qpid.server.util.ConnectionScopedRuntimeException) UnsettledDelivery(org.apache.qpid.server.protocol.v1_0.delivery.UnsettledDelivery) Transfer(org.apache.qpid.server.protocol.v1_0.type.transport.Transfer) QpidByteBuffer(org.apache.qpid.server.bytebuffer.QpidByteBuffer) UnsignedInteger(org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger)

Aggregations

QpidByteBuffer (org.apache.qpid.server.bytebuffer.QpidByteBuffer)1 UnsettledDelivery (org.apache.qpid.server.protocol.v1_0.delivery.UnsettledDelivery)1 OversizeFrameException (org.apache.qpid.server.protocol.v1_0.framing.OversizeFrameException)1 UnsignedInteger (org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger)1 Transfer (org.apache.qpid.server.protocol.v1_0.type.transport.Transfer)1 ConnectionScopedRuntimeException (org.apache.qpid.server.util.ConnectionScopedRuntimeException)1