private void resetLargeMessageController() { LargeMessageController controller = currentLargeMessageController; if (controller != null) { controller.cancel(); currentLargeMessageController = null; } }
@Override public boolean waitOutputStreamCompletion(final long timeMilliseconds) throws ActiveMQException { if (bodyBuffer != null) { return super.waitOutputStreamCompletion(timeMilliseconds); } else { return largeMessageController.waitCompletion(timeMilliseconds); } }
@Override public void discardBody() { if (bodyBuffer != null) { super.discardBody(); } else { largeMessageController.discardUnusedPackets(); } }
@Override public void saveToOutputStream(final OutputStream out) throws ActiveMQException { if (bodyBuffer != null) { // The body was rebuilt on the client, so we need to behave as a regular message on this case super.saveToOutputStream(out); } else { largeMessageController.saveBuffer(out); } }
@Override public ClientLargeMessageImpl setOutputStream(final OutputStream out) throws ActiveMQException { if (bodyBuffer != null) { super.setOutputStream(out); } else { largeMessageController.setOutputStream(out); } return this; }
private void checkBuffer() throws ActiveMQException { if (bodyBuffer == null) { long bodySize = this.largeMessageSize + BODY_OFFSET; if (bodySize > Integer.MAX_VALUE) { bodySize = Integer.MAX_VALUE; } createBody((int) bodySize); bodyBuffer = new ResetLimitWrappedActiveMQBuffer(BODY_OFFSET, buffer, this); largeMessageController.saveBuffer(new ActiveMQOutputStream(bodyBuffer)); } }
/** @param timeWait Milliseconds to Wait. 0 means forever */ public synchronized boolean waitCompletion(final long timeWait) throws HornetQException { return bufferDelegate.waitCompletion(timeWait); }
public void setOutputStream(final OutputStream output) throws HornetQException { bufferDelegate.setOutputStream(new InflaterWriter(output)); }
public synchronized void close() { bufferDelegate.cancel(); }
/** Add a buff to the List, or save it to the OutputStream if set */ public void addPacket(byte[] chunk, int flowControlSize, boolean isContinues) { bufferDelegate.addPacket(chunk, flowControlSize, isContinues); }
public void discardUnusedPackets() { bufferDelegate.discardUnusedPackets(); }