Search in sources :

Example 1 with DataPointGroupInitializer

use of com.serotonin.m2m2.rt.DataPointGroupInitializer in project ma-core-public by infiniteautomation.

the class DataSourceRT method initializePoints.

/**
 * The {@link DataPointGroupInitializer} calls
 * {@link RuntimeManager#startDataPoint(DataPointWithEventDetectors, List) startDataPoint()}
 * which adds the data points to the cache in the RTM and initializes them.
 */
private void initializePoints() {
    DataPointDao dataPointDao = Common.getBean(DataPointDao.class);
    ExecutorService executorService = Common.getBean(ExecutorService.class);
    PointValueCache pointValueCache = Common.getBean(PointValueCache.class);
    // Add the enabled points to the data source.
    List<DataPointWithEventDetectors> dataSourcePoints = dataPointDao.getDataPointsForDataSourceStart(getId());
    // Startup multi threaded
    int pointsPerThread = Common.envProps.getInt("runtime.datapoint.startupThreads.pointsPerThread", 1000);
    int startupThreads = Common.envProps.getInt("runtime.datapoint.startupThreads", Runtime.getRuntime().availableProcessors());
    DataPointGroupInitializer pointInitializer = new DataPointGroupInitializer(executorService, startupThreads, pointValueCache);
    pointInitializer.initialize(dataSourcePoints, pointsPerThread);
    // Signal to the data source that all points are added.
    initialized();
}
Also used : DataPointGroupInitializer(com.serotonin.m2m2.rt.DataPointGroupInitializer) DataPointDao(com.serotonin.m2m2.db.dao.DataPointDao) ExecutorService(java.util.concurrent.ExecutorService) PointValueCache(com.infiniteautomation.mango.pointvaluecache.PointValueCache) DataPointWithEventDetectors(com.serotonin.m2m2.vo.dataPoint.DataPointWithEventDetectors)

Aggregations

PointValueCache (com.infiniteautomation.mango.pointvaluecache.PointValueCache)1 DataPointDao (com.serotonin.m2m2.db.dao.DataPointDao)1 DataPointGroupInitializer (com.serotonin.m2m2.rt.DataPointGroupInitializer)1 DataPointWithEventDetectors (com.serotonin.m2m2.vo.dataPoint.DataPointWithEventDetectors)1 ExecutorService (java.util.concurrent.ExecutorService)1