Hello everyone! We're looking for a good solution to allow different types of Web app users communicate with each other. To be more specific, on one side we have regular JSP page users whose actions (login, DB data change) can generate occasional messages/alerts; on the other side we have a different type of users (administrators) who are using Applets to monitor ("real-time") the actions done by JSP users.
The idea we have is to use ServletContext to store a HashMap with messages/alerts. This HashMap is populated when JSP user requests are processed. Administrator's applet is checking the ServletContext HashMap every 5-30 seconds and reads/clears the messages from it.
The only doubt with this approach we see is that ServletContext seem to be designed for static data, loaded once when the Web app is started, while in our case the data is dynamic and needs synchronized access for updates (reads too?).
Not sure if JMS can help here. Seems it can only help with synchronization/locking issues. The JSP user threads can concurrently put messages in JMS queue and Administator�s applet won�t need to worry about synchronous access to ServletContext; but HashMap is synchronized anyway?
JMS sounds pretty cool here because it is asynchronous and has optional assured delivery. Plus your description of putting data in and getting it out sounds exactly like a queue, less like a map. Oooh, and you could send data from a whole cluster of worker-bee servers to one reporting server.
Now I'm going to shut up and listen as the context map experts weigh in!
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi