Move YdbRepository start behavior from YdbRepository constructor to separate method
lavrukov opened this issue · 3 comments
lavrukov commented
YdbRepository in the constructor establishes a connection to the database, because it is impossible to separate the stages of object initialization and start.
It seems that what is needed here is a factory object which will create a SessionManager and return a Repository
nvamelichev commented
🤪 This is an unexpected change in YDB SDK v2, constructing a GrpcTransport
immediately establishes a GRPC connection:
public GrpcTransport build() {
YdbTransportImpl impl = new YdbTransportImpl(this);
try {
impl.init();
We might just add a Guava Suppliers.memoize()
for GrpcTransport
and SessionManager
in YdbRepository
to make initialization lazy, as it was in repository-ydb-v1
.
nvamelichev commented
➡️ See PR with lazy initialization here:
#61
nvamelichev commented
Fixed, the fix will appear in 2.2.11.