If database is the answer, you could use memcache/redis to do this too. It should be able to support multiple servers if you need.
Since it’s only persistent based on tomcat, I was thinking at the servlet context level only. Provided that database read overhead is acceptable, it’s a more persistent solution. Thanks, On Tue, 11 Feb 2020 at 20:56, Rouse, Ed <ero...@milner.com> wrote: > > > From: Jerry Malcolm <techst...@malcolms.com> > Sent: Tuesday, February 11, 2020 3:12 PM > To: users@tomcat.apache.org > Subject: Cross-session Persistent Object? > > [External email: Use caution! Do not open attachments or click on links > from unknown senders or unexpected emails.] > I need some advice. I need to maintain a set of long-running threads. > When a request comes in, I need to determine if I have a thread started > for a particular id found in the request. So I need to have a hashmap > of threads keyed by the ids. That part is simple enough. But I'm > struggling with where to keep that hashmap object so that it is > available to all incoming requests (any session). This object should > persistently remain as long as Tomcat is active. It must be scoped to > the virtual host and only needs to be available in one webapp context > within that host. Suggestions on how to proceed will be greatly > appreciated. > > Thx. > > Jerry > > I would set up a database table to store the values and create a > class/script depending on your > environment that would be able to do crud processes on the table. Maybe > set it up as a web service > if that would allow easier access for the individual webapps. > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org<mailto: > users-unsubscr...@tomcat.apache.org> > For additional commands, e-mail: users-h...@tomcat.apache.org<mailto: > users-h...@tomcat.apache.org> >