I have the next project:
Spring(3.2)-based Web application(Tomcat 7), in background I have several tasks.
I have a queue with some information for processing. This queue is updating periodically(but just when it empty).
Also I have several threads that enqueue periodically data from this queue and process.
For scheduling I wanted to use ScheduledExecutorService.
I have several problems\questions:
How to keep this queue? As I think it should be global. Should I make it static in some "holder" class? Won't be this a poor desing?
Where will be the good place for initializing this queue and all the task with ScheduledExecutorService? Is ServletContextLoadingListener a good place for it? Are there any ways to init this with Spring?
Should I use several ScheduledExecutorService instances if I need to control the number of consumer threads exactly?
Will ArrayBlockingQueue be good for this case?