Hello Val,
It sounds like you're using `DBI.onDemand` as it's intended. The typical
case is to create a set of DAO objects once via `DBI.onDemand` from within
an `Application#run` method.
However, I too am currently trying to debug cases where stale database
connections (e.g. after a DB server restart) aren't removed from the pool.
In my case, this occurs even when I have jDBI configured to perform
periodic validation queries to the database.
Val, are you using validation queries? These can be configured with the
`database.{validationQuery, validationQueryTimeout,
checkConnectionWhileIdle, evictionInterval}` configuration options.
On Mon, Dec 12, 2016 at 8:08 AM, Val Akkapeddi <[email protected]>
wrote:
> Hi all! I had a question about the lifetime of dao instances created
> using DBI.onDemand in DropWizard JDBI. Currently, I am creating the
> instances once during the initialization of my DropWizard application and
> persisting them for the lifetime. Is this the proper way to use onDemand,
> or should I get a new DAO instance every time I want to run a query?
>
>
> I have observed a situation where if you're running Dropwizard inside a
> Docker & let it idle for a day or so, my dao instances aren't reopening
> connections to the RDBMS - I just see "connection is closed" errors, as if
> jdbi is attempting to execute queries against a connection that's closed.
>
> --
> You received this message because you are subscribed to the Google Groups
> "dropwizard-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
Evan Meagher
--
You received this message because you are subscribed to the Google Groups
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.