BundleProcessor componentsProcessor = new ComponentsBundleProcessor(m_logger);
BundleProcessor configurationProcessor = new ConfigurationProcessor(m_logger);
if (SYNCHRONOUS_PROCESSING_ENABLED) {
m_queueService = new EnforcedQueueService(
new HeaderPreferenceSelection(),
new SynchronousQueueService(context),
Preference.SYNC,
m_logger);
// If required, add the event proxy
if (proxy != null) {
m_queueService.addQueueListener(proxy);
}
} else {
// Build a thread factory that will groups extender's thread together
ThreadFactory threadFactory = new GroupThreadFactory(new ThreadGroup("iPOJO Extender"));
threadFactory = new NamingThreadFactory(threadFactory);
threadFactory = new PrefixedThreadFactory(threadFactory, "[iPOJO] ");
// Create the queue services
SynchronousQueueService sync = new SynchronousQueueService(context);
ExecutorQueueService async = new ExecutorQueueService(context,
Integer.getInteger(ExecutorQueueService.THREADPOOL_SIZE_PROPERTY,
1), // default to 1 if no system property is set
threadFactory);
m_queueService = new PreferenceQueueService(new HeaderPreferenceSelection(), sync, async);
extensionBundleProcessor = new QueuingActivationProcessor(extensionBundleProcessor, m_queueService);
componentsProcessor = new QueuingActivationProcessor(componentsProcessor, m_queueService);
configurationProcessor = new QueuingActivationProcessor(configurationProcessor, m_queueService);
// If required, add the event proxy to both real services
if (proxy != null) {
sync.addQueueListener(proxy);
async.addQueueListener(proxy);
}
}
m_queueService.start();