/** * Reads next message without allowing ReadLock to be overwritten * @param pipe pipe where this message is found */ public static boolean readNextWithoutReleasingReadLock(Pipe pipe) { assert(Pipe.singleThreadPerPipeRead(pipe.id)); int bytesConsumed = collectConsumedCountOfBytes(pipe); if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(Pipe.isReplaying(pipe) || pipe.ringWalker.nextWorkingTail!=Pipe.getWorkingTailPosition(pipe)) : "Only call release once per message"; //moves us forward so we can read the next fragment/message Pipe.markBytesReadBase(pipe); PendingReleaseData.appendPendingReadRelease(pipe.pendingReleases, pipe.ringWalker.nextWorkingTail, Pipe.getWorkingBlobTailPosition(pipe), bytesConsumed); return true; } else { return false; } }
/** * Reads next message without allowing ReadLock to be overwritten * @param pipe pipe where this message is found */ public static boolean readNextWithoutReleasingReadLock(Pipe pipe) { assert(Pipe.singleThreadPerPipeRead(pipe.id)); int bytesConsumed = collectConsumedCountOfBytes(pipe); if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(Pipe.isReplaying(pipe) || pipe.ringWalker.nextWorkingTail!=Pipe.getWorkingTailPosition(pipe)) : "Only call release once per message"; //moves us forward so we can read the next fragment/message Pipe.markBytesReadBase(pipe); PendingReleaseData.appendPendingReadRelease(pipe.pendingReleases, pipe.ringWalker.nextWorkingTail, Pipe.getWorkingBlobTailPosition(pipe), bytesConsumed); return true; } else { return false; } }
/** * Reads next message without allowing ReadLock to be overwritten * @param pipe pipe where this message is found */ public static boolean readNextWithoutReleasingReadLock(Pipe pipe) { assert(Pipe.singleThreadPerPipeRead(pipe.id)); int bytesConsumed = collectConsumedCountOfBytes(pipe); if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(Pipe.isReplaying(pipe) || pipe.ringWalker.nextWorkingTail!=Pipe.getWorkingTailPosition(pipe)) : "Only call release once per message"; //moves us forward so we can read the next fragment/message Pipe.markBytesReadBase(pipe); PendingReleaseData.appendPendingReadRelease(pipe.pendingReleases, pipe.ringWalker.nextWorkingTail, Pipe.getWorkingBlobTailPosition(pipe), bytesConsumed); return true; } else { return false; } }
/** * Release the record which has been most recently read. * The act of releasing a record/message allows it to now be written over. * @param pipe The pipe where this message is found. * @return The total number of variable length field bytes consumed by this now released message. */ public static int releaseReadLock(Pipe pipe) { assert(Pipe.singleThreadPerPipeRead(pipe.id)); int consumed = collectConsumedCountOfBytes(pipe); //ensure we only call for new templates. if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(Pipe.isReplaying(pipe) || pipe.ringWalker.nextWorkingTail!=Pipe.getWorkingTailPosition(pipe)) : "Only call release once per message"; Pipe.markBytesReadBase(pipe); //moves us forward so we can read the next fragment/message Pipe.releaseBatchedReads(pipe, Pipe.getWorkingBlobTailPosition(pipe), pipe.ringWalker.nextWorkingTail); } else { Pipe.decBatchRelease(pipe);//sequence fragments must cause this number to move } //ensure that the working value does not fall behind the new published tail position. //this allows peek by direct offset to be supported when needed Pipe.setWorkingTailPosition(pipe, Pipe.tailPosition(pipe)); return consumed; }
/** * Release the record which has been most recently read. * The act of releasing a record/message allows it to now be written over. * @param pipe The pipe where this message is found. * @return The total number of variable length field bytes consumed by this now released message. */ public static int releaseReadLock(Pipe pipe) { assert(Pipe.singleThreadPerPipeRead(pipe.id)); int consumed = collectConsumedCountOfBytes(pipe); //ensure we only call for new templates. if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(Pipe.isReplaying(pipe) || pipe.ringWalker.nextWorkingTail!=Pipe.getWorkingTailPosition(pipe)) : "Only call release once per message"; Pipe.markBytesReadBase(pipe); //moves us forward so we can read the next fragment/message Pipe.releaseBatchedReads(pipe, Pipe.getWorkingBlobTailPosition(pipe), pipe.ringWalker.nextWorkingTail); } else { Pipe.decBatchRelease(pipe);//sequence fragments must cause this number to move } //ensure that the working value does not fall behind the new published tail position. //this allows peek by direct offset to be supported when needed Pipe.setWorkingTailPosition(pipe, Pipe.tailPosition(pipe)); return consumed; }
/** * Release the record which has been most recently read. * The act of releasing a record/message allows it to now be written over. * @param pipe The pipe where this message is found. * @return The total number of variable length field bytes consumed by this now released message. */ public static int releaseReadLock(Pipe pipe) { assert(Pipe.singleThreadPerPipeRead(pipe.id)); int consumed = collectConsumedCountOfBytes(pipe); //ensure we only call for new templates. if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(Pipe.isReplaying(pipe) || pipe.ringWalker.nextWorkingTail!=Pipe.getWorkingTailPosition(pipe)) : "Only call release once per message"; Pipe.markBytesReadBase(pipe); //moves us forward so we can read the next fragment/message Pipe.releaseBatchedReads(pipe, Pipe.getWorkingBlobTailPosition(pipe), pipe.ringWalker.nextWorkingTail); } else { Pipe.decBatchRelease(pipe);//sequence fragments must cause this number to move } //ensure that the working value does not fall behind the new published tail position. //this allows peek by direct offset to be supported when needed Pipe.setWorkingTailPosition(pipe, Pipe.tailPosition(pipe)); return consumed; }