public static <S extends MessageSchema<S>> boolean isMonitored(Pipe<S> p) { return isMonitored(p.id); }
/** * Gets the index of a message in the pipe * @param pipe pipe to check * @return message index */ public static <S extends MessageSchema<S>> int takeMsgIdx(Pipe<S> pipe) { assert(PipeMonitor.monitor(pipe, pipe.slabRingTail.workingTailPos.value, Pipe.bytesReadBase(pipe) )); return pipe.lastMsgIdx = readValue(pipe.slabRing, pipe.slabMask, pipe.slabRingTail.workingTailPos.value++); }
public static void monitorPipe(GraphManager gm, int pipeId, File targetFile) { try { final PrintWriter target = new PrintWriter(targetFile); new ConsoleJSONDumpStage(gm, PipeMonitor.addMonitor(getPipe(gm, pipeId)), target) { @Override public void shutdown() { super.shutdown(); target.close(); } }; } catch (FileNotFoundException e) { throw new RuntimeException(e); } }
/** * Gets the index of a message in the pipe * @param pipe pipe to check * @return message index */ public static <S extends MessageSchema<S>> int takeMsgIdx(final Pipe<S> pipe) { assert(PipeMonitor.monitor(pipe, pipe.slabRingTail.workingTailPos.value, Pipe.bytesReadBase(pipe) )); return pipe.lastMsgIdx = readIntValue(pipe.slabRing, pipe.slabMask, pipe.slabRingTail.workingTailPos.value++); }
public static <S extends MessageSchema<S>> boolean isMonitored(Pipe<S> p) { return isMonitored(p.id); }
public static void monitorPipe(GraphManager gm, int pipeId, Appendable target) { ConsoleJSONDumpStage.newInstance(gm, PipeMonitor.addMonitor(getPipe(gm, pipeId)), target); }
/** * Gets the index of a message in the pipe * @param pipe pipe to check * @return message index */ public static <S extends MessageSchema<S>> int takeMsgIdx(final Pipe<S> pipe) { assert(PipeMonitor.monitor(pipe, pipe.slabRingTail.workingTailPos.value, Pipe.bytesReadBase(pipe) )); return pipe.lastMsgIdx = readIntValue(pipe.slabRing, pipe.slabMask, pipe.slabRingTail.workingTailPos.value++); }
public static <S extends MessageSchema<S>> boolean isMonitored(Pipe<S> p) { return isMonitored(p.id); }
public static <S extends MessageSchema<S>> boolean tryReadFragment(Pipe<S> pipe) { assert( (!PipeReader.hasContentToRead(pipe)) || PipeMonitor.monitor(pipe, pipe.ringWalker.nextWorkingTail, Pipe.bytesReadBase(pipe) ) ); assert(pipe.usingHighLevelAPI); assert(Pipe.singleThreadPerPipeRead(pipe.id)); assert(null!=pipe.ringWalker) : "NullPointer, double check that pipe was passed into super constructor of stage."; if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(StackStateWalker.isSeqStackEmpty(pipe.ringWalker)) : "Error the seqStack should be empty"; return StackStateWalker.prepReadMessage(pipe, pipe.ringWalker); } else { return StackStateWalker.prepReadFragment(pipe, pipe.ringWalker); } }
public static <S extends MessageSchema<S>> boolean monitor(Pipe<S> sourcePipe, long sourceSlabPos, int sourceBlobPos) { if (isMonitored(sourcePipe.id)) { Pipe<S> localTarget = targetPipes[sourcePipe.id]; //will report errors if the logger does not keep this pipe clear //but it also blocks to ensure nothing is ever lost Pipe.presumeRoomForWrite(localTarget); Pipe.copyFragment(sourcePipe, sourceSlabPos, sourceBlobPos, localTarget); } return true; }
public static <S extends MessageSchema<S>> boolean tryReadFragment(Pipe<S> pipe) { assert( (!PipeReader.hasContentToRead(pipe)) || PipeMonitor.monitor(pipe, pipe.ringWalker.nextWorkingTail, Pipe.bytesReadBase(pipe) ) ); assert(pipe.usingHighLevelAPI); assert(Pipe.singleThreadPerPipeRead(pipe.id)); assert(null!=pipe.ringWalker) : "NullPointer, double check that pipe was passed into super constructor of stage."; if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(StackStateWalker.isSeqStackEmpty(pipe.ringWalker)) : "Error the seqStack should be empty"; return StackStateWalker.prepReadMessage(pipe, pipe.ringWalker); } else { return StackStateWalker.prepReadFragment(pipe, pipe.ringWalker); } }
public static <S extends MessageSchema<S>> boolean monitor(Pipe<S> sourcePipe, long sourceSlabPos, int sourceBlobPos) { if (isMonitored(sourcePipe.id)) { Pipe<S> localTarget = targetPipes[sourcePipe.id]; //will report errors if the logger does not keep this pipe clear //but it also blocks to ensure nothing is ever lost Pipe.presumeRoomForWrite(localTarget); Pipe.copyFragment(sourcePipe, sourceSlabPos, sourceBlobPos, localTarget); } return true; }
public static <S extends MessageSchema<S>> boolean tryReadFragment(Pipe<S> pipe) { assert( (!PipeReader.hasContentToRead(pipe)) || PipeMonitor.monitor(pipe, pipe.ringWalker.nextWorkingTail, Pipe.bytesReadBase(pipe) ) ); assert(pipe.usingHighLevelAPI); assert(Pipe.singleThreadPerPipeRead(pipe.id)); assert(null!=pipe.ringWalker) : "NullPointer, double check that pipe was passed into super constructor of stage."; if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(StackStateWalker.isSeqStackEmpty(pipe.ringWalker)) : "Error the seqStack should be empty"; return StackStateWalker.prepReadMessage(pipe, pipe.ringWalker); } else { return StackStateWalker.prepReadFragment(pipe, pipe.ringWalker); } }
public static <S extends MessageSchema<S>> boolean monitor(Pipe<S> sourcePipe, long sourceSlabPos, int sourceBlobPos) { if (isMonitored(sourcePipe.id)) { Pipe<S> localTarget = targetPipes[sourcePipe.id]; //will report errors if the logger does not keep this pipe clear //but it also blocks to ensure nothing is ever lost Pipe.presumeRoomForWrite(localTarget); Pipe.copyFragment(sourcePipe, sourceSlabPos, sourceBlobPos, localTarget); } return true; }
|| PipeMonitor.monitor(pipeIn, pipeIn.ringWalker.nextWorkingTail, Pipe.bytesReadBase(pipeIn)
public static synchronized <S extends MessageSchema<S>> Pipe<S> addMonitor(Pipe<S> sourcePipe) { //can only have 1 monitoring pipe, that pipe however could feed a replicator stage if (isMonitored(sourcePipe.id)) { throw new UnsupportedOperationException("This pipe is already configured to be monitored "+sourcePipe); } ///////////// if (targetPipes.length <= sourcePipe.id) { Pipe[] newTargetPipes = new Pipe[sourcePipe.id+1]; System.arraycopy(targetPipes, 0, newTargetPipes, 0, targetPipes.length); targetPipes = newTargetPipes; } //this monitor pipe is the same size as the original //NOTE we could make this bigger or smaller in the future as needed ... Pipe pipe = new Pipe(sourcePipe.config()); targetPipes[sourcePipe.id] = pipe; pipe.initBuffers(); return pipe; }
|| PipeMonitor.monitor(pipeIn, pipeIn.ringWalker.nextWorkingTail, Pipe.bytesReadBase(pipeIn)
public static synchronized <S extends MessageSchema<S>> Pipe<S> addMonitor(Pipe<S> sourcePipe) { //can only have 1 monitoring pipe, that pipe however could feed a replicator stage if (isMonitored(sourcePipe.id)) { throw new UnsupportedOperationException("This pipe is already configured to be monitored "+sourcePipe); } ///////////// if (targetPipes.length <= sourcePipe.id) { Pipe[] newTargetPipes = new Pipe[sourcePipe.id+1]; System.arraycopy(targetPipes, 0, newTargetPipes, 0, targetPipes.length); targetPipes = newTargetPipes; } //this monitor pipe is the same size as the original //NOTE we could make this bigger or smaller in the future as needed ... Pipe pipe = new Pipe(sourcePipe.config()); targetPipes[sourcePipe.id] = pipe; pipe.initBuffers(); return pipe; }
|| PipeMonitor.monitor(pipeIn, pipeIn.ringWalker.nextWorkingTail, Pipe.bytesReadBase(pipeIn)
public static synchronized <S extends MessageSchema<S>> Pipe<S> addMonitor(Pipe<S> sourcePipe) { //can only have 1 monitoring pipe, that pipe however could feed a replicator stage if (isMonitored(sourcePipe.id)) { throw new UnsupportedOperationException("This pipe is already configured to be monitored "+sourcePipe); } ///////////// if (targetPipes.length <= sourcePipe.id) { Pipe[] newTargetPipes = new Pipe[sourcePipe.id+1]; System.arraycopy(targetPipes, 0, newTargetPipes, 0, targetPipes.length); targetPipes = newTargetPipes; } //this monitor pipe is the same size as the original //NOTE we could make this bigger or smaller in the future as needed ... Pipe pipe = new Pipe(sourcePipe.config()); targetPipes[sourcePipe.id] = pipe; pipe.initBuffers(); return pipe; }