1 46 package org.mr.api.blocks; 47 48 import java.util.HashMap ; 49 50 51 52 58 public class ScalableFactory { 59 62 private static HashMap stages = new HashMap (); 63 66 private static HashMap dispathcers = new HashMap (); 67 68 74 public final static synchronized ScalableStage getStage(String stageName ,boolean distributed){ 75 ScalableStage result = (ScalableStage) stages.get(stageName); 76 if(result == null){ 77 result = new ScalableStage(stageName,distributed); 78 stages.put(stageName,result ); 79 } 80 return result; 81 82 } 83 84 90 public final static synchronized ScalableDispatcher getDispatcher(String name ,boolean distributed){ 91 ScalableDispatcher result = (ScalableDispatcher) dispathcers.get(name); 92 if(result == null){ 93 result = new ScalableDispatcher(name,distributed); 94 dispathcers.put(name,result ); 95 } 96 return result; 97 98 } 99 } 100 | Popular Tags |