Can static variables in SPI leak between realms

Hi,

We plan on having a few hundreds realms to bring many customer’s users inside a sole Keycloak database.

I am writing a storage SPI to provide transparent migration from our previous authentication (ASPNet Membership). Also, so you know, I am just starting in java/maven development.

I would like to use a static BasicDataSource to handle the pooling of the connections to our previous authentication databases.

Since each realm has its own previous authentication database, I am concerned the static BasicDataSource could land on the wrong database.

Does somebody knows if the storage SPIs are on a different execution context for separate realm?

Regards

Stéphane