rabbit.httpio
Class SelectorRunner

java.lang.Object
  extended by rabbit.httpio.SelectorRunner
All Implemented Interfaces:
Runnable, TaskRunner

public class SelectorRunner
extends Object
implements Runnable, TaskRunner

A class that handles a selector.

Author:
Robert Olofsson

Constructor Summary
SelectorRunner(ExecutorService executorService, Logger logger)
           
 
Method Summary
 Selector getSelector()
           
 void run()
           
 void runMainTask(Runnable r)
          Run a task on the main thread.
 void runThreadTask(Runnable r)
          Run a task in another thread.
 void shutdown()
          Shut down this task runner.
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectorRunner

public SelectorRunner(ExecutorService executorService,
                      Logger logger)
               throws IOException
Throws:
IOException
Method Detail

start

public void start()

stop

public void stop()

runThreadTask

public void runThreadTask(Runnable r)
Description copied from interface: TaskRunner
Run a task in another thread. The task will be run sometime in the future.

Specified by:
runThreadTask in interface TaskRunner
Parameters:
r - the task to run.

runMainTask

public void runMainTask(Runnable r)
Description copied from interface: TaskRunner
Run a task on the main thread. The task will be run sometime in the future.

Specified by:
runMainTask in interface TaskRunner
Parameters:
r - the task to run on the main thread.

shutdown

public void shutdown()
Description copied from interface: TaskRunner
Shut down this task runner.

Specified by:
shutdown in interface TaskRunner

getSelector

public Selector getSelector()

run

public void run()
Specified by:
run in interface Runnable