How to pass the polling thread to another thread for processing.
The program execution beings in a controller class which has a main method and a thread pool:
You need to read something like this first. You cannot use wait() without holding the object's monitor. Also, from a short glance, it looks like you use a non-final static member in a multithreading context. Try to make that thread-safe.