Changeset 20 for branches/multithread/src
- Timestamp:
- 09/24/07 14:06:42 (1 year ago)
- Location:
- branches/multithread/src/planet
- Files:
-
- 2 modified
-
generic/commonapi/MultiThreadedNetworkImpl.java (modified) (1 diff)
-
util/Properties.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/multithread/src/planet/generic/commonapi/MultiThreadedNetworkImpl.java
r14 r20 84 84 */ 85 85 public MultiThreadedNetworkImpl() { 86 PROCESSORS = 2;86 PROCESSORS = Properties.simulatorProcessors; 87 87 nodes = new HashMap<NodeHandle, Node>(); //to contain all nodes 88 88 toRemove = new Stack<NodeHandle>(); -
branches/multithread/src/planet/util/Properties.java
r2 r20 144 144 */ 145 145 public static final String SIMULATOR_PROCESSED_MESSAGES = "SIMULATOR_PROCESSED_MESSAGES"; 146 /** 147 * Simulator property: Default key specified in the properties file that 148 * identifies the number of processors the simulator runs on. 149 */ 150 public static final String SIMULATOR_PROCESSORS ="SIMULATOR_PROCESSORS"; 146 151 147 152 /* OPTIONAL */ 153 148 154 /** 149 155 * Simulator property: Default key specified in the properties file that … … 405 411 public static int simulatorProcessedMessages = 0; 406 412 413 /** 414 * Simulator property: Number of processor for the simulator. 415 */ 416 public static int simulatorProcessors = 1; 407 417 /* OPTIONAL */ 418 419 408 420 /** 409 421 * Simulator property: The events filename to be loaded. … … 830 842 Properties.simulatorQueueSize = properties.getPropertyAsInt(SIMULATOR_QUEUE_SIZE); 831 843 Properties.simulatorProcessedMessages = properties.getPropertyAsInt(SIMULATOR_PROCESSED_MESSAGES); 832 844 Properties.simulatorProcessors = properties.getPropertyAsInt(SIMULATOR_PROCESSORS); 833 845 //testing the correctness of the values 846 ensureValidNumberOfProcessors(Properties.simulatorProcessors); 834 847 ensureValidSimulatorEnvironment(Properties.simulatorEnvironment); 835 848 ensureValidPrintLevel(Properties.simulatorPrintLevel); 836 849 } 837 838 /** 850 /** 851 * Test if the <b>number of processor</b> is a valid. 852 * @param simProcessors The value to be tested. 853 * @throws InitializationException if the <b>simProcessors</b> has an 854 * incorrect value. 855 */ 856 private static void ensureValidNumberOfProcessors(int simProcessors) throws InitializationException{ 857 if(simProcessors<1){ 858 throw new InitializationException(simProcessors+" is not a valid number for "+SIMULATOR_PROCESSORS+" must be >=1"); 859 } 860 861 } 862 863 /** 839 864 * Test if the <b>environment</b> is a valid simulator environment. 840 865 * @param environment The value to be tested.
