public static Scheduler computation() { return createScheduler(coreSize); } }
public static Scheduler computation() { return createScheduler(coreSize); } }
public static Scheduler computation() { return createScheduler(coreSize); } }
public static Scheduler createScheduler() { return createScheduler(1); }
/** * 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 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); } }