private boolean isAfterEnd(Calendar cal) { Date end = this.scheduleExpression.getEnd(); if (end == null) { return false; } // check that the next timeout isn't past the end date return cal.getTime().after(end); }
statement.setString(18, schedulerDateAsString(c.getScheduleExpression().getEnd())); statement.setString(19, c.getScheduleExpression().getTimezone()); statement.setBoolean(20, c.isAutoTimer());
public CalendarTimerEntity(CalendarTimer calendarTimer) { super(calendarTimer); this.scheduleExpression = calendarTimer.getScheduleExpression(); this.autoTimer = calendarTimer.isAutoTimer(); if (calendarTimer.isAutoTimer()) { Method method = calendarTimer.getTimeoutMethod(); Class<?>[] methodParams = method.getParameterTypes(); String[] params = new String[methodParams.length]; for (int i = 0; i < methodParams.length; i++) { params[i] = methodParams[i].getName(); } this.timeoutMethod = new TimeoutMethod(method.getDeclaringClass().getName(), method.getName(), params); } else { this.timeoutMethod = null; } this.scheduleExprSecond = this.scheduleExpression.getSecond(); this.scheduleExprMinute = this.scheduleExpression.getMinute(); this.scheduleExprHour = this.scheduleExpression.getHour(); this.scheduleExprDayOfMonth = this.scheduleExpression.getDayOfMonth(); this.scheduleExprMonth = this.scheduleExpression.getMonth(); this.scheduleExprDayOfWeek = this.scheduleExpression.getDayOfWeek(); this.scheduleExprYear = this.scheduleExpression.getYear(); this.scheduleExprStartDate = this.scheduleExpression.getStart(); this.scheduleExprEndDate = this.scheduleExpression.getEnd(); this.scheduleExprTimezone = this.scheduleExpression.getTimezone(); }
private static void addSchedule(Timer timer, ModelNode timerNode, final String componentName) { try { final ModelNode schedNode = timerNode.get(SCHEDULE); ScheduleExpression sched = timer.getSchedule(); addScheduleDetailString(schedNode, sched.getYear(), YEAR); addScheduleDetailString(schedNode, sched.getMonth(), MONTH); addScheduleDetailString(schedNode, sched.getDayOfMonth(), DAY_OF_MONTH); addScheduleDetailString(schedNode, sched.getDayOfWeek(), DAY_OF_WEEK); addScheduleDetailString(schedNode, sched.getHour(), HOUR); addScheduleDetailString(schedNode, sched.getMinute(), MINUTE); addScheduleDetailString(schedNode, sched.getSecond(), SECOND); addScheduleDetailString(schedNode, sched.getTimezone(), TIMEZONE); addScheduleDetailDate(schedNode, sched.getStart(), START); addScheduleDetailDate(schedNode, sched.getEnd(), END); } catch (IllegalStateException e) { // ignore } catch (NoSuchObjectLocalException e) { // ignore } catch (EJBException e) { logTimerFailure(componentName, e); } }
private ScheduleExpression clone(ScheduleExpression schedule) { // clone the schedule ScheduleExpression clonedSchedule = new ScheduleExpression(); clonedSchedule.second(schedule.getSecond()); clonedSchedule.minute(schedule.getMinute()); clonedSchedule.hour(schedule.getHour()); clonedSchedule.dayOfWeek(schedule.getDayOfWeek()); clonedSchedule.dayOfMonth(schedule.getDayOfMonth()); clonedSchedule.month(schedule.getMonth()); clonedSchedule.year(schedule.getYear()); clonedSchedule.timezone(schedule.getTimezone()); clonedSchedule.start(schedule.getStart()); clonedSchedule.end(schedule.getEnd()); return clonedSchedule; }
.setScheduleExprYear(schedule.getYear()) .setScheduleExprStartDate(schedule.getStart()) .setScheduleExprEndDate(schedule.getEnd()) .setScheduleExprTimezone(schedule.getTimezone()) .setTimeoutMethod(timeoutMethod)
@Override protected void readAttribute(TimerImpl timer, ModelNode toSet) { if (timer.isCanceled() || !timer.isCalendarTimer()) { return; } ScheduleExpression sched = timer.getSchedule(); addString(toSet, sched.getYear(), YEAR.getName()); addString(toSet, sched.getMonth(), MONTH.getName()); addString(toSet, sched.getDayOfMonth(), DAY_OF_MONTH.getName()); addString(toSet, sched.getDayOfWeek(), DAY_OF_WEEK.getName()); addString(toSet, sched.getHour(), HOUR.getName()); addString(toSet, sched.getMinute(), MINUTE.getName()); addString(toSet, sched.getSecond(), SECOND.getName()); addString(toSet, sched.getTimezone(), TIMEZONE.getName()); addDate(toSet, sched.getStart(), START.getName()); addDate(toSet, sched.getEnd(), END.getName()); }
private boolean isAfterEnd(Calendar cal) { Date end = this.scheduleExpression.getEnd(); if (end == null) { return false; } // check that the next timeout isn't past the end date return cal.getTime().after(end); }
private boolean isAfterEnd(Calendar cal) { Date end = this.scheduleExpression.getEnd(); if (end == null) { return false; } // check that the next timeout isn't past the end date return cal.getTime().after(end); }
setEndTime(expr.getEnd());
public CalendarTimerEntity(CalendarTimer calendarTimer) { super(calendarTimer); this.scheduleExpression = calendarTimer.getScheduleExpression(); this.autoTimer = calendarTimer.isAutoTimer(); if (calendarTimer.isAutoTimer()) { Method method = calendarTimer.getTimeoutMethod(); Class<?>[] methodParams = method.getParameterTypes(); String[] params = new String[methodParams.length]; for (int i = 0; i < methodParams.length; i++) { params[i] = methodParams[i].getName(); } this.timeoutMethod = new TimeoutMethod(method.getDeclaringClass().getName(), method.getName(), params); } else { this.timeoutMethod = null; } this.scheduleExprSecond = this.scheduleExpression.getSecond(); this.scheduleExprMinute = this.scheduleExpression.getMinute(); this.scheduleExprHour = this.scheduleExpression.getHour(); this.scheduleExprDayOfMonth = this.scheduleExpression.getDayOfMonth(); this.scheduleExprMonth = this.scheduleExpression.getMonth(); this.scheduleExprDayOfWeek = this.scheduleExpression.getDayOfWeek(); this.scheduleExprYear = this.scheduleExpression.getYear(); this.scheduleExprStartDate = this.scheduleExpression.getStart(); this.scheduleExprEndDate = this.scheduleExpression.getEnd(); this.scheduleExprTimezone = this.scheduleExpression.getTimezone(); }
private static void addSchedule(Timer timer, ModelNode timerNode, final String componentName) { try { final ModelNode schedNode = timerNode.get(SCHEDULE); ScheduleExpression sched = timer.getSchedule(); addScheduleDetailString(schedNode, sched.getYear(), YEAR); addScheduleDetailString(schedNode, sched.getMonth(), MONTH); addScheduleDetailString(schedNode, sched.getDayOfMonth(), DAY_OF_MONTH); addScheduleDetailString(schedNode, sched.getDayOfWeek(), DAY_OF_WEEK); addScheduleDetailString(schedNode, sched.getHour(), HOUR); addScheduleDetailString(schedNode, sched.getMinute(), MINUTE); addScheduleDetailString(schedNode, sched.getSecond(), SECOND); addScheduleDetailString(schedNode, sched.getTimezone(), TIMEZONE); addScheduleDetailDate(schedNode, sched.getStart(), START); addScheduleDetailDate(schedNode, sched.getEnd(), END); } catch (IllegalStateException e) { // ignore } catch (NoSuchObjectLocalException e) { // ignore } catch (EJBException e) { logTimerFailure(componentName, e); } }
private ScheduleExpression copy(final ScheduleExpression scheduleExpression) { final ScheduleExpression scheduleExpressionCopy = new ScheduleExpression(); scheduleExpressionCopy.year(scheduleExpression.getYear()); scheduleExpressionCopy.month(scheduleExpression.getMonth()); scheduleExpressionCopy.dayOfMonth(scheduleExpression.getDayOfMonth()); scheduleExpressionCopy.dayOfWeek(scheduleExpression.getDayOfWeek()); scheduleExpressionCopy.hour(scheduleExpression.getHour()); scheduleExpressionCopy.minute(scheduleExpression.getMinute()); scheduleExpressionCopy.second(scheduleExpression.getSecond()); scheduleExpressionCopy.start(scheduleExpression.getStart()); scheduleExpressionCopy.end(scheduleExpression.getEnd()); scheduleExpressionCopy.timezone(scheduleExpression.getTimezone()); return scheduleExpressionCopy; }
private ScheduleExpression clone(ScheduleExpression schedule) { // clone the schedule ScheduleExpression clonedSchedule = new ScheduleExpression(); clonedSchedule.second(schedule.getSecond()); clonedSchedule.minute(schedule.getMinute()); clonedSchedule.hour(schedule.getHour()); clonedSchedule.dayOfWeek(schedule.getDayOfWeek()); clonedSchedule.dayOfMonth(schedule.getDayOfMonth()); clonedSchedule.month(schedule.getMonth()); clonedSchedule.year(schedule.getYear()); clonedSchedule.timezone(schedule.getTimezone()); clonedSchedule.start(schedule.getStart()); clonedSchedule.end(schedule.getEnd()); return clonedSchedule; }
private ScheduleExpression copy(final ScheduleExpression scheduleExpression) { final ScheduleExpression scheduleExpressionCopy = new ScheduleExpression(); scheduleExpressionCopy.year(scheduleExpression.getYear()); scheduleExpressionCopy.month(scheduleExpression.getMonth()); scheduleExpressionCopy.dayOfMonth(scheduleExpression.getDayOfMonth()); scheduleExpressionCopy.dayOfWeek(scheduleExpression.getDayOfWeek()); scheduleExpressionCopy.hour(scheduleExpression.getHour()); scheduleExpressionCopy.minute(scheduleExpression.getMinute()); scheduleExpressionCopy.second(scheduleExpression.getSecond()); scheduleExpressionCopy.start(scheduleExpression.getStart()); scheduleExpressionCopy.end(scheduleExpression.getEnd()); scheduleExpressionCopy.timezone(scheduleExpression.getTimezone()); return scheduleExpressionCopy; } }
private ScheduleExpression clone(ScheduleExpression schedule) { // clone the schedule ScheduleExpression clonedSchedule = new ScheduleExpression(); clonedSchedule.second(schedule.getSecond()); clonedSchedule.minute(schedule.getMinute()); clonedSchedule.hour(schedule.getHour()); clonedSchedule.dayOfWeek(schedule.getDayOfWeek()); clonedSchedule.dayOfMonth(schedule.getDayOfMonth()); clonedSchedule.month(schedule.getMonth()); clonedSchedule.year(schedule.getYear()); clonedSchedule.timezone(schedule.getTimezone()); clonedSchedule.start(schedule.getStart()); clonedSchedule.end(schedule.getEnd()); return clonedSchedule; }
/** Construct TimerSchedule instance from a given ScheduleExpression. * Need to copy all values because ScheduleExpression is mutable * and can be modified by the user. */ public TimerSchedule(ScheduleExpression se) { second(se.getSecond()); minute(se.getMinute()); hour(se.getHour()); dayOfMonth(se.getDayOfMonth()); month(se.getMonth()); dayOfWeek(se.getDayOfWeek()); year(se.getYear()); timezone(se.getTimezone()); // Create local copies start(se.getStart()); end(se.getEnd()); configure(); }
/** Construct EJBTimerSchedule instance from a given ScheduleExpression. * Need to copy all values because ScheduleExpression is mutable * and can be modified by the user. */ public EJBTimerSchedule(ScheduleExpression se) { second(se.getSecond()); minute(se.getMinute()); hour(se.getHour()); dayOfMonth(se.getDayOfMonth()); month(se.getMonth()); dayOfWeek(se.getDayOfWeek()); year(se.getYear()); timezone(se.getTimezone()); // Create local copies start(se.getStart()); end(se.getEnd()); configure(); }