use of io.joynr.runtime.MessageReceiverType in project joynr by bmwcarit.
the class JoynrApplicationLauncher method init.
public void init(Properties properties, Set<Class<? extends JoynrApplication>> joynrApplicationsClasses, AbstractJoynrInjectorFactory injectorFactory, Module... modules) {
ThreadFactory threadFactory = new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
return new Thread(r, r.getClass().getSimpleName());
}
};
executionQueue = Executors.newCachedThreadPool(threadFactory);
try {
// updateInjectorModule must be called before getInjector can be called.
// for this reason the injector has to be created here, and not by the creator of the injectorFactory
injectorFactory.updateInjectorModule(properties, modules);
joynrInjector = injectorFactory.getInjector();
for (Class<? extends JoynrApplication> appClass : joynrApplicationsClasses) {
if (Modifier.isAbstract(appClass.getModifiers())) {
continue;
}
AcceptsMessageReceiver acceptsMessageReceiverAnnotation = appClass.getAnnotation(AcceptsMessageReceiver.class);
// TODO why not reuse the previously requested value for
// AcceptsMessageReceiver?
MessageReceiverType messageReceiverType = acceptsMessageReceiverAnnotation == null ? MessageReceiverType.ANY : appClass.getAnnotation(AcceptsMessageReceiver.class).value();
if (messageReceiverType.equals(MessageReceiverType.SERVLET)) {
continue;
}
logger.info("Running app: " + appClass.getName());
final JoynrApplication app = injectorFactory.createApplication(new JoynrApplicationModule(appClass));
apps.add(app);
executionQueue.submit(app);
}
} catch (RuntimeException e) {
logger.error("ERROR", e);
throw e;
}
}
Aggregations