diff --git a/src/main/java/gov/nasa/pds/harvest/dao/RegistryManager.java b/src/main/java/gov/nasa/pds/harvest/dao/RegistryManager.java index 7264472b..14e47fda 100644 --- a/src/main/java/gov/nasa/pds/harvest/dao/RegistryManager.java +++ b/src/main/java/gov/nasa/pds/harvest/dao/RegistryManager.java @@ -31,14 +31,14 @@ public class RegistryManager private RestClient client; - private RegistryDao registryDao; - private SchemaDao schemaDao; - private DataDictionaryDao ddDao; + final private RegistryDao registryDao; + final private SchemaDao schemaDao; + final private DataDictionaryDao ddDao; private MetadataWriter registryWriter; private CollectionInventoryWriter invWriter; - private FieldNameCache fieldNameCache; + final private FieldNameCache fieldNameCache; private Counter counter; @@ -76,9 +76,11 @@ private RegistryManager(ConnectionFactory conFact, boolean overwriteFlag) throws * @param overwriteFlag overwrite registered products * @throws Exception Generic exception */ - public static void init(ConnectionFactory conFact, boolean overwriteFlag) throws Exception + public static synchronized void init(ConnectionFactory conFact, boolean overwriteFlag) throws Exception { + if (instance == null) { instance = new RegistryManager(conFact, overwriteFlag); + } }