Search in sources :

Example 86 with Timer

use of java.util.Timer in project glitch-hq-android by tinyspeck.

the class SkillDetailFragment method InitUpdateSkillRemainingTimer.

private void InitUpdateSkillRemainingTimer() {
    if (m_RemainingTimer != null)
        m_RemainingTimer.cancel();
    m_RemainingTimer = new Timer();
    m_RemainingTimer.scheduleAtFixedRate(new TimerTask() {

        public void run() {
            FragmentActivity act = getActivity();
            if (act != null) {
                act.runOnUiThread(new Runnable() {

                    public void run() {
                        if (m_currentSkill.learning && !m_currentSkill.paused && !m_currentSkill.got && !m_fromUnlearn)
                            UpdateSkillDetailProgress();
                        else if (m_currentSkill.unlearning)
                            UpdateUnlearnDetailProgress();
                    }
                });
            }
        }
    }, 1000, 1000);
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) Timer(java.util.Timer) TimerTask(java.util.TimerTask)

Example 87 with Timer

use of java.util.Timer in project commons by twitter.

the class BufferedLog method start.

/**
   * Starts the log submission service by scheduling a timer to periodically submit messages.
   */
private void start() {
    long flushIntervalMillis = flushInterval.as(Time.MILLISECONDS);
    new Timer(true).scheduleAtFixedRate(logPusher, flushIntervalMillis, flushIntervalMillis);
}
Also used : Timer(java.util.Timer)

Example 88 with Timer

use of java.util.Timer in project Shuttle by timusus.

the class VideoCastControllerFragment method restartTrickplayTimer.

private void restartTrickplayTimer() {
    stopTrickplayTimer();
    mSeekbarTimer = new Timer();
    mSeekbarTimer.scheduleAtFixedRate(new UpdateSeekbarTask(), 100, 1000);
    LOGD(TAG, "Restarted TrickPlay Timer");
}
Also used : Timer(java.util.Timer)

Example 89 with Timer

use of java.util.Timer in project syncany by syncany.

the class RecursiveWatcher method restartWaitSettlementTimer.

private synchronized void restartWaitSettlementTimer() {
    logger.log(Level.FINE, "File system events registered. Waiting " + settleDelay + "ms for settlement ....");
    if (timer != null) {
        timer.cancel();
        timer = null;
    }
    timer = new Timer("FsSettleTim/" + root.toFile().getName());
    timer.schedule(new TimerTask() {

        @Override
        public void run() {
            logger.log(Level.INFO, "File system actions (on watched folders) settled. Updating watches ...");
            watchEventsOccurred();
            fireListenerEvents();
        }
    }, settleDelay);
}
Also used : Timer(java.util.Timer) TimerTask(java.util.TimerTask)

Example 90 with Timer

use of java.util.Timer in project syncany by syncany.

the class WatchOperation method scheduleForceKill.

private void scheduleForceKill() {
    String killTimerName = "Kill/" + config.getLocalDir().getName();
    new Timer(killTimerName).schedule(new TimerTask() {

        @Override
        public void run() {
            try {
                logger.log(Level.INFO, "STOP GRACE PERIOD OVER. STOPPING WATCH " + config.getLocalDir() + " ...");
                if (watchThread != null && !watchThread.isInterrupted()) {
                    watchThread.interrupt();
                }
            } catch (Exception e) {
                logger.log(Level.INFO, "Forcefully stopping watch thread FAILED at " + config.getLocalDir() + ". Giving up.");
            }
        }
    }, STOP_GRACE_PERIOD);
}
Also used : Timer(java.util.Timer) TimerTask(java.util.TimerTask)

Aggregations

Timer (java.util.Timer)448 TimerTask (java.util.TimerTask)262 IOException (java.io.IOException)33 Date (java.util.Date)22 Test (org.junit.Test)15 File (java.io.File)11 ArrayList (java.util.ArrayList)10 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)10 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)9 JobExecutor (org.activiti.engine.impl.jobexecutor.JobExecutor)9 Intent (android.content.Intent)8 Location (android.location.Location)8 LocationListener (android.location.LocationListener)8 Bundle (android.os.Bundle)8 ActivitiException (org.activiti.engine.ActivitiException)8 View (android.view.View)7 InputMethodManager (android.view.inputmethod.InputMethodManager)7 ImageView (android.widget.ImageView)7 BufferedReader (java.io.BufferedReader)7 InputStreamReader (java.io.InputStreamReader)7