/** * Creates a new instance of this class using the given configuration to initialize the class. * * @param configuration * The configuration used to initialize this controller. */ protected SamplingController(final Configuration configuration) { super(configuration); final int threadPoolSize = configuration.getIntProperty(ConfigurationFactory.PERIODIC_SENSORS_EXECUTOR_POOL_SIZE); if (threadPoolSize > 0) { this.periodicSensorsPoolExecutor = new ScheduledThreadPoolExecutor(threadPoolSize, new DaemonThreadFactory(), new RejectedExecutionHandler()); // this.periodicSensorsPoolExecutor.setMaximumPoolSize(threadPoolSize); // not used in this class this.periodicSensorsPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); this.periodicSensorsPoolExecutor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); } else { this.periodicSensorsPoolExecutor = null; // NOPMD } }
/** * Creates a new instance of this class using the given configuration to initialize the class. * * @param configuration * The configuration used to initialize this controller. */ protected SamplingController(final Configuration configuration) { super(configuration); final int threadPoolSize = configuration.getIntProperty(ConfigurationKeys.PERIODIC_SENSORS_EXECUTOR_POOL_SIZE); if (threadPoolSize > 0) { this.periodicSensorsPoolExecutor = new ScheduledThreadPoolExecutor(threadPoolSize, new DaemonThreadFactory(), new RejectedExecutionHandler()); // this.periodicSensorsPoolExecutor.setMaximumPoolSize(threadPoolSize); // not used in this class this.periodicSensorsPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); this.periodicSensorsPoolExecutor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); } else { this.periodicSensorsPoolExecutor = null; // NOPMD } }