Server: binary database can be closed twice
I implement a SiLA Server using the following code:
try (BinaryDatabase binaryDatabase = new H2BinaryDatabase(...);
SiLAServer server = SiLAServer.Builder.withConfig(...)
.withBinaryTransferSupport(binaryDatabase)
.start()) {
Utils.blockUntilStop();
}
-
SiLAServer.Builder.withBinaryTransferSupport()creates theBinaryDatabaseinternally, thus the server is responsible for managing/closing it -
SiLAServer.Builder.withBinaryTransferSupport(BinaryDatabase database)gets provided with an externally managed database and thus is NOT responsible for closing it
But SiLAServer.close() always closes the database, so above code tries to close the database twice, leading to org.h2.jdbc.JdbcSQLNonTransientException: The object is already closed.