Package javax.ejb

Examples of javax.ejb.Timer


     *         associated timer has expired or has been cancelled.
     * @throws EJBException If this method could not complete due to a
     *         system-level failure.
     */
    public Timer getTimer() throws IllegalStateException, NoSuchObjectLocalException, EJBException {
        Timer timer = null;

        // Get data from the Job Detail
        String jobName = this.easyBeansJobDetail.getName();
        String groupName = this.easyBeansJobDetail.getGroup();

View Full Code Here


        if (factory == null) {
            throw new JobExecutionException("Cannot find the factory with the name '" + data.getFactoryName() + "'.");
        }

        // Get the timer
        Timer timer = data.getTimer();
        if (timer == null) {
            throw new JobExecutionException("No timer found in the given JobExecutionContext.");
        }

        // Invoke the timer method
View Full Code Here

        // Build the Job Detail
        EasyBeansJobDetail jobDetail = new EasyBeansJobDetail(getNewJobDetailName(), getJobDetailGroupName(), beansJobDetailData);

        // Build a new timer object
        Timer timer = new EasyBeansTimer(jobDetail, trigger, this.scheduler, this.factory);

        // Add it as a data
        beansJobDetailData.setTimer(timer);

        // Schedule the job
View Full Code Here

     * @param ts reference
     * @throws Exception if a problem occurs
     */
    public static void checkInstance(final TimerService ts) throws Exception{
        //Creates a timer
        Timer t = ts.createTimer(TIMER_DURATION, "Timer Created");
        //Verifies a timer method
        t.getTimeRemaining();

        //Verifies if the new timer was added to the timers list
        if(ts.getTimers().size() < 1){
            throw new IllegalStateException("The Timers Collection must have at least one timer. It was created in this method.");
        }
        //Cancels the timer
        t.cancel();
    }
View Full Code Here

      try
      {
         Date first = new Date(System.currentTimeMillis() + 1000);
         Date last = new Date(System.currentTimeMillis() + 11000);
         ReplyInfo info = new ReplyInfo(msgID, replyTo, first, last);
         Timer timer = ts.createTimer(first, 1000, info);
         log.info("Timer created with a timeout: " + first
            + " and with info: " + msgID
            + ", handle: "+timer.getHandle());
      }
      catch (Exception e)
      {
         log.info("Failed to init timer", e);
      }
View Full Code Here

        String result = persist();
       
        Payment payment = getInstance();
        log.info("scheduling instance #0", payment);

        Timer timer = processor.schedulePayment(payment.getPaymentDate(),
                                                payment.getPaymentFrequency().getInterval(),
                                                payment);
        if (timer != null) {
            payment.setTimerHandle(timer.getHandle());
        }
        return result;
    }
View Full Code Here

    public boolean stopSnapshot() {
        Collection<Timer> timers = timer.getTimers();
        // stop all timers
        boolean cancelled = false;
        for(Iterator<Timer> it = timers.iterator(); it.hasNext(); ) {
            Timer t = it.next();
            t.cancel();
            cancelled = true;
            log.info("Stopped snapshot timer...");
        }
        return cancelled;
    }
View Full Code Here

     *
     * @param timerData the timer to call.
     */
    public void ejbTimeout(TimerData timerData) {
        try {
            Timer timer = getTimer(timerData.getId());
            if (timer == null) {
                return;
            }
            for (int tries = 0; tries < (1 + retryAttempts); tries++) {
                boolean retry = false;
View Full Code Here

        checkState();

        Collection<Timer> timers = new ArrayList<Timer>();
        for (Iterator iterator = timerStore.getTimers((String)deployment.getDeploymentID()).iterator(); iterator.hasNext();) {
            TimerData timerData = (TimerData) iterator.next();
            Timer timer = timerData.getTimer();
            timers.add(timer);
        }
        return timers;
    }
View Full Code Here

     *
     * @param timerData the timer to call.
     */
    private void ejbTimeout(TimerData timerData) {
        try {
            Timer timer = getTimer(timerData.getId());
            if (timer == null) {
                return;
            }

            for (int tries = 0; tries < (1 + retryAttempts); tries++) {
View Full Code Here

TOP

Related Classes of javax.ejb.Timer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.