private boolean processCountsLoop(String label, long[] counts, long[] totalCounts, int i, long newMessages, long totalMessages, int limit) throws IOException { assert(limit>=1) : "If we are here there should be some counts to report."; while (i<limit) { newMessages += counts[i]; writeToConsole(counts, totalCounts, i); totalMessages += totalCounts[i]; i++; } return cleanupReport(label, newMessages, totalMessages); }
public static void newInstance(GraphManager gm, Pipe[] input, Appendable[] out) { int i = input.length; while (--i>=0) { newInstance(gm,input[i],out[i]); } }
@Override public void run() { int i = input.length; while (--i >= 0) { cleanPipe(i); } }
public static PipeCleanerStage newInstance(GraphManager gm, Pipe pipe) { return new PipeCleanerStage(gm, pipe); }
public static ConsoleJSONDumpStage newInstance(GraphManager graphManager, Pipe input, Appendable out) { return new ConsoleJSONDumpStage(graphManager, input, out); }
public static <T extends MessageSchema<T>> ConsoleSummaryStage<T> newInstance(GraphManager gm, Pipe<T> input) { return new ConsoleSummaryStage(gm, input); }
public static <T extends MessageSchema<T>> PipeNoOp<T> newInstance(GraphManager gm, Pipe<T> pipe) { return new PipeNoOp<T>(gm, pipe); }
@Override public void shutdown() { super.shutdown(); target.close(); } };
private boolean processCounts(String label, long[] counts, long[] totalCounts) throws IOException { console.setLength(0); return processCountsLoop(label, counts, totalCounts, 0, 0, 0, counts.length); }
private int doneCount(PipeCleanerStage[] cleaners) { int count; { int k = cleaners.length; int c=0; while (--k>=0) { c+=cleaners[k].getTotalSlabCount(); } count = c; } return count; }
@Override public void shutdown() { super.shutdown(); ConsoleJSONDumpStage.this.requestShutdown(); } };
@Override public void run() { if (--iterations>0) { writer.run(); } else { requestShutdown(); } }
@Override public Class loadClass(String name) throws ClassNotFoundException { //if we want a normal class use the normal class loader if(!name.equals(this.name)) { return super.loadClass(name); } //returning with defineClass helps reduce the risk that we may try to define the name again. return defineClass(name, classData , 0, classData.length); }
private void cleanPipe(int sourcePos) { Pipe<T> pipe = this.input[sourcePos]; long head = Pipe.headPosition(pipe); long contentRemaining = head-tail[sourcePos]; if (contentRemaining>0) { totalSlabCount += contentRemaining; int byteHead = Pipe.getBlobHeadPosition(pipe); int bTail = byteTail[sourcePos]; if (byteHead >= bTail) { totalBlobCount += (byteHead-bTail); } else { totalBlobCount += ((long) (Pipe.blobMask(pipe)&byteHead) +(long)(pipe.sizeOfBlobRing-(Pipe.blobMask(pipe)&bTail)) ); } Pipe.publishBlobWorkingTailPosition(pipe, byteTail[sourcePos] = byteHead); Pipe.publishWorkingTailPosition(pipe, tail[sourcePos] = head); } else { if (Pipe.isEndOfPipe(pipe, tail[sourcePos]) && Pipe.contentRemaining(pipe)==0) { requestShutdown(); } } }
public static PipeCleanerStage newInstance(GraphManager gm, Pipe[] pipes, String label) { return new PipeCleanerStage(gm, pipes, label); }
public static ConsoleJSONDumpStage newInstance(GraphManager graphManager, Pipe input, Appendable out, boolean showBytesAsUTF) { return new ConsoleJSONDumpStage(graphManager, input, out, showBytesAsUTF); }
public static void newInstance(GraphManager gm, Pipe[] input) { int i = input.length; while (--i>=0) { newInstance(gm,input[i]); } }
public static PipeCleanerStage newInstance(GraphManager gm, Pipe[] pipes) { return new PipeCleanerStage(gm, pipes, ""); }
public static ConsoleJSONDumpStage newInstance(GraphManager graphManager, Pipe input) { return new ConsoleJSONDumpStage(graphManager, input); }
public static PipeCleanerStage newInstance(GraphManager gm, Pipe pipe, String label) { return new PipeCleanerStage(gm, pipe, label); }