C
christopher
I am operating within Tomcat 6. I use 'collector' singletons to build
complex trees of objects from database queries. These singletons rely
on a pool of connections to various data sources, which are made
available via a 'connection pooling' singleton like this:
Connection
con=DriverManager.getConnection(MyPoolingSingleton.getPool("dbwrite"));
where "dbwrite" is the name of a connection that was established
earlier having certain permissions, etc.
My goal is to remove the 'collector' singletons to an app server and
obtain copies of them on a web server via serialization. They still
need access to the database after they are created. In this case the
'connection pooling' singleton must be instantiated locally on each
web server, since connections cannot be pooled across multiple JVM's
in my little world.
My question is, how to ensure the MySingleton.getPool() method call
points to the local singleton and not the singleton from the
originating server. Is it sufficient to ensure MyPoolingSingleton is
not serializable? Do I need to use a mechanism like a transient
instance variable to get a reference to the local copy of
MyPoolingSingleton?
Thanx all!
complex trees of objects from database queries. These singletons rely
on a pool of connections to various data sources, which are made
available via a 'connection pooling' singleton like this:
Connection
con=DriverManager.getConnection(MyPoolingSingleton.getPool("dbwrite"));
where "dbwrite" is the name of a connection that was established
earlier having certain permissions, etc.
My goal is to remove the 'collector' singletons to an app server and
obtain copies of them on a web server via serialization. They still
need access to the database after they are created. In this case the
'connection pooling' singleton must be instantiated locally on each
web server, since connections cannot be pooled across multiple JVM's
in my little world.
My question is, how to ensure the MySingleton.getPool() method call
points to the local singleton and not the singleton from the
originating server. Is it sufficient to ensure MyPoolingSingleton is
not serializable? Do I need to use a mechanism like a transient
instance variable to get a reference to the local copy of
MyPoolingSingleton?
Thanx all!