Beispiel #1
0
  /**
   * Creates a {@link TimerImpl}
   *
   * @param id The id of this timer
   * @param service The timer service through which this timer was created
   * @param initialExpiry The first expiry of this timer. Can be null
   * @param intervalDuration The duration (in milli sec) between timeouts
   * @param nextEpiry The next expiry of this timer
   * @param info The info that will be passed on through the {@link javax.ejb.Timer} and will be
   *     available through the {@link javax.ejb.Timer#getInfo()} method
   * @param persistent True if this timer is persistent. False otherwise
   * @param timedObjectId
   */
  protected TimerImpl(Builder builder, TimerServiceImpl service) {
    assert builder.id != null : "id is null";

    this.id = builder.id;
    this.timedObjectId = builder.timedObjectId;
    this.info = builder.info;
    this.persistent = builder.persistent;
    this.initialExpiration = builder.initialDate;
    this.intervalDuration = builder.repeatInterval;
    if (builder.newTimer && builder.nextDate == null) {
      this.nextExpiration = initialExpiration;
    } else {
      this.nextExpiration = builder.nextDate;
    }
    this.previousRun = null;
    this.primaryKey = builder.primaryKey;

    this.timerState = builder.timerState;
    this.timerService = service;
    this.timedObjectInvoker = service.getInvoker();
    this.handle = new TimerHandleImpl(this.id, this.timedObjectInvoker.getTimedObjectId(), service);
  }