use of com.emc.storageos.security.exceptions.RetryableSecurityException in project coprhd-controller by CoprHD.
the class KeyStoreUtil method getViPRKeystore.
public static synchronized KeyStore getViPRKeystore(CoordinatorClient coordinator) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, InterruptedException {
// make keystore singleton.
if (keyStoreInst != null) {
return keyStoreInst;
}
DistributedLoadKeyStoreParam loadStoreParam = new DistributedLoadKeyStoreParam();
loadStoreParam.setCoordinator(coordinator);
KeyStore viprKeyStore = KeyStore.getInstance(SecurityProvider.KEYSTORE_TYPE, new SecurityProvider());
boolean continueLoading = true;
int numberOfTries = 0;
while (continueLoading && numberOfTries < MAX_NUMBER_OF_RETRIES) {
try {
viprKeyStore.load(loadStoreParam);
continueLoading = false;
} catch (RetryableSecurityException e) {
numberOfTries++;
log.info("Could not load keystore, waiting " + TIME_TO_WAIT_IN_MILLIS + " ms. Attempt #" + numberOfTries, e);
Thread.sleep(TIME_TO_WAIT_IN_MILLIS);
}
}
keyStoreInst = viprKeyStore;
return viprKeyStore;
}
Aggregations