//get buffer manager
this.bufferManager = bufferService.getBufferManager();
//result set cache
CacheConfiguration rsCacheConfig = config.getResultsetCacheConfig();
if (rsCacheConfig != null && rsCacheConfig.isEnabled()) {
this.rsCache = new SessionAwareCache<CachedResults>(this.cacheFactory, SessionAwareCache.Type.RESULTSET, rsCacheConfig);
this.rsCache.setBufferManager(this.bufferManager);
}
//prepared plan cache
CacheConfiguration ppCacheConfig = config.getPreparedPlanCacheConfig();
prepPlanCache = new SessionAwareCache<PreparedPlan>(this.cacheFactory, SessionAwareCache.Type.PREPAREDPLAN, ppCacheConfig);
prepPlanCache.setBufferManager(this.bufferManager);
this.processWorkerPool = new ThreadReuseExecutor(DQPConfiguration.PROCESS_PLAN_QUEUE_NAME, config.getMaxThreads());
this.maxActivePlans = config.getMaxActivePlans();
if (this.maxActivePlans > config.getMaxThreads()) {
LogManager.logWarning(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.invalid_max_active_plan", this.maxActivePlans, config.getMaxThreads())); //$NON-NLS-1$
this.maxActivePlans = config.getMaxThreads();
}
//hack to set the max active plans
this.bufferManager.setMaxActivePlans(this.maxActivePlans);
try {
this.bufferManager.initialize();
} catch (TeiidComponentException e) {
throw new TeiidRuntimeException(e);
}
this.userRequestSourceConcurrency = config.getUserRequestSourceConcurrency();
if (this.userRequestSourceConcurrency < 1) {
this.userRequestSourceConcurrency = Math.min(config.getMaxThreads(), 2*config.getMaxThreads()/this.maxActivePlans);
}
if (cacheFactory.isReplicated()) {
matTables = new SessionAwareCache<CachedResults>(this.cacheFactory, SessionAwareCache.Type.RESULTSET, new CacheConfiguration(Policy.EXPIRATION, -1, -1, "MaterilizationTables")); //$NON-NLS-1$
matTables.setBufferManager(this.bufferManager);
}
DataTierManagerImpl processorDataManager = new DataTierManagerImpl(this,this.bufferService, this.config.isDetectingChangeEvents());
processorDataManager.setEventDistributor(eventDistributor);