Take the 2-minute tour ×  I'm using the ServletContextListener
to create a new thread.  import
javax.servlet.ServletContextEvent; import
javax.servlet.ServletContextListener; import
java.util.concurrent.*;      public class Port implements
ServletContextListener {         private ExecutorService
executor;          public void
contextDestroyed(ServletContextEvent event) {           public
void contextInitialized(ServletContextEvent event) {
// start task             executor =
Executors.newSingleThreadExecutor();
executor.submit(new Task()); //task should implement Runnable!
Inside this thread I'm reading data from a serial port
(SerialPortEventListener). The task.class should read out
information from the serial port during the whole period in
which the server is active. I've thrown this inside a thread
because there can only be one instance that reads from the
serial port; data should then be shared to all clients.  Now I
would like to acces the data this thread is reading from the