@Override public void encode(ActiveMQBuffer buffer, EncodingSupport record) { record.encode(buffer); }
@Override public void encode(ActiveMQBuffer buffer, EncodingSupport record) { record.encode(buffer); }
public void addBytes(final EncodingSupport bytes, final boolean sync, final IOCallback callback) { enterCritical(CRITICAL_PATH_ADD_BYTES); try { synchronized (this) { if (!started) { throw new IllegalStateException("TimedBuffer is not started"); } delayFlush = false; bytes.encode(buffer); callbacks.add(callback); if (sync) { pendingSync = true; startSpin(); } } } finally { leaveCritical(CRITICAL_PATH_ADD_BYTES); } }
void setTxData(EncodingSupport txData) { this.txDataSize = txData.getEncodeSize(); ActiveMQBuffer encodedBuffer = ActiveMQBuffers.fixedBuffer(txDataSize); txData.encode(encodedBuffer); this.txData = new ActiveMQBufferInputStream(encodedBuffer); }
@Override public void write(EncodingSupport bytes, boolean sync, IOCallback callback) throws Exception { ActiveMQBuffer data = ActiveMQBuffers.fixedBuffer(bytes.getEncodeSize()); bytes.encode(data); write(data, sync, callback, true); }
public void addBytes(final EncodingSupport bytes, final boolean sync, final IOCallback callback) { enterCritical(CRITICAL_PATH_ADD_BYTES); try { synchronized (this) { if (!started) { throw new IllegalStateException("TimedBuffer is not started"); } delayFlush = false; bytes.encode(buffer); callbacks.add(callback); if (sync) { pendingSync = true; startSpin(); } } } finally { leaveCritical(CRITICAL_PATH_ADD_BYTES); } }
@Override public void write(final EncodingSupport bytes, final boolean sync, final IOCallback callback) { if (timedBuffer != null) { timedBuffer.addBytes(bytes, sync, callback); } else { final int encodedSize = bytes.getEncodeSize(); ByteBuffer buffer = factory.newBuffer(encodedSize); ActiveMQBuffer outBuffer = ActiveMQBuffers.wrappedBuffer(buffer); bytes.encode(outBuffer); buffer.clear(); buffer.limit(encodedSize); writeDirect(buffer, sync, callback); } }
/** * Writes an encoded sequence of bytes to this file from the given buffer. * <p> * <p> Bytes are written starting at this file's current position, */ public void write(EncodingSupport encodingSupport) throws IOException { final int encodedSize = encodingSupport.getEncodeSize(); final int nextPosition = this.position + encodedSize; checkCapacity(nextPosition); this.byteBufWrapper.setIndex(this.position, this.position); encodingSupport.encode(this.channelBufferWrapper); rawMovePositionAndLength(nextPosition); assert (byteBufWrapper.writerIndex() == this.position); }
/** * Writes an encoded sequence of bytes to this file from the given buffer. * <p> * <p> Bytes are written starting at this file's current position, */ public void write(EncodingSupport encodingSupport) throws IOException { final int encodedSize = encodingSupport.getEncodeSize(); final int nextPosition = this.position + encodedSize; checkCapacity(nextPosition); this.byteBufWrapper.setIndex(this.position, this.position); encodingSupport.encode(this.channelBufferWrapper); rawMovePositionAndLength(nextPosition); assert (byteBufWrapper.writerIndex() == this.position); }
@Override public void write(final EncodingSupport bytes, final boolean sync, final IOCallback callback) { if (timedBuffer != null) { timedBuffer.addBytes(bytes, sync, callback); } else { final int encodedSize = bytes.getEncodeSize(); ByteBuffer buffer = factory.newBuffer(encodedSize); ActiveMQBuffer outBuffer = ActiveMQBuffers.wrappedBuffer(buffer); bytes.encode(outBuffer); buffer.clear(); buffer.limit(encodedSize); writeDirect(buffer, sync, callback); } }
@Override public void encodeRest(final ActiveMQBuffer buffer) { buffer.writeByte(journalID); buffer.writeLong(txId); buffer.writeInt(encodingData.getEncodeSize()); encodingData.encode(buffer); }
@Override public void encodeRest(final ActiveMQBuffer buffer) { buffer.writeByte(journalID); buffer.writeLong(txId); buffer.writeLong(id); buffer.writeInt(encodingData.getEncodeSize()); encodingData.encode(buffer); }
@Override public void write(final EncodingSupport bytes, final boolean sync, final IOCallback callback) throws Exception { ByteBuffer buffer = newBuffer(bytes.getEncodeSize()); ActiveMQBuffer outbuffer = ActiveMQBuffers.wrappedBuffer(buffer); bytes.encode(outbuffer); write(outbuffer, sync, callback); }
@Override public void write(final EncodingSupport bytes, final boolean sync) throws Exception { ByteBuffer buffer = newBuffer(bytes.getEncodeSize()); ActiveMQBuffer outbuffer = ActiveMQBuffers.wrappedBuffer(buffer); bytes.encode(outbuffer); write(outbuffer, sync); }
@Override public void encode(final ActiveMQBuffer buffer) { buffer.writeByte(JournalImpl.DELETE_RECORD_TX); buffer.writeInt(fileID); buffer.writeByte(compactCount); buffer.writeLong(txID); buffer.writeLong(id); buffer.writeInt(record != null ? record.getEncodeSize() : 0); if (record != null) { record.encode(buffer); } buffer.writeInt(getEncodeSize()); }
@Override public void encode(final ActiveMQBuffer buffer) { buffer.writeByte(JournalImpl.DELETE_RECORD_TX); buffer.writeInt(fileID); buffer.writeByte(compactCount); buffer.writeLong(txID); buffer.writeLong(id); buffer.writeInt(record != null ? record.getEncodeSize() : 0); if (record != null) { record.encode(buffer); } buffer.writeInt(getEncodeSize()); }
@Override public void encode(final ActiveMQBuffer buffer) { if (txRecordType == TX_RECORD_TYPE.COMMIT) { buffer.writeByte(JournalImpl.COMMIT_RECORD); } else { buffer.writeByte(JournalImpl.PREPARE_RECORD); } buffer.writeInt(fileID); buffer.writeByte(compactCount); buffer.writeLong(txID); buffer.writeInt(numberOfRecords); if (transactionData != null) { buffer.writeInt(transactionData.getEncodeSize()); } if (transactionData != null) { transactionData.encode(buffer); } buffer.writeInt(getEncodeSize()); }
@Override public void encode(final ActiveMQBuffer buffer) { if (txRecordType == TX_RECORD_TYPE.COMMIT) { buffer.writeByte(JournalImpl.COMMIT_RECORD); } else { buffer.writeByte(JournalImpl.PREPARE_RECORD); } buffer.writeInt(fileID); buffer.writeByte(compactCount); buffer.writeLong(txID); buffer.writeInt(numberOfRecords); if (transactionData != null) { buffer.writeInt(transactionData.getEncodeSize()); } if (transactionData != null) { transactionData.encode(buffer); } buffer.writeInt(getEncodeSize()); }