Package java.util

Examples of java.util.TimerTask


    start();
  }

  private void startTimeoutPresenceTask() {
    runningTask = new TimerTask() {
      @Override
      public void run() {
        try {
          if (running && !manager.isLeaderConnected())
            // TIMEOUT: STOP TO SEND PACKETS TO BEING DISCOVERED
View Full Code Here


    {
        Date now = new Date( );

        Date then = new Date( now.getTime( ) + item.getRule( ).getDuration( ).getDuration( item.getTuple( ) ) );

        TimerTask task = new AgendaItemFireListener( item,
                                                     workingMemory );

        this.scheduler.schedule( task,
                                 then );
View Full Code Here

     * @param item
     *            The item to cancle.
     */
    void cancelAgendaItem(AgendaItem item)
    {
        TimerTask task = (TimerTask) this.tasks.remove( item );

        if ( task != null )
        {
            task.cancel( );
        }
    }
View Full Code Here

        if (wheelTimer != null) {
            wheelTimer.cancel();
            wheelTimer = null;
        }
        wheelTimer = new Timer();
        wheelTimer.schedule(new TimerTask() {

            @Override
            public void run() {
                moving = false;
                redraw();
View Full Code Here

        do {
            afe = null;
            try {
                calledMethods.clear();
                final ObjectPool pool = (ObjectPool)createProxy(ObjectPool.class, calledMethods);
                final TimerTask task = PoolUtils.checkMinIdle(pool, 1, CHECK_PERIOD); // checks minIdle immediately

                Thread.sleep(CHECK_SLEEP_PERIOD); // will check CHECK_COUNT more times.
                task.cancel();
                task.toString();

                final List expectedMethods = new ArrayList();
                for (int i=0; i < CHECK_COUNT; i++) {
                    expectedMethods.add("getNumIdle");
                    expectedMethods.add("addObject");
View Full Code Here

        do {
            afe = null;
            try {
                calledMethods.clear();
                final KeyedObjectPool pool = (KeyedObjectPool)createProxy(KeyedObjectPool.class, calledMethods);
                final TimerTask task = PoolUtils.checkMinIdle(pool, key, 1, CHECK_PERIOD); // checks minIdle immediately

                Thread.sleep(CHECK_SLEEP_PERIOD); // will check CHECK_COUNT more times.
                task.cancel();
                task.toString();

                final List expectedMethods = new ArrayList();
                for (int i=0; i < CHECK_COUNT; i++) {
                    expectedMethods.add("getNumIdle");
                    expectedMethods.add("addObject");
View Full Code Here

                final Map tasks = PoolUtils.checkMinIdle(pool, keys, 1, CHECK_PERIOD); // checks minIdle immediately

                Thread.sleep(CHECK_SLEEP_PERIOD); // will check CHECK_COUNT more times.
                final Iterator iter = tasks.values().iterator();
                while (iter.hasNext()) {
                    final TimerTask task = (TimerTask)iter.next();
                    task.cancel();
                }

                final List expectedMethods = new ArrayList();
                for (int i=0; i < CHECK_COUNT * keys.size(); i++) {
                    expectedMethods.add("getNumIdle");
View Full Code Here

     * Starts timer if it is not already started
     */
    private synchronized void startTimer() {
         if (timer == null) {
            timer = new Timer();
            TimerTask task = new TimerTask() {
                public void run() {
                  try {
                    timerEvent();
                  }
                  catch (IOException ioe) {
View Full Code Here

    private synchronized void attributeChanged() {
        if (currentTask != null) {
            currentTask.cancel();
        }
        if (timer != null) {
            currentTask = new TimerTask() {

                public void run() {
                    try {
                        LocalAttributeManager.this.save();
                    } catch (IOException e) {
View Full Code Here

                monitor.cancel();
            }

            // start the new one
            monitor = new URLMonitorTask();
            TimerTask task = monitor;
            timer.schedule(monitor, 1000 * refreshPeriod, 1000 * refreshPeriod);
            task.run();
        }
    }
View Full Code Here

TOP

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