use of act.app.App in project actframework by actframework.
the class GenieInjector method addModuleClass.
public static void addModuleClass(Class<?> moduleClass) {
if (!isModuleAllowed(moduleClass)) {
return;
}
App app = App.instance();
GenieInjector genieInjector = app.injector();
genieInjector.addModule(moduleClass);
}
use of act.app.App in project actframework by actframework.
the class GenieInjector method foundProviderBase.
@SubClassFinder
public static void foundProviderBase(Class<? extends ActProvider> providerClass) {
App app = App.instance();
GenieInjector genieInjector = app.injector();
ActProvider provider = app.getInstance(providerClass);
genieInjector.genie().registerProvider(provider.targetType(), provider);
}
use of act.app.App in project actframework by actframework.
the class GenieInjector method foundGenericTypedBeanLoader.
@SubClassFinder
public static void foundGenericTypedBeanLoader(Class<? extends GenericTypedBeanLoader> loaderClass) {
App app = App.instance();
GenieInjector genieInjector = app.injector();
Type[] ta = loaderClass.getGenericInterfaces();
for (Type t : ta) {
if (t instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType) t;
if (GenericTypedBeanLoader.class == pt.getRawType()) {
Type compoentType = pt.getActualTypeArguments()[0];
genieInjector.genie().registerGenericTypedBeanLoader((Class) compoentType, app.getInstance(loaderClass));
}
}
}
}
use of act.app.App in project actframework by actframework.
the class GenieInjector method foundValueLoader.
@AnnotatedClassFinder(value = LoadValue.class, noAbstract = false, callOn = SysEventId.DEPENDENCY_INJECTOR_LOADED)
public static void foundValueLoader(Class<? extends Annotation> valueLoader) {
App app = App.instance();
GenieInjector genieInjector = app.injector();
genieInjector.injectTags.add(valueLoader);
}
use of act.app.App in project actframework by actframework.
the class Job method run.
@Override
public void run() {
invokeParallelJobs();
runPrecedenceJobs();
try {
if (Act.isDev() && app.isStarted()) {
app.checkUpdates(false);
}
doJob();
} catch (Throwable e) {
boolean isFatal = FATAL_EXCEPTIONS.contains(e.getClass());
Throwable cause = e;
if (!isFatal) {
cause = e.getCause();
while (null != cause) {
isFatal = FATAL_EXCEPTIONS.contains(cause.getClass());
if (isFatal) {
break;
}
cause = cause.getCause();
}
}
if (isFatal) {
if (Act.isDev()) {
app.setBlockIssue(e);
} else {
Act.shutdown(App.instance());
destroy();
if (App.instance().isMainThread()) {
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
}
throw E.unexpected(e);
} else {
logger.fatal(cause, "Fatal error executing job %s", id());
}
}
return;
}
// TODO inject Job Exception Handling mechanism here
logger.warn(e, "error executing job %s", id());
} finally {
if (!isDestroyed()) {
executed = true;
if (isOneTime()) {
App app = App.instance();
if (app.isStarted()) {
manager.removeJob(this);
} else {
app.eventBus().bind(SysEventId.POST_START, new SysEventListenerBase() {
@Override
public void on(EventObject event) throws Exception {
manager.removeJob(Job.this);
}
});
}
}
progress.destroy();
}
}
runFollowingJobs();
}
Aggregations