You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jerry Malcolm <te...@malcolms.com> on 2021/11/02 20:47:03 UTC
Host-wide Singleton Instance
I am adding a redis implementation (jedis) to my application. I have a
jedis implementation class that holds the connection pool and interfaces
with jedis. That class needs to be instantiated once per host and then
referenced from that point on by all of the webapps in the host. Is
there an 'architected/correct' way to set this up?
Thx
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Host-wide Singleton Instance
Posted by Mark Thomas <ma...@apache.org>.
On 02/11/2021 20:47, Jerry Malcolm wrote:
> I am adding a redis implementation (jedis) to my application. I have a
> jedis implementation class that holds the connection pool and interfaces
> with jedis. That class needs to be instantiated once per host and then
> referenced from that point on by all of the webapps in the host. Is
> there an 'architected/correct' way to set this up?
I'd suggest configuring it as a global JNDI resource [1] and then using
resource links to make it available to the web applications that need
it. If every web application needs it, you can add the resource link to
$CATALINA_BASE/conf/context.xml and then will add the link to every web
application deployed on the Tomcat instance.
Mark
[1]
http://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html#Global_configuration
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org