in elastic-db-tools/src/main/java/com/microsoft/azure/elasticdb/shard/storeops/base/StoreOperationGlobal.java [89:151]
public final StoreResults doGlobal() {
StoreResults result;
try {
do {
result = retryPolicy.executeAction(() -> {
StoreResults r;
try {
// Open connection.
this.establishConnnection();
try (IStoreTransactionScope ts = this.getTransactionScope()) {
r = this.doGlobalExecute(ts);
ts.setSuccess(r.getResult() == StoreResult.Success);
}
catch (IOException e) {
e.printStackTrace();
throw new StoreException(e.getMessage(), e.getCause() != null ? (Exception) e.getCause() : e);
}
if (r.getStoreOperations().isEmpty()) {
if (r.getResult() != StoreResult.Success) {
this.doGlobalUpdateCachePre(r);
this.handleDoGlobalExecuteError(r);
}
this.doGlobalUpdateCachePost(r);
}
return r;
}
finally {
// close connection.
this.teardownConnection();
}
});
// If pending operation, deserialize the pending operation and perform Undo.
if (!result.getStoreOperations().isEmpty()) {
assert result.getStoreOperations().size() == 1;
try {
this.undoPendingStoreOperations(result.getStoreOperations().get(0));
}
catch (Exception e) {
e.printStackTrace();
throw new StoreException(e.getMessage(), e.getCause() != null ? (Exception) e.getCause() : e);
}
}
}
while (!result.getStoreOperations().isEmpty());
}
catch (StoreException se) {
throw this.onStoreException(se);
}
catch (Exception e) {
throw new StoreException(e.getMessage(), e);
}
return result;
}