public static boolean isTooSmall(int queueLength, int maxMessageSize, PipeConfig<?> config) { return queueLength>config.minimumFragmentsOnPipe() || maxMessageSize>config.maxVarLenSize(); }
public static void growCommandCountRoom(MsgCommandChannel<?> cmd, int count) { if (cmd.isInit) { throw new UnsupportedOperationException("Too late, growCommandCountRoom method must be called in define behavior."); } PipeConfig<TrafficOrderSchema> goConfig = cmd.pcm.getConfig(TrafficOrderSchema.class); cmd.pcm.addConfig(count + goConfig.minimumFragmentsOnPipe(), 0, TrafficOrderSchema.class); }
public <S extends MessageSchema<S>> void ensureSize(Class<S> clazz, int queueLength, int maxMessageSize) { int idx = findIndex(clazz); if (idx>=0) { //we found it PipeConfig<S> oldConfig = (PipeConfig<S>)configs[idx]; int oldQueueLen = oldConfig.minimumFragmentsOnPipe(); int oldMaxVarLenSize = oldConfig.maxVarLenSize(); if (queueLength>oldQueueLen || maxMessageSize>oldMaxVarLenSize) { addConfig(Math.max(oldQueueLen,queueLength), Math.max(oldMaxVarLenSize, maxMessageSize), clazz); } } else { //add it was not found addConfig(Math.max(queueLength,defaultMinimumFragmentsOnPipe),Math.max(maxMessageSize, defaultMaximumLengthOfVariableLengthFields),clazz); } }
oldQueueLen = oldConfig.minimumFragmentsOnPipe(); oldMaxVarLenSize = oldConfig.maxVarLenSize();
oldQueueLen = oldConfig.minimumFragmentsOnPipe(); oldMaxVarLenSize = oldConfig.maxVarLenSize();
public JoinBlockingBehavior(MsgRuntime<?,?,?> msgRuntime, Pipe<RawDataSchema>[] inputPipes, String[] targetTopics, TargetSelector selector) { this.inputPipes = inputPipes; this.selector = selector; PipeConfigManager pcm = new PipeConfigManager(4, MsgRuntime.defaultCommandChannelLength, MsgRuntime.defaultCommandChannelMaxPayload); BuilderImpl builder = MsgRuntime.builder(msgRuntime); int dataLen = PronghornStage.maxVarLength(inputPipes); int count = inputPipes[0].config().minimumFragmentsOnPipe(); //build each of the target publish services so they can be indexed by targetTopics position targetService = new PubSubFixedTopicService[targetTopics.length]; int i = targetTopics.length; while (--i>=0) { targetService[i] = builder.newCommandChannel(msgRuntime.constructingParallelInstance(), pcm) .newPubSubService(targetTopics[i], count, dataLen); } }
assert(input.config().minimumFragmentsOnPipe()>2) : "input pipe must be large enought to hold 2 reads open while new writes continue";