Package mx4j.timer

Examples of mx4j.timer.TimerTask


      Integer id = addNotificationImpl(type, message, userData, date, period, occurrences, fixedRate);

      // If the Timer is active, schedule the notification
      if (isActive())
      {
         TimerTask task = getTask(id);
         updateTask(task, now);
         if (!task.isFinished())
         {
            queue.schedule(task);
         }
      }
      return id;
View Full Code Here


      TimerNotification notification = new TimerNotification(type, this, 0, System.currentTimeMillis(), message, id);
      notification.setUserData(userData);
      if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Adding timer notification: " + notification + " on Timer service " + objectName);

      TimerTask task = createTimerTask(notification, date, period, occurrences, fixedRate);

      synchronized (this)
      {
         tasks.put(id, task);
      }
View Full Code Here

      return id;
   }

   private TimerTask createTimerTask(TimerNotification notification, Date date, long period, long occurrences, boolean fixedRate)
   {
      return new TimerTask(notification, date, period, occurrences, fixedRate)
      {
         public void run()
         {
            // Send the notification
            TimerNotification notification = getNotification();
View Full Code Here

         for (Iterator i = tasks.entrySet().iterator(); i.hasNext();)
         {
            Map.Entry entry = getNextNonFinishedTaskEntry(i);
            if (entry == null) break;

            TimerTask task = (TimerTask)entry.getValue();

            if (!sendPast)
            {
               updateTask(task, now);
               if (task.isFinished()) continue;
            }
            list.add(task);
         }
         return list;
      }
View Full Code Here

   {
      synchronized (this)
      {
         for (int i = 0; i < tasks.size(); ++i)
         {
            TimerTask task = (TimerTask)tasks.get(i);
            queue.schedule(task);
         }
      }
   }
View Full Code Here

   {
      Logger logger = getLogger();

      synchronized (this)
      {
         TimerTask t = getTask(id);
         if (t == null) throw new InstanceNotFoundException("Cannot find notification to remove with id: " + id);
         queue.unschedule(t);
         tasks.remove(id);
         if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Notification " + t.getNotification() + " removed successfully from Timer service " + objectName);
      }
   }
View Full Code Here

         for (Iterator i = tasks.entrySet().iterator(); i.hasNext();)
         {
            Map.Entry entry = getNextNonFinishedTaskEntry(i);
            if (entry == null) break;

            TimerTask t = (TimerTask)entry.getValue();
            TimerNotification n = t.getNotification();
            if (n.getType().equals(type))
            {
               queue.unschedule(t);
               i.remove();
               if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Notification " + n + " removed successfully from Timer service " + objectName);
View Full Code Here

      {
         for (Iterator i = tasks.entrySet().iterator(); i.hasNext();)
         {
            Map.Entry entry = getNextNonFinishedTaskEntry(i);
            if (entry == null) break;
            TimerTask t = (TimerTask)entry.getValue();
            TimerNotification n = t.getNotification();
            if (n.getType().equals(type))
            {
               vector.add(entry.getKey());
            }
         }
View Full Code Here

   public String getNotificationType(Integer id)
   {
      synchronized (this)
      {
         TimerTask t = getTask(id);
         return t == null ? null : t.getNotification().getType();
      }
   }
View Full Code Here

   public String getNotificationMessage(Integer id)
   {
      synchronized (this)
      {
         TimerTask t = getTask(id);
         return t == null ? null : t.getNotification().getMessage();
      }
   }
View Full Code Here

TOP

Related Classes of mx4j.timer.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.