/** * Parameter initialization, such as set result class name, iteration number and so on. */ @Override public void init(Properties props) { this.setProps(props); checkAndSetMasterInterceptors(props); this.setMasterComputable(newMasterComputable()); this.isMonitored = this.getMasterComputable().getClass().isAnnotationPresent(ComputableMonitor.class); if(this.isMonitored) { this.isSoftForComputableTimeout = masterComputable.getClass().getAnnotation(ComputableMonitor.class) .isSoft(); this.executor = Executors.newSingleThreadExecutor(); } this.setTotalIteration(Integer.valueOf(this.getProps().getProperty(GuaguaConstants.GUAGUA_ITERATION_COUNT, Integer.MAX_VALUE + ""))); this.setWorkers(Integer.valueOf(this.getProps().getProperty(GuaguaConstants.GUAGUA_WORKER_NUMBER))); this.setMasterResultClassName(this.getProps().getProperty(GuaguaConstants.GUAGUA_MASTER_RESULT_CLASS)); this.setWorkerResultClassName(this.getProps().getProperty(GuaguaConstants.GUAGUA_WORKER_RESULT_CLASS)); double minWorkersRatio = NumberFormatUtils.getDouble( this.getProps().getProperty(GuaguaConstants.GUAGUA_MIN_WORKERS_RATIO), GuaguaConstants.GUAGUA_DEFAULT_MIN_WORKERS_RATIO); this.setMinWorkersRatio(minWorkersRatio); long minWorkersTimeOut = NumberFormatUtils.getLong( this.getProps().getProperty(GuaguaConstants.GUAGUA_MIN_WORKERS_TIMEOUT), 5 * 1000l); this.setMinWorkersTimeOut(minWorkersTimeOut); }