In case anyone comes across this particular issue, here is what it was
causing it for me, and how I fixed it.
Cause of the issue lied in the missing @Singleton annotation. Since
JDBIFactory was extended and the provide() method had to be overridden in
order to create valid Jdbi instances, the method had to be marked as a
singleton explicitly in order to avoid it being called multiple times.
@Override@Singletonpublic Jdbi provide() {
Jdbi jdbi = super.provide().installPlugin(new PostgresPlugin());
return jdbi;}
As the method wasn't annotated with @Singleton, it was being run with every
call to the DAO layer, which in turn kept creating 8 new connections (equal
to minSize property of the connection pool, taken from the application
config file) on each call.
Since I use HK2 for DI, I needed an additional library (
https://github.com/alex-shpak/dropwizard-hk2bundle) to make things work.
The JDBIFactory class comes from the library and the provide() method is
the one I had to override.
On Saturday, June 8, 2019 at 2:30:47 AM UTC+2, Radomir Djurdjevic wrote:
>
> Hi guys,
>
> I have an issue with a health check query that appears approximately 10
> times each time connection is established, although I've never set this
> check explicitly. It's the validation query:
>
> /* Health Check */ SELECT 1
>
> In the *config.yml* I use for running the service there is no
> *valiidationQuery* property set, which makes me wonder where is this
> health check coming from. I do not have any other health checks put in
> place, so it can't be coming from the *health* module.
> Does anyone have an idea what could be making the health check?
>
> I am using:
>
> - Java 8
> - PostgreSQL 11
> - DropWizard 1.3.5
> - JDBI3
>
>
> Thanks a lot,
> Rasha
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dropwizard-user/f60b05eb-dae2-441d-9a7a-dedbae54d01a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.