use of org.glassfish.grizzly.memory.CompositeBuffer in project openmq by eclipse-ee4j.
the class GrizzlyMQPacketFilter method handleWrite.
@Override
public NextAction handleWrite(final FilterChainContext ctx) throws IOException {
final Packet packet = ctx.getMessage();
final MemoryManager mm = ctx.getConnection().getTransport().getMemoryManager();
BufferOutputStream bos = null;
try {
bos = new BufferOutputStream(mm);
packet.writePacket(bos);
bos.close();
Buffer buf = bos.getBuffer();
buf.trim();
buf.allowBufferDispose(true);
if (buf.isComposite()) {
((CompositeBuffer) buf).allowInternalBuffersDispose(true);
}
ctx.setMessage(buf);
return ctx.getInvokeAction();
} finally {
if (bos != null) {
bos.close();
}
}
}
Aggregations