public static Scheduler computation() { return createScheduler(coreSize); } }
/** * Construct a leak detector. It helps you to track the resource leak. * * @param initialDelay The time to delay first execution * @param delay The delay between the termination of one * execution and the commencement of the next * @param unit The time unit of the initialDelay and delay parameters * @param noLeakCallback If not any resources leak, the detector will execute this action. */ public LeakDetector(long initialDelay, long delay, TimeUnit unit, Action0 noLeakCallback) { this(Schedulers.computation(), initialDelay, delay, unit, noLeakCallback); }
public static Scheduler createScheduler(int corePoolSize) { ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(corePoolSize, factory); executor.setRemoveOnCancelPolicy(true); return wrapScheduledExecutorService(executor); }
public static Scheduler createScheduler(int corePoolSize) { ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(corePoolSize, factory); executor.setRemoveOnCancelPolicy(true); return wrapScheduledExecutorService(executor); }
public static Scheduler computation() { return createScheduler(coreSize); } }
public static Scheduler createScheduler(int corePoolSize) { ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(corePoolSize, factory); executor.setRemoveOnCancelPolicy(true); return wrapScheduledExecutorService(executor); }
/** * Construct a leak detector. It helps you to track the resource leak. * * @param initialDelay The time to delay first execution * @param delay The delay between the termination of one * execution and the commencement of the next * @param unit The time unit of the initialDelay and delay parameters * @param noLeakCallback If not any resources leak, the detector will execute this action. */ public LeakDetector(long initialDelay, long delay, TimeUnit unit, Action0 noLeakCallback) { this(Schedulers.computation(), initialDelay, delay, unit, noLeakCallback); }
public static Scheduler computation() { return createScheduler(coreSize); } }
/** * Construct a HealthCheck. It helps you to check the object is alive. * * @param initialDelay The time to delay first execution * @param delay The delay between the termination of one * execution and the commencement of the next * @param unit The time unit of the initialDelay and delay parameters */ public HealthCheck(long initialDelay, long delay, TimeUnit unit) { this(Schedulers.createScheduler(), initialDelay, delay, unit); }
/** * Construct a HealthCheck. It helps you to check the object is alive. * * @param initialDelay The time to delay first execution * @param delay The delay between the termination of one * execution and the commencement of the next * @param unit The time unit of the initialDelay and delay parameters */ public HealthCheck(long initialDelay, long delay, TimeUnit unit) { this(Schedulers.createScheduler(), initialDelay, delay, unit); }
public static Scheduler createScheduler() { return createScheduler(1); }
public static Scheduler createScheduler() { return createScheduler(1); }
public static Scheduler createScheduler() { return createScheduler(1); }
public static void main(String[] args) throws Exception { Scheduler scheduler = Schedulers.createScheduler(); Path path = Paths.get(WebSocketServerDemo.class.getResource("/").toURI()); $.httpServer() .router().get("/static/*").handler(new StaticFileHandler(path.toAbsolutePath().toString())) .router().get("/").handler(ctx -> ctx.renderTemplate("template/websocket/index.mustache")) .webSocket("/helloWebSocket") .onConnect(conn -> { Scheduler.Future future = scheduler.scheduleAtFixedRate(() -> conn.sendText("Current time: " + new Date()), 0, 1, TimeUnit.SECONDS); conn.onClose(c -> future.cancel()); }) .onText((text, conn) -> System.out.println("Server received: " + text)) .listen("localhost", 8080); } }