diff --git a/README.md b/README.md index 772775a..193fa1a 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,11 @@ The driver recognizes the following environment variables: * Specifies the path to the Indy SDK library. * Default value: (empty string) +### `uniresolver_driver_did_sov_openParallel` + +* Specifies whether to open Indy pools in parallel threads. This speeds up startup, but may consume more memory. +* Default value: false + ### `uniresolver_driver_did_sov_poolConfigs` * Specifies a semi-colon-separated list of Indy network names and pool configuration files. The default network is `_`. diff --git a/docker/Dockerfile b/docker/Dockerfile index 42e83db..057a654 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -38,6 +38,7 @@ USER jetty # variables ENV uniresolver_driver_did_sov_libIndyPath= +ENV uniresolver_driver_did_sov_openParallel=false ENV uniresolver_driver_did_sov_poolConfigs=_;./sovrin/_.txn;test;./sovrin/test.txn;builder;./sovrin/builder.txn;danube;./sovrin/danube.txn;idunion;./sovrin/idunion.txn;idunion:test;./sovrin/idunion-test.txn;indicio;./sovrin/indicio.txn;indicio:test;./sovrin/indicio-test.txn;indicio:demo;./sovrin/indicio-demo.txn;nxd;./sovrin/nxd.txn;findy:test;./sovrin/findy-test.txn;bcovrin;./sovrin/bcovrin.txn;bcovrin:test;./sovrin/bcovrin-test.txn;bcovrin:dev;./sovrin/bcovrin-dev.txn;candy;./sovrin/candy.txn;candy:test;./sovrin/candy-test.txn;candy:dev;./sovrin/candy-dev.txn ENV uniresolver_driver_did_sov_poolVersions=_;2;test;2;builder;2;danube;2;idunion;2;idunion:test;2;indicio;2;indicio:test;2;indicio:demo;2;nxd;2;findy:test;2;bcovrin;2;bcovrin:test;2;bcovrin:dev;2;candy;2;candy:test;2;candy:dev;2 ENV uniresolver_driver_did_sov_walletNames=_;w1;test;w2;builder;w3;danube;w4;idunion;w5;idunion:test;w6;indicio;w7;indicio:test;w8;indicio:demo;w9;nxd;w11;findy:test;w12;bcovrin;w13;bcovrin:test;w14;bcovrin:dev;w15;candy;w16;candy:test;w17;candy:dev;w18 diff --git a/pom.xml b/pom.xml index d5dc881..34e5f63 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ - 0.3.0 + 0.4.0 1.11.0 0.0.2 diff --git a/src/main/java/uniresolver/driver/did/sov/DidSovDriver.java b/src/main/java/uniresolver/driver/did/sov/DidSovDriver.java index d7648cb..aabab26 100644 --- a/src/main/java/uniresolver/driver/did/sov/DidSovDriver.java +++ b/src/main/java/uniresolver/driver/did/sov/DidSovDriver.java @@ -33,6 +33,7 @@ public class DidSovDriver implements Driver { private Map properties; private LibIndyInitializer libIndyInitializer; + private boolean openParallel; private IndyConnector indyConnector; public DidSovDriver(Map properties) { @@ -54,12 +55,14 @@ private static Map getPropertiesFromEnvironment() { try { String env_libIndyPath = System.getenv("uniresolver_driver_did_sov_libIndyPath"); + String env_openParallel = System.getenv("uniresolver_driver_did_sov_openParallel"); String env_poolConfigs = System.getenv("uniresolver_driver_did_sov_poolConfigs"); String env_poolVersions = System.getenv("uniresolver_driver_did_sov_poolVersions"); String env_walletNames = System.getenv("uniresolver_driver_did_sov_walletNames"); String env_submitterDidSeeds = System.getenv("uniresolver_driver_did_sov_submitterDidSeeds"); if (env_libIndyPath != null) properties.put("libIndyPath", env_libIndyPath); + if (env_openParallel != null) properties.put("openParallel", env_openParallel); if (env_poolConfigs != null) properties.put("poolConfigs", env_poolConfigs); if (env_poolVersions != null) properties.put("poolVersions", env_poolVersions); if (env_walletNames != null) properties.put("walletNames", env_walletNames); @@ -79,10 +82,13 @@ private void configureFromProperties() { try { String prop_libIndyPath = (String) this.getProperties().get("libIndyPath"); + String prop_openParallel = (String) this.getProperties().get("openParallel"); this.setLibIndyInitializer(new LibIndyInitializer( prop_libIndyPath)); + this.setOpenParallel(Boolean.parseBoolean(prop_openParallel)); + String prop_poolConfigs = (String) this.getProperties().get("poolConfigs"); String prop_poolVersions = (String) this.getProperties().get("poolVersions"); String prop_walletNames = (String) this.getProperties().get("walletNames"); @@ -114,7 +120,7 @@ public ResolveDataModelResult resolve(DID did, Map resolveOption if (! this.getIndyConnector().isOpened()) { try { - this.getIndyConnector().openIndyConnections(true, false); + this.getIndyConnector().openIndyConnections(true, false, this.getOpenParallel()); if (log.isInfoEnabled()) log.info("Successfully opened Indy connections."); } catch (IndyConnectionException ex) { throw new ResolutionException("Cannot open Indy connections: " + ex.getMessage(), ex); @@ -255,6 +261,14 @@ public void setLibIndyInitializer(LibIndyInitializer libIndyInitializer) { this.libIndyInitializer = libIndyInitializer; } + public boolean getOpenParallel() { + return openParallel; + } + + public void setOpenParallel(boolean openParallel) { + this.openParallel = openParallel; + } + public IndyConnector getIndyConnector() { return indyConnector; }