J
Joe
Hi,
I'm writing a simple persistence layer to be used both in a
servlet-based webapp, and also for command line tools to access the
underlying store (a relational db).
Because of this dual use I want to avoid any mention of
ServletContext, etc in the Persistence layer, but I've run into a
problem.
I need to store some per-transaction information (such as the db
connection from the pool to use for the transaction, a local cache,
etc), but want to avoid passing it around with every call to the layer
I make (I want the layer to be as transparent as possible).
In a servlet application this would typically be achieved using the
context, which can be accessed from anywhere at anytime, but as stated
I'd like to avoid this.
So, my plan was to maintain an application wide hash relating Thread
names to context information.
Is this a reasonable plan? Or madness?
Any help/tips/advice welcome.
I'm writing a simple persistence layer to be used both in a
servlet-based webapp, and also for command line tools to access the
underlying store (a relational db).
Because of this dual use I want to avoid any mention of
ServletContext, etc in the Persistence layer, but I've run into a
problem.
I need to store some per-transaction information (such as the db
connection from the pool to use for the transaction, a local cache,
etc), but want to avoid passing it around with every call to the layer
I make (I want the layer to be as transparent as possible).
In a servlet application this would typically be achieved using the
context, which can be accessed from anywhere at anytime, but as stated
I'd like to avoid this.
So, my plan was to maintain an application wide hash relating Thread
names to context information.
Is this a reasonable plan? Or madness?
Any help/tips/advice welcome.