I'm trying to transfer data (from a thread started in a ServletContextListener which is continuously adding data to the queue) to a ServletContextAttributeListener.
The data from the queue needs to be passed on to the connected clients which are notified on "attributeReplaced".
The data is contained in a BlockingQueue.
However I'm kind of confused; if I'm placing the BlockingQueue in the context by calling
private BlockingQueue<String> queue = new LinkedBlockingQueue<String>();
//..
event.getServletContext().setAttribute("serialPortData", queue);
//..
Question: Does the context then contain a copy of this Queue or a pointer?
Because if it only copies the queue then it would not make sense to add a Queue to the context right? Or would you solve this problem in another way?
Thomas.