Search in sources :

Example 1 with TransportFrame

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

the class Interaction method sendPerformativeAndChainFuture.

private void sendPerformativeAndChainFuture(final FrameBody frameBody, final UnsignedShort channel) throws Exception {
    final TransportFrame transportFrame;
    try (QpidByteBuffer payload = frameBody instanceof Transfer ? ((Transfer) frameBody).getPayload() : null) {
        final QpidByteBuffer duplicate;
        if (payload == null) {
            duplicate = null;
        } else {
            duplicate = payload.duplicate();
        }
        transportFrame = new TransportFrame(channel.shortValue(), frameBody, duplicate);
        ListenableFuture<Void> listenableFuture = sendPerformativeAndChainFuture(transportFrame);
        if (frameBody instanceof Transfer) {
            listenableFuture.addListener(() -> ((Transfer) frameBody).dispose(), MoreExecutors.directExecutor());
        }
        if (duplicate != null) {
            listenableFuture.addListener(() -> duplicate.dispose(), MoreExecutors.directExecutor());
        }
    }
}
Also used : TransportFrame(org.apache.qpid.server.protocol.v1_0.framing.TransportFrame) Transfer(org.apache.qpid.server.protocol.v1_0.type.transport.Transfer) QpidByteBuffer(org.apache.qpid.server.bytebuffer.QpidByteBuffer)

Example 2 with TransportFrame

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

the class Interaction method sendPerformativeAndChainFuture.

private void sendPerformativeAndChainFuture(final SaslFrameBody frameBody) throws Exception {
    SASLFrame transportFrame = new SASLFrame(frameBody);
    sendPerformativeAndChainFuture(transportFrame);
}
Also used : SASLFrame(org.apache.qpid.server.protocol.v1_0.framing.SASLFrame)

Aggregations

QpidByteBuffer (org.apache.qpid.server.bytebuffer.QpidByteBuffer)1 SASLFrame (org.apache.qpid.server.protocol.v1_0.framing.SASLFrame)1 TransportFrame (org.apache.qpid.server.protocol.v1_0.framing.TransportFrame)1 Transfer (org.apache.qpid.server.protocol.v1_0.type.transport.Transfer)1