Search in sources :

Example 1 with Timer

use of java.util.Timer in project jetty.project by eclipse.

the class TimerScheduler method schedule.

@Override
public Task schedule(final Runnable task, final long delay, final TimeUnit units) {
    Timer timer = _timer;
    if (timer == null)
        throw new RejectedExecutionException("STOPPED: " + this);
    SimpleTask t = new SimpleTask(task);
    timer.schedule(t, units.toMillis(delay));
    return t;
}
Also used : Timer(java.util.Timer) RejectedExecutionException(java.util.concurrent.RejectedExecutionException)

Example 2 with Timer

use of java.util.Timer in project jetty.project by eclipse.

the class TimerScheduler method run.

@Override
public void run() {
    Timer timer = _timer;
    if (timer != null) {
        timer.purge();
        schedule(this, 1, TimeUnit.SECONDS);
    }
}
Also used : Timer(java.util.Timer)

Example 3 with Timer

use of java.util.Timer in project zeppelin by apache.

the class ZeppelinClient method addRoutines.

private void addRoutines() {
    schedulerService.add(ZeppelinHeartbeat.newInstance(this), 10, 1 * MIN);
    new Timer().schedule(new java.util.TimerTask() {

        @Override
        public void run() {
            watcherSession = openWatcherSession();
        }
    }, 5000);
}
Also used : Timer(java.util.Timer)

Example 4 with Timer

use of java.util.Timer in project UltimateAndroid by cymcsg.

the class CircleProgressActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.circle_progress_activity_my);
    donutProgress = (DonutProgress) findViewById(R.id.donut_progress);
    circleProgress = (CircleProgress) findViewById(R.id.circle_progress);
    arcProgress = (ArcProgress) findViewById(R.id.arc_progress);
    timer = new Timer();
    timer.schedule(new TimerTask() {

        @Override
        public void run() {
            runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    donutProgress.setProgress(donutProgress.getProgress() + 1);
                    circleProgress.setProgress(circleProgress.getProgress() + 1);
                    arcProgress.setProgress(arcProgress.getProgress() + 1);
                }
            });
        }
    }, 1000, 100);
}
Also used : Timer(java.util.Timer) TimerTask(java.util.TimerTask)

Example 5 with Timer

use of java.util.Timer in project PlayerHater by chrisrhoden.

the class PlaylistSupportingPlayer method startWithFade.

public void startWithFade() throws IllegalStateException {
    setVolume(0, 0);
    start();
    final Timer timer = new Timer(true);
    TimerTask timerTask = new TimerTask() {

        @Override
        public void run() {
            setVolume(mLeftVolume + 0.1f, mRightVolume + 01.f);
            if (mLeftVolume >= 1.0f || mRightVolume >= 1.0f) {
                timer.cancel();
                timer.purge();
            }
        }
    };
    timer.schedule(timerTask, 200, 200);
}
Also used : Timer(java.util.Timer) TimerTask(java.util.TimerTask)

Aggregations

Timer (java.util.Timer)1048 TimerTask (java.util.TimerTask)653 IOException (java.io.IOException)93 Test (org.junit.Test)67 Date (java.util.Date)57 File (java.io.File)30 Intent (android.content.Intent)25 Handler (android.os.Handler)22 ArrayList (java.util.ArrayList)22 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)21 AtomicLong (java.util.concurrent.atomic.AtomicLong)20 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)19 TextView (android.widget.TextView)18 View (android.view.View)17 List (java.util.List)16 HashMap (java.util.HashMap)14 Random (java.util.Random)14 CountDownLatch (java.util.concurrent.CountDownLatch)14 URISyntaxException (java.net.URISyntaxException)12 InputMethodManager (android.view.inputmethod.InputMethodManager)11