You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Cellar container class was designed with the ability to close services explicitly declared as closeable, to that end it was made to implement the AutoCloseable interface in order to be used in constructs such as:
..and automatically release any resource that may need it upon reaching the end of the try-with.
However, in lumio-vault the Cellar is currently "dissolved" into the Vault provider mapping system, so we typically can't close the Cellar itself, or at least not in a straightforward way. As a result, the closeable feature was implemented in such a way that each instance provided by a Cellar and marked as closeable is indexed in the Vault container, and the Vault class itself was made an AutoCloseable that iterates on the indexed instances and attempts to close them.
As a result we can already do something like this:
As it stands, the indexing process retains all instances that were once registered into the Vault container, even if they were overwritten by another Cellar afterwards. This makes for a rather unpredictable behaviour that later versions should probably try to address.
One possibility could be to "directly" register the Cellar instances themselves (rather than dissolve their contents into the Vault), either for the sole purpose of tracking autocloseable behaviours down the line, or possibly even as a alternate strategy have a more fine-grained management of registered cellars (dynamically resolve service availability at injection time?).
The text was updated successfully, but these errors were encountered:
The
Cellar
container class was designed with the ability to close services explicitly declared ascloseable
, to that end it was made to implement theAutoCloseable
interface in order to be used in constructs such as:..and automatically release any resource that may need it upon reaching the end of the try-with.
However, in
lumio-vault
theCellar
is currently "dissolved" into theVault
provider mapping system, so we typically can't close theCellar
itself, or at least not in a straightforward way. As a result, thecloseable
feature was implemented in such a way that each instance provided by aCellar
and marked ascloseable
is indexed in theVault
container, and theVault
class itself was made anAutoCloseable
that iterates on the indexed instances and attempts to close them.As a result we can already do something like this:
As it stands, the indexing process retains all instances that were once registered into the
Vault
container, even if they were overwritten by anotherCellar
afterwards. This makes for a rather unpredictable behaviour that later versions should probably try to address.One possibility could be to "directly" register the
Cellar
instances themselves (rather than dissolve their contents into theVault
), either for the sole purpose of trackingautocloseable
behaviours down the line, or possibly even as a alternate strategy have a more fine-grained management of registered cellars (dynamically resolve service availability at injection time?).The text was updated successfully, but these errors were encountered: