Skip to content

Commit

Permalink
Don't fail entire "sov" driver if one pool fails.
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Sabadello <[email protected]>
  • Loading branch information
peacekeeper committed May 21, 2019
1 parent 231b062 commit 541cef0
Showing 1 changed file with 23 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -363,28 +363,6 @@ private void openIndy() throws ResolutionException {
}
}

// open pools

this.poolMap = new HashMap<String, Pool> ();

for (String poolConfigName : poolConfigMap.keySet()) {

try {

Pool.setProtocolVersion(this.getPoolVersionMap().get(poolConfigName));

OpenPoolLedgerJSONParameter openPoolLedgerJSONParameter = new OpenPoolLedgerJSONParameter(null, null);
Pool pool = Pool.openPoolLedger(poolConfigName, openPoolLedgerJSONParameter.toJson()).get();

this.poolMap.put(poolConfigName, pool);
} catch (IndyException | InterruptedException | ExecutionException ex) {

throw new ResolutionException("Cannot open pool \"" + poolConfigName + "\": " + ex.getMessage(), ex);
}
}

if (log.isInfoEnabled()) log.info("Opened " + this.poolMap.size() + " pools: " + this.poolMap.keySet());

// open wallet

try {
Expand All @@ -410,6 +388,29 @@ private void openIndy() throws ResolutionException {
}

if (log.isInfoEnabled()) log.info("Created submitter DID: " + this.submitterDid);

// open pools

this.poolMap = new HashMap<String, Pool> ();

for (String poolConfigName : poolConfigMap.keySet()) {

try {

Pool.setProtocolVersion(this.getPoolVersionMap().get(poolConfigName));

OpenPoolLedgerJSONParameter openPoolLedgerJSONParameter = new OpenPoolLedgerJSONParameter(null, null);
Pool pool = Pool.openPoolLedger(poolConfigName, openPoolLedgerJSONParameter.toJson()).get();

this.poolMap.put(poolConfigName, pool);
} catch (IndyException | InterruptedException | ExecutionException ex) {

if (log.isWarnEnabled()) log.warn("Cannot open pool \"" + poolConfigName + "\": " + ex.getMessage(), ex);
continue;
}
}

if (log.isInfoEnabled()) log.info("Opened " + this.poolMap.size() + " pools: " + this.poolMap.keySet());
}

/*
Expand Down

0 comments on commit 541cef0

Please sign in to comment.