Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * The MIT License (MIT)
  * Copyright (c) 2015 Christian Gärtner
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
package org.achtern.AchternEngine.core.util.async;
Basic Helper for executing stuff aysnc. This is a single threaded scheduled Executor, so do not fire big tasks at this class.

public class AsyncHandler {
    private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();

Shutdown the worker thread. Do not call this method if you want to use this class at some point in the future, to stop a single submitted Runnable call java.util.concurrent.Future.cancel(boolean)

    public static void shutdown() {
    public ScheduledFuture<?> postDelayed(Runnable runnablelong millis) {
        return postDelayed(runnablemillis.);
    public ScheduledFuture<?> postDelayed(Runnable runnablelong timeTimeUnit unit) {
        return .schedule(runnabletimeunit);
New to GrepCode? Check out our FAQ X