use of org.apache.openejb.core.ThreadContext in project tomee by apache.
the class Timers method all.
public static Collection<Timer> all() {
final ThreadContext threadContext = ThreadContext.getThreadContext();
final BeanContext beanContext = threadContext.getBeanContext();
final ModuleContext module = beanContext.getModuleContext();
final Collection<Timer> timers = new HashSet<>();
for (final BeanContext c : module.getAppContext().getBeanContexts()) {
if (c.getModuleContext() == module) {
// filter by module
if (c.getComponentType() != BeanType.STATEFUL) {
final TimerService timerService = getTimerService(null, c, true);
if (timerService == null) {
continue;
}
final Collection<Timer> beanTimers = timerService.getTimers();
timers.addAll(beanTimers);
} else {
// for all instances
final TimerService timerService = getTimerService(null, c, true);
if (timerService == null) {
continue;
}
final Collection<Timer> beanTimers = timerService.getTimers();
timers.addAll(beanTimers);
}
}
}
return timers;
}
use of org.apache.openejb.core.ThreadContext in project tomee by apache.
the class OpenEJBContext method getThreadContext.
/**
* Gets current context deployment context.
*
* @return context of deployment
* @throws NamingException for exception
*/
private Context getThreadContext() throws NamingException {
final ThreadContext threadContext = ThreadContext.getThreadContext();
if (skipEjbContext(threadContext)) {
return ContextBindings.getClassLoader();
}
final Context context = threadContext.getBeanContext().getJndiEnc();
return context;
}
Aggregations