@Override public boolean isReady() { return PipeWriter.hasRoomForWrite(pipe); }
@Override public boolean isReady() { return PipeWriter.hasRoomForWrite(pipe); }
@Override public boolean isReady() { return PipeWriter.hasRoomForWrite(pipe); }
@Override protected void processCloseEvent(byte[] hostBacking, int hostPos, int hostLen, int hostMask, int port) { logger.info("connection was closed now attempting reconnect"); while (!PipeWriter.hasRoomForWrite(control)) { logger.info("error this pipe should be empty since it only contains reset comands. Make pipe longer"); } publishReconnect(); }
@Override public void run() { if (0 == shutdownCountdown) { int j = output.length; while (--j>=0) { if (!PipeWriter.hasRoomForWrite(output[j])) { return; } } PipeWriter.publishEOF(output); requestShutdown(); return; } int i = input.length; while (--i >= 0) { if (PipeWriter.hasRoomForWrite(output[i])) { processRequest(input[i], output[i]); } } }
/** * Does not require tryWrite to be called first, we only need to check that there is room to write. This is for supporting buffer write * to determine if we have data that can be written. */ public static ByteBuffer[] wrappedUnstructuredLayoutBufferOpen(Pipe<?> target, int loc) { assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); assert(PipeWriter.hasRoomForWrite(target)) : "must protect by ensuring we have room first"; return Pipe.wrappedWritingBuffers(Pipe.storeBlobWorkingHeadPosition(target), target, target.maxVarLen); }
/** * Does not require tryWrite to be called first, we only need to check that there is room to write. This is for supporting buffer write * to determine if we have data that can be written. */ public static ByteBuffer[] wrappedUnstructuredLayoutBufferOpen(Pipe<?> target, int loc) { assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); assert(PipeWriter.hasRoomForWrite(target)) : "must protect by ensuring we have room first"; return Pipe.wrappedWritingBuffers(Pipe.storeBlobWorkingHeadPosition(target), target, target.maxVarLen); }
/** * Does not require tryWrite to be called first, we only need to check that there is room to write. This is for supporting buffer write * to determine if we have data that can be written. */ public static ByteBuffer[] wrappedUnstructuredLayoutBufferOpen(Pipe<?> target, int maxLength, int loc) { assert(maxLength>=0) : "bad length of "+maxLength; assert(maxLength<=target.maxVarLen+1); assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); assert(PipeWriter.hasRoomForWrite(target)) : "must protect by ensuring we have room first"; return Pipe.wrappedWritingBuffers(Pipe.storeBlobWorkingHeadPosition(target), target, maxLength); }
/** * Does not require tryWrite to be called first, we only need to check that there is room to write. This is for supporting buffer write * to determine if we have data that can be written. */ public static ByteBuffer[] wrappedUnstructuredLayoutBufferOpen(Pipe<?> target, int maxLength, int loc) { assert(maxLength>=0) : "bad length of "+maxLength; assert(maxLength<=target.maxVarLen+1); assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); assert(PipeWriter.hasRoomForWrite(target)) : "must protect by ensuring we have room first"; return Pipe.wrappedWritingBuffers(Pipe.storeBlobWorkingHeadPosition(target), target, maxLength); }
/** * Does not require tryWrite to be called first, we only need to check that there is room to write. This is for supporting buffer write * to determine if we have data that can be written. */ public static ByteBuffer[] wrappedUnstructuredLayoutBufferOpen(Pipe<?> target, int maxLength, int loc) { assert(maxLength>=0) : "bad length of "+maxLength; assert(maxLength<=target.maxVarLen+1); assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); assert(PipeWriter.hasRoomForWrite(target)) : "must protect by ensuring we have room first"; return Pipe.wrappedWritingBuffers(Pipe.storeBlobWorkingHeadPosition(target), target, maxLength); }
/** * Does not require tryWrite to be called first, we only need to check that there is room to write. This is for supporting buffer write * to determine if we have data that can be written. */ public static ByteBuffer[] wrappedUnstructuredLayoutBufferOpen(Pipe<?> target, int loc) { assert(LOCUtil.isLocOfAnyType(loc, TypeMask.TextASCII, TypeMask.TextASCIIOptional, TypeMask.TextUTF8, TypeMask.TextUTF8Optional, TypeMask.ByteVector, TypeMask.ByteVectorOptional)): "Value found "+LOCUtil.typeAsString(loc); assert(PipeWriter.hasRoomForWrite(target)) : "must protect by ensuring we have room first"; return Pipe.wrappedWritingBuffers(Pipe.storeBlobWorkingHeadPosition(target), target, target.maxVarLen); }
@Override public void run() { //TODO: (a short easy task) twitter wants a growing back-off here, we must record the last time we connected and DO NOT read until sufficient time has passed. while (PipeWriter.hasRoomForWrite(output) && PipeReader.tryReadFragment(control)) { int id = PipeReader.getMsgIdx(control); switch (id) { case -1: requestShutdown(); return; default: streamingRequest(output, id); } PipeReader.releaseReadLock(control); } }
@Override public void run() { if (moveInProgress) { if (!PipeReader.tryMoveSingleMessage(input, output)) { return; } else { moveInProgress = false; PipeReader.releaseReadLock(input); } } while (PipeWriter.hasRoomForWrite(output) && PipeReader.tryReadFragment(input)) { count++; int value = PipeReader.readInt(input, varFieldLoc); if (0 != (mask&value)) { if (!PipeReader.tryMoveSingleMessage(input, output)) { moveInProgress = true; return; } } PipeReader.releaseReadLock(input); } }
@Override public void run() { while ((activeChannelId != -1) && (null!=activeOutput) && PipeWriter.hasRoomForWrite(activeOutput) ) { PipeWriter.presumeWriteFragment(activeOutput, ServerResponseSchema.MSG_TOCHANNEL_100); PipeWriter.writeLong(activeOutput,ServerResponseSchema.MSG_TOCHANNEL_100_FIELD_CHANNELID_21, activeChannelId); PipeWriter.writeInt(activeOutput,ServerResponseSchema.MSG_TOCHANNEL_100_FIELD_SEQUENCENO_23, activeSequenceNo); DataOutputBlobWriter<ServerResponseSchema> outputStream = PipeWriter.outputStream(activeOutput); DataOutputBlobWriter.openField(outputStream); appendRemainingPayload(activeOutput); } //only do when previous is complete. if (null == activeOutput) { int i = this.inputs.length; while ((--i >= 0) && (activeChannelId == -1)) { process(inputs[i], outputs[i]); } } }
while (PipeWriter.hasRoomForWrite(output) && PipeReader.tryReadFragment(input)) { updateFile = true; byte[] backing = PipeReader.readBytesBackingArray(input, varFieldLoc);
|| (!PipeWriter.hasRoomForWrite(pipeOut)) || PipeMonitor.monitor(pipeIn, pipeIn.ringWalker.nextWorkingTail,
|| (!PipeWriter.hasRoomForWrite(pipeOut)) || PipeMonitor.monitor(pipeIn, pipeIn.ringWalker.nextWorkingTail,
&& PipeWriter.hasRoomForWrite(output) && Pipe.hasContentToRead(input)) {
|| (!PipeWriter.hasRoomForWrite(pipeOut)) || PipeMonitor.monitor(pipeIn, pipeIn.ringWalker.nextWorkingTail,
return msgCommandChannel.publishFailableOnPrivateTopic(token, writable); } else { if (msgCommandChannel.goHasRoom() && PipeWriter.hasRoomForWrite(msgCommandChannel.messagePubSub)) { PubSubWriter pw = (PubSubWriter) Pipe.outputStream(msgCommandChannel.messagePubSub);