private static int processShutdown(Pipe<NetPayloadSchema> selectedInput, int messageIdx) { assert(-1 == messageIdx) : "messageIdx:"+messageIdx; if (-1 != messageIdx) { throw new UnsupportedOperationException("bad id "+messageIdx+" raw data \n"+selectedInput); } Pipe.confirmLowLevelRead(selectedInput, Pipe.EOF_SIZE); Pipe.readNextWithoutReleasingReadLock(selectedInput); Pipe.releaseAllPendingReadLock(selectedInput);; return messageIdx;//do not loop again just exit now }
private int readNext() { if (Pipe.hasContentToRead(logFile)) { int idx = Pipe.takeMsgIdx(logFile); if (idx>=0) { int len = DataInputBlobReader.accumLowLevelAPIField(logFileInput); Pipe.confirmLowLevelRead(logFile, Pipe.sizeOf(RawDataSchema.instance, RawDataSchema.MSG_CHUNKEDSTREAM_1)); Pipe.readNextWithoutReleasingReadLock(logFile); return len; } else { System.out.println("end detected"); Pipe.confirmLowLevelRead(logFile, Pipe.EOF_SIZE); Pipe.readNextWithoutReleasingReadLock(logFile); return -1; } } else { return 0; } }
public static void appendNextFieldToReader(LittleEndianDataInputBlobReader reader, Pipe<RawDataSchema> targetPipe) { while (Pipe.hasContentToRead(targetPipe) && Pipe.peekInt(targetPipe) >=0) { Pipe.takeMsgIdx(targetPipe); accumLowLevelAPIField(reader); Pipe.readNextWithoutReleasingReadLock(targetPipe); Pipe.confirmLowLevelRead(targetPipe, Pipe.sizeOf(targetPipe, RawDataSchema.MSG_CHUNKEDSTREAM_1)); } }
Pipe.readNextWithoutReleasingReadLock(input[idx]);
public static void appendNextFieldToReader(LittleEndianDataInputBlobReader reader, Pipe<RawDataSchema> targetPipe) { while (Pipe.hasContentToRead(targetPipe) && Pipe.peekInt(targetPipe) >=0) { Pipe.takeMsgIdx(targetPipe); accumLowLevelAPIField(reader); Pipe.readNextWithoutReleasingReadLock(targetPipe); Pipe.confirmLowLevelRead(targetPipe, Pipe.sizeOf(targetPipe, RawDataSchema.MSG_CHUNKEDSTREAM_1)); } }
public static void appendNextFieldToReader(LittleEndianDataInputBlobReader reader, Pipe<RawDataSchema> targetPipe) { while (Pipe.hasContentToRead(targetPipe) && Pipe.peekInt(targetPipe) >=0) { Pipe.takeMsgIdx(targetPipe); accumLowLevelAPIField(reader); Pipe.readNextWithoutReleasingReadLock(targetPipe); Pipe.confirmLowLevelRead(targetPipe, Pipe.sizeOf(targetPipe, RawDataSchema.MSG_CHUNKEDSTREAM_1)); } }
private static void processBegin( HTTP1xRouterStage< ?, ?, ?, ?> that, final int idx, Pipe<NetPayloadSchema> selectedInput) { assert(hasNoActiveChannel(that.inputChannels[idx])) : "Can not begin a new connection if one is already in progress."; assert(0==Pipe.releasePendingByteCount(selectedInput)); // ServerCoordinator.inServerCount.incrementAndGet(); // ServerCoordinator.start = System.nanoTime(); //logger.info("accumulate begin"); //keep this as the base for our counting of sequence that.sequences[idx] = Pipe.takeInt(selectedInput); Pipe.confirmLowLevelRead(selectedInput, SIZE_OF_BEGIN); //Pipe.releaseReadLock(selectedInput); Pipe.readNextWithoutReleasingReadLock(selectedInput); //do not return, we will go back arround the while again. //starting a new sequence of data, all the old data including this begin must be released. Pipe.releasePendingAsReadLock(selectedInput, 0); }
public static boolean accumulateInputStream(Pipe<RawDataSchema> pipe) { int msgIdx = Pipe.takeMsgIdx(pipe); boolean isEnd; if (RawDataSchema.MSG_CHUNKEDSTREAM_1 == msgIdx) { isEnd = DataInputBlobReader.accumLowLevelAPIField(Pipe.inputStream(pipe))<=0; Pipe.confirmLowLevelRead(pipe, Pipe.sizeOf(pipe, RawDataSchema.MSG_CHUNKEDSTREAM_1)); } else { //eof isEnd = true; Pipe.confirmLowLevelRead(pipe, Pipe.EOF_SIZE); } Pipe.readNextWithoutReleasingReadLock(pipe); return isEnd; }
public static boolean accumulateInputStream(Pipe<RawDataSchema> pipe) { int msgIdx = Pipe.takeMsgIdx(pipe); boolean isEnd; if (RawDataSchema.MSG_CHUNKEDSTREAM_1 == msgIdx) { isEnd = DataInputBlobReader.accumLowLevelAPIField(Pipe.inputStream(pipe))<=0; Pipe.confirmLowLevelRead(pipe, Pipe.sizeOf(pipe, RawDataSchema.MSG_CHUNKEDSTREAM_1)); } else { //eof isEnd = true; Pipe.confirmLowLevelRead(pipe, Pipe.EOF_SIZE); } Pipe.readNextWithoutReleasingReadLock(pipe); return isEnd; }
Pipe.readNextWithoutReleasingReadLock(input[idx]);
Pipe.readNextWithoutReleasingReadLock(input); Pipe.releasePendingAsReadLock(input, consumed);
Pipe.readNextWithoutReleasingReadLock(selectedInput);
Pipe.readNextWithoutReleasingReadLock(selectedInput); Pipe.releasePendingAsReadLock(selectedInput, 0);
Pipe.readNextWithoutReleasingReadLock(localInputPipe); Pipe.readNextWithoutReleasingReadLock(localInputPipe);