Codota Logo
org.jboss.as.ejb3.timerservice.schedule
Code IndexAdd Codota to your IDE (free)

How to use org.jboss.as.ejb3.timerservice.schedule

Best Java code snippets using org.jboss.as.ejb3.timerservice.schedule (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: wildfly/wildfly

/**
 * This method is similar to {@link #getSchedule()}, except that this method does <i>not</i> check the timer state
 * and hence does <i>not</i> throw either {@link IllegalStateException} or {@link javax.ejb.NoSuchObjectLocalException}
 * or {@link javax.ejb.EJBException}.
 *
 * @return
 */
public ScheduleExpression getScheduleExpression() {
  return this.calendarTimeout.getScheduleExpression();
}
origin: wildfly/wildfly

public Calendar getNextTimeout(Calendar currentCal) {
  return getNextTimeout(currentCal, true);
}
origin: wildfly/wildfly

private boolean noMoreTimeouts(Calendar cal) {
  if (cal.get(Calendar.YEAR) > Year.MAX_YEAR || isAfterEnd(cal)) {
    return true;
  }
  return false;
}
origin: wildfly/wildfly

public IntegerBasedExpression(String value) {
  this.origValue = value;
  this.scheduleExpressionType = ScheduleExpressionTypeUtil.getType(value);
  if (this.accepts(scheduleExpressionType) == false) {
    throw EjbLogger.EJB3_TIMER_LOGGER.invalidScheduleExpressionType(value, this.getClass().getName(), this.scheduleExpressionType.toString());
      RangeValue range = new RangeValue(value);
      this.processRangeValue(range);
      break;
      ListValue list = new ListValue(value);
      this.processListValue(list);
      break;
      IncrementValue incrValue = new IncrementValue(value);
      this.processIncrement(incrValue);
      break;
      SingleValue singleValue = new SingleValue(value);
      this.processSingleValue(singleValue);
      break;
origin: wildfly/wildfly

private Calendar computeNextDayOfMonth(Calendar nextCal) {
  Integer nextDayOfMonth = this.dayOfMonth.getNextMatch(nextCal);
    if (this.monthHasDate(nextCal, nextDayOfMonth)) {
      resetTimeToFirstValues(nextCal);
      nextCal = this.advanceTillMonthHasDate(nextCal, nextDayOfMonth);
    resetTimeToFirstValues(nextCal);
    nextCal = this.computeNextMonth(nextCal);
    if (nextCal == null) {
      return null;
    nextDayOfMonth = this.dayOfMonth.getFirstMatch(nextCal);
    if (nextDayOfMonth == null) {
      return null;
    nextCal = this.advanceTillMonthHasDate(nextCal, nextDayOfMonth);
origin: wildfly/wildfly

protected void processListItem(String listItem) {
  // check what type of a value the list item is.
  // Each item in the list must be an individual attribute value or a range.
  // List items can not themselves be lists, wild-cards, or increments.
  ScheduleExpressionType listItemType = ScheduleExpressionTypeUtil.getType(listItem);
  switch (listItemType) {
    case SINGLE_VALUE:
      SingleValue singleVal = new SingleValue(listItem);
      this.processSingleValue(singleVal);
      return;
    case RANGE:
      RangeValue range = new RangeValue(listItem);
      this.processRangeValue(range);
      return;
    default:
      throw EjbLogger.EJB3_TIMER_LOGGER.invalidListValue(listItem);
  }
}
origin: wildfly/wildfly

private Calendar getNextTimeout(Calendar currentCal, boolean increment) {
  if (this.noMoreTimeouts(currentCal)) {
    return null;
  nextCal = this.computeNextTime(nextCal);
  if (nextCal == null) {
    return null;
  nextCal = this.computeNextMonth(nextCal);
  if (nextCal == null) {
    return null;
  nextCal = this.computeNextDate(nextCal);
  if (nextCal == null) {
    return null;
  nextCal = this.computeNextYear(nextCal);
  if (nextCal == null) {
    return null;
  if (this.noMoreTimeouts(nextCal)) {
    return null;
origin: wildfly/wildfly

private Calendar computeNextDate(Calendar nextCal) {
  if (this.isDayOfMonthWildcard()) {
    return this.computeNextDayOfWeek(nextCal);
  }
  if (this.isDayOfWeekWildcard()) {
    return this.computeNextDayOfMonth(nextCal);
  }
  // both day-of-month and day-of-week are *non-wildcards*
  Calendar nextDayOfMonthCal = this.computeNextDayOfMonth((Calendar) nextCal.clone());
  Calendar nextDayOfWeekCal = this.computeNextDayOfWeek((Calendar) nextCal.clone());
  if (nextDayOfMonthCal == null) {
    return nextDayOfWeekCal;
  }
  if (nextDayOfWeekCal == null) {
    return nextDayOfMonthCal;
  }
  return nextDayOfWeekCal.getTime().before(nextDayOfMonthCal.getTime()) ? nextDayOfWeekCal : nextDayOfMonthCal;
}
origin: wildfly/wildfly

private Calendar advanceTillMonthHasDate(Calendar cal, Integer date) {
  resetTimeToFirstValues(cal);
  // make sure the month can handle the date
  while (monthHasDate(cal, date) == false) {
    if (cal.get(Calendar.YEAR) > Year.MAX_YEAR) {
      return null;
    }
    // this month can't handle the date, so advance month to next month
    // and get the next suitable matching month
    cal.add(Calendar.MONTH, 1);
    cal = this.computeNextMonth(cal);
    if (cal == null) {
      return null;
    }
    date = this.dayOfMonth.getFirstMatch(cal);
    if (date == null) {
      return null;
    }
  }
  cal.set(Calendar.DAY_OF_MONTH, date);
  return cal;
}
origin: wildfly/wildfly

/**
 *
 * @param calendar
 */
private void resetTimeToFirstValues(Calendar calendar) {
  final int currentHour = calendar.get(Calendar.HOUR_OF_DAY);
  final int currentMinute = calendar.get(Calendar.MINUTE);
  final int currentSecond = calendar.get(Calendar.SECOND);
  final int firstHour = this.hour.getFirst();
  final int firstMinute = this.minute.getFirst();
  final int firstSecond = this.second.getFirst();
  if (currentHour != firstHour || currentMinute != firstMinute || currentSecond != firstSecond) {
    setTime(calendar, firstHour, firstMinute, firstSecond);
  }
}
origin: wildfly/wildfly

private Calendar computeNextYear(Calendar nextCal) {
  Integer nextYear = this.year.getNextMatch(nextCal);
  if (nextYear == null || nextYear > Year.MAX_YEAR) {
    return null;
  }
  int currentYear = nextCal.get(Calendar.YEAR);
  // if the current year is a match, then nothing else to
  // do. Just return back the calendar
  if (currentYear == nextYear) {
    return nextCal;
  }
  // If the next year is lesser than the current year, then
  // we have no more timeouts for the calendar expression
  if (nextYear < currentYear) {
    return null;
  }
  // at this point we have chosen a year which is greater than the current
  // year.
  // set the chosen year
  nextCal.set(Calendar.YEAR, nextYear);
  // since we are moving to a different year (as compared to the current year),
  // we should reset all other calendar attribute expressions appropriately, to their first possible
  // values
  nextCal.set(Calendar.MONTH, this.month.getFirstMatch());
  nextCal.set(Calendar.DAY_OF_MONTH, 1);
  resetTimeToFirstValues(nextCal);
  // recompute date
  nextCal = this.computeNextDate(nextCal);
  return nextCal;
}
origin: wildfly/wildfly

Integer nextSecond = this.second.getNextMatch(currentSecond);
if (nextSecond == null) {
  return null;
  currentMinute++;
Integer nextMinute = this.minute.getNextMatch(currentMinute < 60 ? currentMinute : 0);
if (nextMinute == null) {
  return null;
  nextSecond = this.second.getNextMatch(0);
  currentHour++;
Integer nextHour = this.hour.getNextMatch(currentHour < 24 ? currentHour : 0);
if (nextHour == null) {
  return null;
  nextSecond = this.second.getNextMatch(0);
  nextMinute = this.minute.getNextMatch(0);
setTime(nextCal, nextHour, nextMinute, nextSecond);
origin: wildfly/wildfly

private Calendar computeNextDayOfWeek(Calendar nextCal) {
  Integer nextDayOfWeek = this.dayOfWeek.getNextMatch(nextCal);
  resetTimeToFirstValues(nextCal);
    nextCal = computeNextMonth(nextCal);
origin: wildfly/wildfly

private Calendar computeNextMonth(Calendar nextCal) {
  Integer nextMonth = this.month.getNextMatch(nextCal);
  nextCal.set(Calendar.DAY_OF_WEEK, this.dayOfWeek.getFirst());
  nextCal.set(Calendar.DAY_OF_MONTH, 1);
  resetTimeToFirstValues(nextCal);
origin: wildfly/wildfly

s.end(builder.scheduleExprEndDate);
s.timezone(builder.scheduleExprTimezone);
this.calendarTimeout = new CalendarBasedTimeout(s);
  Calendar nextTimeout = this.calendarTimeout.getNextTimeout();
  if (nextTimeout != null) {
    this.nextExpiration = nextTimeout.getTime();
origin: wildfly/wildfly

private void setFirstTimeout() {
  Calendar currentCal = new GregorianCalendar(this.timezone);
  Date start = this.scheduleExpression.getStart();
  if (start != null) {
    currentCal.setTime(start);
  } else {
    resetTimeToFirstValues(currentCal);
  }
  this.firstTimeout = getNextTimeout(currentCal, false);
}
origin: wildfly/wildfly

public CalendarBasedTimeout getCalendarTimeout() {
  if (this.calendarTimeout == null) {
    this.calendarTimeout = new CalendarBasedTimeout(this.getScheduleExpression());
  }
  return this.calendarTimeout;
}
origin: wildfly/wildfly

public Calendar getNextTimeout() {
  return getNextTimeout(new GregorianCalendar(this.timezone), true);
}
origin: wildfly/wildfly

/**
 * {@inheritDoc}
 *
 * @see #getScheduleExpression()
 */
@Override
public ScheduleExpression getSchedule() throws IllegalStateException, EJBException {
  this.assertTimerState();
  return this.calendarTimeout.getScheduleExpression();
}
origin: wildfly/wildfly

@Override
protected Date calculateNextTimeout(TimerImpl timer) {
  // The next timeout for the calendar timer will have to be computed using the
  // current "nextExpiration"
  Date currentTimeout = timer.getNextExpiration();
  if (currentTimeout == null) {
    return null;
  }
  Calendar cal = new GregorianCalendar();
  cal.setTime(currentTimeout);
  // now compute the next timeout date
  Calendar nextTimeout = ((CalendarTimer) timer).getCalendarTimeout().getNextTimeout(cal);
  if (nextTimeout != null) {
    return nextTimeout.getTime();
  }
  return null;
}
org.jboss.as.ejb3.timerservice.schedule

Most used classes

  • Hour
    Represents the value of a hour constructed out of a javax.ejb.ScheduleExpression#getHour() A Hour
  • Minute
    Represents the value of a minute constructed out of a javax.ejb.ScheduleExpression#getMinute() A M
  • Month
    Month
  • Second
    Represents the value of a second constructed out of a javax.ejb.ScheduleExpression#getSecond() A S
  • Year
    Represents in the year value part constructed out of a javax.ejb.ScheduleExpression#getYear() A Ye
  • CalendarBasedTimeout,
  • ScheduleExpressionTypeUtil,
  • DayOfMonth,
  • DayOfWeek,
  • IntegerBasedExpression,
  • CalendarUtil,
  • IncrementValue,
  • ListValue,
  • ScheduleExpressionType,
  • SingleValue
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now