Save This Page
Home » openejb-3.1.2-src » javax » ejb » [javadoc | source]
    1   /*
    2   * JBoss, Home of Professional Open Source
    3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
    4   * by the @authors tag. See the copyright.txt in the distribution for a
    5   * full listing of individual contributors.
    6   *
    7   * This is free software; you can redistribute it and/or modify it
    8   * under the terms of the GNU Lesser General Public License as
    9   * published by the Free Software Foundation; either version 2.1 of
   10   * the License, or (at your option) any later version.
   11   *
   12   * This software is distributed in the hope that it will be useful,
   13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   15   * Lesser General Public License for more details.
   16   *
   17   * You should have received a copy of the GNU Lesser General Public
   18   * License along with this software; if not, write to the Free
   19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   21   */
   22   package javax.ejb;
   23   
   24   import java.io.Serializable;
   25   import java.util.Collection;
   26   import java.util.Date;
   27   
   28   /**
   29    * The TimerService interface provides enterprise bean components with access to the
   30    * container-provided Timer Service. The EJB Timer Service allows entity beans, stateless
   31    * session beans, and message-driven beans to be registered for timer callback events at
   32    * a specified time, after a specified elapsed time, or after a specified interval.
   33    **/
   34   public interface TimerService {
   35      
   36      /**
   37       * Create a single-action timer that expires after a specified duration.
   38       *
   39       * @param duration  The number of milliseconds that must elapse before the timer expires.
   40       * @param info Application information to be delivered along with the timer expiration
   41       *             notification. This can be null.
   42       *
   43       * @return The newly created Timer. 
   44       *
   45       * @throws IllegalArgumentException If duration is negative
   46       * @throws IllegalStateException If this method is invoked while the instance is in
   47       *                               a state that does not allow access to this method.
   48       * @throws EJBException If this method could not complete due to a system-level failure.
   49       **/
   50      public Timer createTimer( long duration, Serializable info )
   51         throws
   52            IllegalArgumentException,
   53            IllegalStateException,
   54            EJBException;
   55      
   56      /**
   57       * Create an interval timer whose first expiration occurs after a specified duration,
   58       * and whose subsequent expirations occur after a specified interval.
   59       *
   60       * @param initialDuration The number of milliseconds that must elapse before the first
   61       *                        timer expiration notification.
   62       * @param intervalDuration The number of milliseconds that must elapse between timer
   63       *                         expiration notifications. Expiration notifications are
   64       *                         scheduled relative to the time of the first expiration. If
   65       *                         expiration is delayed(e.g. due to the interleaving of other
   66       *                         method calls on the bean) two or more expiration notifications
   67       *                         may occur in close succession to "catch up".
   68       * @param info Application information to be delivered along with the timer expiration
   69       *             notification. This can be null.
   70       *
   71       * @return The newly created Timer. 
   72       *
   73       * @throws IllegalArgumentException If initialDuration is negative, or intervalDuration
   74       *                                  is negative.
   75       * @throws IllegalStateException If this method is invoked while the instance is in
   76       *                               a state that does not allow access to this method.
   77       * @throws EJBException If this method could not complete due to a system-level failure.
   78       **/
   79      public Timer createTimer( long initialDuration, long intervalDuration, Serializable info )
   80         throws
   81            IllegalArgumentException,
   82            IllegalStateException,
   83            EJBException;
   84      
   85      /**
   86       * Create a single-action timer that expires at a given point in time.
   87       *
   88       * @param expiration The point in time at which the timer must expire.
   89       * @param info Application information to be delivered along with the timer expiration
   90       *             notification. This can be null.
   91       *
   92       * @return The newly created Timer. 
   93       *
   94       * @throws IllegalArgumentException If expiration is null, or expiration.getTime() is negative.
   95       * @throws IllegalStateException If this method is invoked while the instance is in
   96       *                               a state that does not allow access to this method.
   97       * @throws EJBException If this method could not complete due to a system-level failure.
   98       **/
   99      public Timer createTimer( Date expiration, Serializable info )
  100         throws
  101            IllegalArgumentException,
  102            IllegalStateException,
  103            EJBException;
  104      
  105      /**
  106       * Create an interval timer whose first expiration occurs at a given point in time and
  107       * whose subsequent expirations occur after a specified interval.
  108       *
  109       * @param initialExpiration The point in time at which the first timer expiration must occur.
  110       * @param intervalDuration The number of milliseconds that must elapse between timer
  111       *                         expiration notifications. Expiration notifications are
  112       *                         scheduled relative to the time of the first expiration. If
  113       *                         expiration is delayed(e.g. due to the interleaving of other
  114       *                         method calls on the bean) two or more expiration notifications
  115       *                         may occur in close succession to "catch up".
  116       * @param info Application information to be delivered along with the timer expiration
  117       *             notification. This can be null.
  118       *
  119       * @return The newly created Timer. 
  120       *
  121       * @throws IllegalArgumentException If initialExpiration is null, or initialExpiration.getTime()
  122       *                                  is negative, or intervalDuration is negative.
  123       * @throws IllegalStateException If this method is invoked while the instance is in
  124       *                               a state that does not allow access to this method.
  125       * @throws EJBException If this method could not complete due to a system-level failure.
  126       **/
  127      public Timer createTimer( Date initialExpiration, long intervalDuration, Serializable info )
  128         throws
  129            IllegalArgumentException,
  130            IllegalStateException,
  131            EJBException;
  132      
  133      /**
  134       * Get all the active timers associated with this bean.
  135       *
  136       * @return A collection of javax.ejb.Timer objects.
  137       * @throws IllegalStateException If this method is invoked while the instance is in
  138       *                               a state that does not allow access to this method.
  139       * @throws EJBException If this method could not complete due to a system-level failure.
  140       **/
  141      public Collection getTimers()
  142         throws
  143            IllegalStateException,
  144            EJBException;
  145   }

Save This Page
Home » openejb-3.1.2-src » javax » ejb » [javadoc | source]