当前位置: 首页>>代码示例>>Java>>正文


Java PronghornStage类代码示例

本文整理汇总了Java中com.ociweb.pronghorn.stage.PronghornStage的典型用法代码示例。如果您正苦于以下问题:Java PronghornStage类的具体用法?Java PronghornStage怎么用?Java PronghornStage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PronghornStage类属于com.ociweb.pronghorn.stage包,在下文中一共展示了PronghornStage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: logStageScheduleRates

import com.ociweb.pronghorn.stage.PronghornStage; //导入依赖的package包/类
protected void logStageScheduleRates() {
    int totalStages = GraphManager.countStages(gm);
       for(int i=1;i<=totalStages;i++) {
           PronghornStage s = GraphManager.getStage(gm, i);
           if (null != s) {
               
               Object rate = GraphManager.getNota(gm, i, GraphManager.SCHEDULE_RATE, null);
               if (null == rate) {
                   logger.debug("{} is running without breaks",s);
               } else  {
                   logger.debug("{} is running at rate of {}",s,rate);
               }
           }
           
       }
}
 
开发者ID:oci-pronghorn,项目名称:GreenLightning,代码行数:17,代码来源:MsgRuntime.java

示例2: cloneStagesWithNotaKey

import com.ociweb.pronghorn.stage.PronghornStage; //导入依赖的package包/类
public static GraphManager cloneStagesWithNotaKey(GraphManager m, Object key) {
	GraphManager clone = new GraphManager();
	//register each stage
	int i = m.stageIdToStage.length;
	while (--i>=0) {
		PronghornStage stage = m.stageIdToStage[i];
		if (null!=stage) {
			//copy this stage if it has the required key
			if (m != getNota(m, stage, key, m)) {
				copyStage(m, clone, stage);
				copyNotasForStage(m, clone, stage);
			}
		}
	}
	return clone;
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:17,代码来源:GraphManager.java

示例3: getStageWithNotaKey

import com.ociweb.pronghorn.stage.PronghornStage; //导入依赖的package包/类
public static PronghornStage getStageWithNotaKey(GraphManager m, Object key, int ordinal) {
   
   int i = m.stageIdToStage.length;
   while (--i>=0) {
       PronghornStage stage = m.stageIdToStage[i];
       if (null!=stage) {
           //count this stage if it has the required key
           if (null != getNota(m, stage, key, null)) {
               if (--ordinal<=0) {
                   return stage;
               }
           }
       }
   }
   throw new UnsupportedOperationException("Invalid configuration. Unable to find requested ordinal "+ordinal);
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:17,代码来源:GraphManager.java

示例4: cloneStagesWithNotaKeyValue

import com.ociweb.pronghorn.stage.PronghornStage; //导入依赖的package包/类
public static GraphManager cloneStagesWithNotaKeyValue(GraphManager m, Object key, Object value) {
	GraphManager clone = new GraphManager();
	//register each stage
	int i = m.stageIdToStage.length;
	while (--i>=0) {
		PronghornStage stage = m.stageIdToStage[i];
		if (null!=stage) {
			//copy this stage if it has the required key
			if (value.equals(getNota(m, stage, key, null))) {
				copyStage(m, clone, stage);
				copyNotasForStage(m, clone, stage);
			}
		}
	}
	return clone;
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:17,代码来源:GraphManager.java

示例5: isInputLocal

import com.ociweb.pronghorn.stage.PronghornStage; //导入依赖的package包/类
private static boolean isInputLocal(int startIdx,
									int stopIdx, 
		                            GraphManager gm, 
		                            PronghornStage[] stages, 
		                            int[] script,
		                            int goalId) {
	//scan for an output which matches this goal Id
	
	for(int i = startIdx; i<=stopIdx; i++) {
		int stageId = stages[script[i]].stageId;
		int outC = GraphManager.getOutputPipeCount(gm, stageId);
		for(int k = 1; k <= outC; k++) {
			if (goalId == GraphManager.getOutputPipe(gm, stageId, k).id) {
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:20,代码来源:ScriptedNonThreadScheduler.java

示例6: copyStage

import com.ociweb.pronghorn.stage.PronghornStage; //导入依赖的package包/类
private static void copyStage(GraphManager m, GraphManager clone, PronghornStage stage) {
	int stageId = beginStageRegister(clone, stage);
	
	int idx;
	int ringId;
	
	idx = m.stageIdToInputsBeginIdx[stageId];
	while (-1 != (ringId=m.multInputIds[idx++])) {	
		assert(0==Pipe.contentRemaining(m.pipeIdToPipe[ringId]));
		regInput(clone, m.pipeIdToPipe[ringId], stageId);					
	}				
	
	idx = m.stageIdToOutputsBeginIdx[stageId];
	while (-1 != (ringId=m.multOutputIds[idx++])) {					
		assert(0==Pipe.contentRemaining(m.pipeIdToPipe[ringId]));
		regOutput(clone, m.pipeIdToPipe[ringId], stageId);					
	}		
	
	endStageRegister(clone, stage);
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:21,代码来源:GraphManager.java

示例7: register

import com.ociweb.pronghorn.stage.PronghornStage; //导入依赖的package包/类
public static void register(GraphManager gm, PronghornStage stage, Pipe[] inputs, Pipe[] outputs) {
	
	synchronized(gm.lock) {
		int stageId = beginStageRegister(gm, stage);
		setStateToNew(gm, stageId);
		
		int i=0;
		int limit = inputs.length;
		while (i<limit) {
			regInput(gm,inputs,stageId,i,inputs[i++]);
		}
		
		//loop over outputs
		i = 0;
		limit = outputs.length;
		while (i<limit) {
			regOutput(gm, outputs, stageId, i, outputs[i++]);
		}
		
		endStageRegister(gm, stage);
								
	}
	
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:25,代码来源:GraphManager.java

示例8: getOutputStage

import com.ociweb.pronghorn.stage.PronghornStage; //导入依赖的package包/类
public static PronghornStage getOutputStage(GraphManager m, int ordinal) {
    int count = 0;
    int i = m.stageIdToStage.length;
    while (--i>=0) {
        if (null!=m.stageIdToStage[i]) {                
            //an input stage is one that has no input ring buffers
            if (-1 == m.multOutputIds[m.stageIdToOutputsBeginIdx[m.stageIdToStage[i].stageId]]) {
                if (!stageForMonitorData(m, m.stageIdToStage[i])) {
                    if (++count==ordinal) {
                        return m.stageIdToStage[i];
                    }
                }
            }
        }
    }
    throw new UnsupportedOperationException("Invalid configuration. Unable to find requested output ordinal "+ordinal);
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:18,代码来源:GraphManager.java

示例9: populateRanks

import com.ociweb.pronghorn.stage.PronghornStage; //导入依赖的package包/类
private static void populateRanks(GraphManager m, Map<Object, StringBuilder> ranks, PronghornStage stage,
		String stageId) {
	if (ranks!=null && m.cachedRanks==null) {
		//thes rank keys are cached
		Object rankKey = getNota(m, stage.stageId, GraphManager.DOT_RANK_NAME, null);
		if (rankKey!=null) {
			
			//{ rank=same, b, c, d }
			StringBuilder b = ranks.get(rankKey);
			if (null==b) {
				b = new StringBuilder("{ rank=same");
				ranks.put(rankKey, b);
			}
			
			b.append(" \"").append(stageId).append("\",");
			
		}
	}
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:20,代码来源:GraphManager.java

示例10: enableBatching

import com.ociweb.pronghorn.stage.PronghornStage; //导入依赖的package包/类
public static void enableBatching(GraphManager gm) {
	int j = gm.pipeIdToPipe.length;
	while (--j>=0) {
		Pipe ring = gm.pipeIdToPipe[j];
		//never enable batching on the monitor rings
		if (null!=ring && !ringHoldsMonitorData(gm, ring) ) {
			
			int ringId1 = ring.id;
			int stageId1 = GraphManager.getRingConsumerId(gm, ringId1);
			if (stageId1>=0) {
				if (PronghornStage.supportsBatchedRelease(gm.stageIdToStage[stageId1])) { 
					Pipe.setMaxReleaseBatchSize(ring);
				}
			}
			
			int ringId = ring.id;
			int stageId = GraphManager.getRingProducerId(gm, ringId);
			if (stageId>=0) {
				if (PronghornStage.supportsBatchedPublish(gm.stageIdToStage[stageId])) {
					Pipe.setMaxPublishBatchSize(ring);
				}
			}
		}
	}
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:26,代码来源:GraphManager.java

示例11: findStageByPath

import com.ociweb.pronghorn.stage.PronghornStage; //导入依赖的package包/类
/**
 * Start with ordinal selection of input stages then ordinal selection of each output ring there after.
 * TODO: do generic return that extends pronghornStage
 * @param m
 * @param path
 */
public static PronghornStage findStageByPath(GraphManager m, int ... path) {
	
	int ordinal = path[0];
	int i = 0;
    int limit = m.stageIdToStage.length;
	while (i<limit) {
		if (null!=m.stageIdToStage[i]) {				
			//an input stage is one that has no input ring buffers
			if (-1 == m.multInputIds[m.stageIdToInputsBeginIdx[m.stageIdToStage[i].stageId]]) {
				if (--ordinal<=0) {
					//starting from 1 find this path
					return findStageByPath(m, m.stageIdToStage[i], 1, path);
				}
			}
		}
		i++;
	}	
	throw new UnsupportedOperationException("Unable to find ordinal input stage of "+path[0]);
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:26,代码来源:GraphManager.java

示例12: createSchedulers

import com.ociweb.pronghorn.stage.PronghornStage; //导入依赖的package包/类
private void createSchedulers(GraphManager graphManager, PronghornStage[][] stageArrays) {

	/////////////
    //for each array of stages create a scheduler
    ///////////// 
    ntsArray = new NonThreadScheduler[threadCount];

    int k = stageArrays.length;
    int ntsIdx = 0;
    while (--k >= 0) {
    	if (null!=stageArrays[k]) {
    		
    		if (logger.isDebugEnabled()) {
    			logger.debug("{} Single thread for group {}", ntsIdx, Arrays.toString(stageArrays[k]) );
    		}
    		PronghornStage pronghornStage = stageArrays[k][stageArrays[k].length-1];
			String name = pronghornStage.stageId+":"+pronghornStage.getClass().getSimpleName()+"...";
    		
    		
    		ntsArray[ntsIdx++]=new NonThreadScheduler(graphManager, stageArrays[k], name, true);	    		     
    	}
    }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:24,代码来源:FixedThreadsScheduler.java

示例13: accumWhenZero

import com.ociweb.pronghorn.stage.PronghornStage; //导入依赖的package包/类
private static void accumWhenZero(GraphManager graphManager, int stageId, long duration) {
	PronghornStage stage = getStage(graphManager, stageId);
	
	if ((stage instanceof PipeCleanerStage) ||
		(stage instanceof ReplicatorStage) ) {
		
		//these can be very fast and should not be logged.
		
	} else {
	
		int x = totalZeroDurations.incrementAndGet();
						
		if (Integer.numberOfLeadingZeros(x-1)!=Integer.numberOfLeadingZeros(x)) {
			if (duration<0) {
				logger.info("Bad duration {}",duration);
			} else {
				logger.info("Warning: the OS has measured stages taking zero ms {} times. "
					+ "Most recent case is for {}.", x, stage);
			}
		}
		
		graphManager.stageRunNS[stageId] += defaultDurationWhenZero;
	}
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:25,代码来源:GraphManager.java

示例14: stdDevPipesPerStage

import com.ociweb.pronghorn.stage.PronghornStage; //导入依赖的package包/类
public static RunningStdDev stdDevPipesPerStage(GraphManager m) {
	   
	   if (null == m.stdDevPipes) {
		 
		   m.stdDevPipes = new RunningStdDev();
		   int i = m.stageIdToStage.length;
	       while (--i>=0) {
	           PronghornStage stage = m.stageIdToStage[i];
	           if (null!=stage) {
	        	  
	        	  int sample =  
	        	  getInputPipeCount(m, stage.stageId)+
	        	  getOutputPipeCount(m, stage.stageId);
	        	  
	        	  RunningStdDev.sample(m.stdDevPipes, sample);
	        	  
	           }
	       }		       
	   }
      return m.stdDevPipes;
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:22,代码来源:GraphManager.java

示例15: add

import com.ociweb.pronghorn.stage.PronghornStage; //导入依赖的package包/类
private void add(PronghornStage[] pronghornStages, PronghornStage stage, final int root, final GraphManager graphManager, final IntHashTable rootsTable) {
	int i = 0;
	while (i<pronghornStages.length && pronghornStages[i]!=null) {
		if (pronghornStages[i]==stage) {
			return;//already added
		}
		i++;
	}
	//now add the new stage at index i
	pronghornStages[i]=stage;
	
	//Recursively add the ones under the same root.
	
	int outputCount = GraphManager.getOutputPipeCount(graphManager, stage.stageId);
	for(int r = 1; r<=outputCount; r++) {
		Pipe outputPipe = GraphManager.getOutputPipe(graphManager, stage, r);
		
		int consumerId = GraphManager.getRingConsumerId(graphManager, outputPipe.id);
		//this exists and has the same root so add it
		if (consumerId>=0 && rootId(consumerId, rootsTable)==root) {
			add(pronghornStages, GraphManager.getStage(graphManager, consumerId), root, graphManager, rootsTable);
		}
	}
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:25,代码来源:FixedThreadsScheduler.java


注:本文中的com.ociweb.pronghorn.stage.PronghornStage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。