Servlet app connection scope

21 views
Skip to first unread message

klc

unread,
May 15, 2015, 11:18:55 PM5/15/15
to google...@googlegroups.com
Hi

I have a servlet app that use custom connect pool (Transaction is handled by it). And connection is used in service of request (obviously) but also during initialization
The initialization could be eagar (on server startup) or lazy (when the first request arrive)

My implementation would be a singleton connection pool and a provider of connection, which inject the connection pool. (I guess this make sense?)

Should the connection be request scope?
If it is, will the service of request use a closed connection in case of lazy initialization? 
My guess is guice won't check if the connection is close, and just return the cache value in request scope?

Is there a way to do it?

klc


klc

unread,
May 16, 2015, 12:19:40 AM5/16/15
to google...@googlegroups.com
Hi guys, after a nice shower i think i can do this by 2 providers/2 annotations with a custom scope. :)
Reply all
Reply to author
Forward
0 new messages