mirror of
https://github.com/google/nomulus
synced 2026-09-09 09:36:12 +00:00
Delay SQL availability check during Tool start (#643)
* Delay SQL availability check during Tool start During Cloud SQL migration, Cloud SQL password setup in Registry server requires a few tool commands. Such commands must be able to run before Cloud SQL is configured. In this change, we deplay SQL credential loading until access is needed.
This commit is contained in:
+3
-2
@@ -21,6 +21,7 @@ import static org.testcontainers.containers.PostgreSQLContainer.POSTGRESQL_PORT;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Suppliers;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
@@ -199,12 +200,12 @@ abstract class JpaTransactionManagerRule extends ExternalResource {
|
||||
}
|
||||
JpaTransactionManagerImpl txnManager = new JpaTransactionManagerImpl(emf, clock);
|
||||
cachedTm = TransactionManagerFactory.jpaTm();
|
||||
TransactionManagerFactory.setJpaTm(txnManager);
|
||||
TransactionManagerFactory.setJpaTm(Suppliers.ofInstance(txnManager));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void after() {
|
||||
TransactionManagerFactory.setJpaTm(cachedTm);
|
||||
TransactionManagerFactory.setJpaTm(Suppliers.ofInstance(cachedTm));
|
||||
cachedTm = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user