private TimerService getTimerService() throws IllegalStateException { final ThreadContext threadContext = ThreadContext.getThreadContext(); final BeanContext beanContext = threadContext.getBeanContext(); final EjbTimerService timerService = beanContext.getEjbTimerService(); if (timerService == null) { throw new IllegalStateException("This ejb does not support timers " + beanContext.getDeploymentID()); } else if (beanContext.getEjbTimeout() == null) { boolean hasSchedules = false; for (final Iterator<Map.Entry<Method, MethodContext>> it = beanContext.iteratorMethodContext(); it.hasNext(); ) { final Map.Entry<Method, MethodContext> entry = it.next(); final MethodContext methodContext = entry.getValue(); if (methodContext.getSchedules().size() > 0) { hasSchedules = true; } } if (!hasSchedules) { log.error("This ejb does not support timers " + beanContext.getDeploymentID() + " due to no timeout method nor schedules in methodContext is configured"); } } return new TimerServiceImpl(timerService, threadContext.getPrimaryKey(), beanContext.getEjbTimeout()); } }
final Map.Entry<Method, MethodContext> entry = it.next(); final MethodContext methodContext = entry.getValue(); if (methodContext.getSchedules().size() > 0) { hasSchedules = true;
final Map.Entry<Method, MethodContext> entry = it.next(); final MethodContext methodContext = entry.getValue(); if (methodContext.getSchedules().size() > 0) { timerServiceRequired = true; final Method method = entry.getKey(); final Map.Entry<Method, MethodContext> entry = it.next(); final MethodContext methodContext = entry.getValue(); for (final ScheduleData scheduleData : methodContext.getSchedules()) { timerStore.createCalendarTimer(timerService, (String) beanContext.getDeploymentID(),
final Map.Entry<Method, MethodContext> entry = it.next(); final MethodContext methodContext = entry.getValue(); if (methodContext.getSchedules().size() > 0) { timerServiceRequired = true; final Method method = entry.getKey(); final Map.Entry<Method, MethodContext> entry = it.next(); final MethodContext methodContext = entry.getValue(); for (final ScheduleData scheduleData : methodContext.getSchedules()) { timerStore.createCalendarTimer(timerService, (String) beanContext.getDeploymentID(),
private void addSchedulesToMethod(final MethodContext methodContext, final MethodScheduleInfo info) { if (methodContext == null) { return; } for (final ScheduleInfo scheduleInfo : info.schedules) { final ScheduleExpression expr = new ScheduleExpression(); expr.second(scheduleInfo.second == null ? "0" : scheduleInfo.second); expr.minute(scheduleInfo.minute == null ? "0" : scheduleInfo.minute); expr.hour(scheduleInfo.hour == null ? "0" : scheduleInfo.hour); expr.dayOfWeek(scheduleInfo.dayOfWeek == null ? "*" : scheduleInfo.dayOfWeek); expr.dayOfMonth(scheduleInfo.dayOfMonth == null ? "*" : scheduleInfo.dayOfMonth); expr.month(scheduleInfo.month == null ? "*" : scheduleInfo.month); expr.year(scheduleInfo.year == null ? "*" : scheduleInfo.year); expr.timezone(scheduleInfo.timezone); expr.start(scheduleInfo.start); expr.end(scheduleInfo.end); final TimerConfig config = new TimerConfig(); config.setInfo(scheduleInfo.info); config.setPersistent(scheduleInfo.persistent); methodContext.getSchedules().add(new ScheduleData(config, expr)); } }
private void addSchedulesToMethod(final MethodContext methodContext, final MethodScheduleInfo info) { if (methodContext == null) { return; } for (final ScheduleInfo scheduleInfo : info.schedules) { final ScheduleExpression expr = new ScheduleExpression(); expr.second(scheduleInfo.second == null ? "0" : scheduleInfo.second); expr.minute(scheduleInfo.minute == null ? "0" : scheduleInfo.minute); expr.hour(scheduleInfo.hour == null ? "0" : scheduleInfo.hour); expr.dayOfWeek(scheduleInfo.dayOfWeek == null ? "*" : scheduleInfo.dayOfWeek); expr.dayOfMonth(scheduleInfo.dayOfMonth == null ? "*" : scheduleInfo.dayOfMonth); expr.month(scheduleInfo.month == null ? "*" : scheduleInfo.month); expr.year(scheduleInfo.year == null ? "*" : scheduleInfo.year); expr.timezone(scheduleInfo.timezone); expr.start(scheduleInfo.start); expr.end(scheduleInfo.end); final TimerConfig config = new TimerConfig(); config.setInfo(scheduleInfo.info); config.setPersistent(scheduleInfo.persistent); methodContext.getSchedules().add(new ScheduleData(config, expr)); } }