public static Fiber threadFiber() { Fiber fiber = new ThreadFiber(); fiber.start(); return fiber; }
/** * Create thread backed fiber * * @param queue - target queue * @param threadName - name to assign thread * @param isDaemonThread - true if daemon thread * @param scheduler - scheduler for delayed tasks */ public ThreadFiber(RunnableExecutor queue, String threadName, boolean isDaemonThread, Scheduler scheduler) { _queue = queue; Runnable runThread = new Runnable() { public void run() { _queue.run(); } }; _thread = createThread(threadName, runThread); _thread.setDaemon(isDaemonThread); _scheduler = scheduler; }
/** * Create thread backed fiber * * @param queue - target queue * @param threadName - name to assign thread * @param isDaemonThread - true if daemon thread * @param scheduler - scheduler for delayed tasks */ public ThreadFiber(RunnableExecutor queue, String threadName, boolean isDaemonThread, Scheduler scheduler) { _queue = queue; Runnable runThread = new Runnable() { public void run() { _queue.run(); } }; _thread = createThread(threadName, runThread); _thread.setDaemon(isDaemonThread); _scheduler = scheduler; }
public WsEventListener() { this(new ThreadFiber(new RunnableExecutorImpl(), "ws-events", true)); }