- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {Charset c =
String charsetName;Charset.forName(charsetName)
Charset.defaultCharset()
ContentType contentType;contentType.getCharset()
- Smart code suggestions by Codota
}
public static OrderSupervisorStage newInstance(GraphManager graphManager, Pipe<ServerResponseSchema>[] inputPipes, Pipe<HTTPLogResponseSchema> log, //Pipe<AlertNoticeSchema> alerts, //can be null...new pipe schema for alerts Pipe<NetPayloadSchema>[] outgoingPipes, ServerCoordinator coordinator, boolean isTLS) { return new OrderSupervisorStage(graphManager, inputPipes, log, outgoingPipes, coordinator); }
private boolean checkSeqAndProcessInput(final Pipe<ServerResponseSchema> sourcePipe, int pipeIdx, boolean keepWorking, int peekMsgId, int myPipeIdx, long channelId, int sequenceNo, int idx, int expected) { if ((0==sequenceNo) || (sequenceNo >= expected)) { if ((0==sequenceNo) || (expected == sequenceNo)) { keepWorking = processExpectedSequenceValue(sourcePipe, pipeIdx, keepWorking, peekMsgId, myPipeIdx, sequenceNo, channelId, idx, expected); //System.out.println("sequence matched "+sequenceNo); } else { //TODO: why get backs... //System.out.println("for channel:"+channelId+" waiting for: "+expected+" but got "+sequenceNo ); assert(hangDetect(pipeIdx, sequenceNo, channelId, expected)); assert(sequenceNo>expected) : "found smaller than expected sequenceNo, they should never roll back"; assert(Pipe.bytesReadBase(sourcePipe)>=0); keepWorking = false; } } else { keepWorking = badSequenceNumberProcessing(channelId, sequenceNo, expected); } return keepWorking; }
private int copyDataBlock(final Pipe<ServerResponseSchema> sourcePipe, int pipeIdx, int peekMsgId, int myPipeIdx, int sequenceNo, long channelId, boolean beginningOfResponse) { failureIterations = -1;//clears the flag to let hang detector know we are ok. Pipe<NetPayloadSchema> outPipe = outgoingPipes[myPipeIdx]; assert(recordInputs(channelId, sequenceNo, pipeIdx)); if (!isTLS) { } else { finishHandshake(outPipe, channelId); } assert(Pipe.bytesReadBase(sourcePipe)>=0); int responses = copyDataBlock(sourcePipe, peekMsgId, myPipeIdx, sequenceNo, channelId, beginningOfResponse); assert(Pipe.bytesReadBase(sourcePipe)>=0); return responses; }
if (-1 == expectedPipe) { expectedSquenceNosPipeIdx[idx]=(short)pipeIdx; int responses = copyDataBlock(sourcePipe, pipeIdx, peekMsgId, myPipeIdx, sequenceNo, channelId, true); int responses = copyDataBlock(sourcePipe, pipeIdx, peekMsgId, myPipeIdx, sequenceNo, channelId, false); keepWorking = false; //break out } else { assert(hangDetect(pipeIdx, sequenceNo, channelId, expected));
/** * Data arrives from random input pipes, but each message has a channel id and squence id. * Data is ordered by sequence number and sent to the pipe from the pool belonging to that specific channel id * @param graphManager * @param inputPipes _in_ The server response which will be supervised. * @param log _out_ The log output pipe. * @param outgoingPipes _out_ The net payload after order is enforced. * @param coordinator * @param isTLS */ public OrderSupervisorStage(GraphManager graphManager, Pipe<ServerResponseSchema>[][] inputPipes, Pipe<HTTPLogResponseSchema> log, Pipe<NetPayloadSchema>[] outgoingPipes, ServerCoordinator coordinator, boolean isTLS) { this(graphManager, join(inputPipes), log, outgoingPipes, coordinator); }
private boolean processInputData(final Pipe<ServerResponseSchema> sourcePipe, int pipeIdx, boolean keepWorking, int peekMsgId, int myPipeIdx, long channelId) { int sequenceNo = Pipe.peekInt(sourcePipe, 3); //read the next non-blocked pipe, sequenceNo is never reset to zero //every number is used even if there is an exception upon write. int idx = (int)(channelId & channelBitsMask); /////////////////// //clear when we discover a new connection /////////////////// if ((expectedSquenceNosChannelId[idx]!=channelId) || (sequenceNo==0)) { expectedSquenceNosSequence[idx] = 0; expectedSquenceNosChannelId[idx] = channelId; } return checkSeqAndProcessInput(sourcePipe, pipeIdx, keepWorking, peekMsgId, myPipeIdx, channelId, sequenceNo, idx, expectedSquenceNosSequence[idx]); }
return loadConnectionDataAndPublish(input, myPipeIdx, channelId, beginningOfResponse, output, outputStream, expSeq, len, Pipe.takeInt(input), Pipe.byteBackingArray(meta, input),
OrderSupervisorStage.newInstance(gm, inputPipes, null, outgoingPipes,
Pipe<NetPayloadSchema>[] outgoingPipes, ServerCoordinator coordinator) { super(graphManager, inputPipes, null==log ? outgoingPipes : join(outgoingPipes,log));
public static void buildOrderingSupers(GraphManager graphManager, ServerCoordinator coordinator, Pipe<ServerResponseSchema>[][] fromModule, Pipe<HTTPLogResponseSchema>[] log, Pipe<NetPayloadSchema>[][] perTrackFromSuper) { int track = fromModule.length; while (--track>=0) { OrderSupervisorStage wrapSuper = new OrderSupervisorStage(graphManager, fromModule[track], log[track], perTrackFromSuper[track], coordinator);//ensure order coordinator.processNota(graphManager, wrapSuper); } }