Package org.cipango.util

Examples of org.cipango.util.TimerTask


     
      public TimerTask schedule(Runnable runnable, long delay)
      {
        assertLocked();
       
        TimerTask timer = new TimerTask(runnable, System.currentTimeMillis() + delay);
        _timers.addTimer(timer);
       
        if (Log.isDebugEnabled())
          Log.debug("scheduled timer {} for call session: {}", timer, _id);
       
View Full Code Here


      return (_timers.isEmpty()) && (_appSessions.isEmpty());
    }
   
    protected long nextExecutionTime()
    {
      TimerTask timer = _timers.peek();
      return timer != null ? timer.getExecutionTime() : -1;
    }
View Full Code Here

    }
   
    protected void runTimers()
    {
      long now = System.currentTimeMillis();
      TimerTask timer = null;
     
      while ((timer = _timers.getExpired(now)) != null)
      {
        if (!timer.isCancelled())
        {
          if (Log.isDebugEnabled())
            Log.debug("running timer {} for call session {}", timer, _id);
          try
          {
            timer.getRunnable().run();
          }
          catch(Throwable t)
          {
            Log.warn(t);
          }
View Full Code Here

      Iterator<TimerTask> it4 = cSession._timers.iterator();
      if (it4.hasNext())
        sb.append("\t+ [Timers]\n");
      while (it4.hasNext())
      {
        TimerTask task = it4.next();
        sb.append("\t\t+ ").append(task).append('\n');
        printAttr(sb, "class", task.getRunnable().getClass().getName());
        printAttr(sb, "executionTime", new Date(task.getExecutionTime()));
      }
    }
    catch (Exception e)
    {
      sb.append("\n\n").append(e);
View Full Code Here

        cancelTimer(TIMER_WAIT_ACK);
      }
     
      private void cancelTimer(int id)
      {
        TimerTask timer = _timers[id];
        if (timer != null)
          getCallSession().cancel(timer);
        _timers[id] = null;
      }
View Full Code Here

      return STATES[_state];
    }
   
    public void startTimer(int timer, long delay)
    {
      TimerTask timerTask = _timers[timer];
      if (timerTask != null)
        _callSession.cancel(timerTask);
      _timers[timer] = _callSession.schedule(new Timer(timer), delay);
    }
View Full Code Here

      _timers[timer] = _callSession.schedule(new Timer(timer), delay);
    }
   
    public void cancelTimer(int timer)
    {
      TimerTask timerTask = _timers[timer];
      if (timerTask != null)
        _callSession.cancel(timerTask);
      _timers[timer] = null;
    }
View Full Code Here

TOP

Related Classes of org.cipango.util.TimerTask

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.