@Override
  public Credential getCredential(String alias) throws AmbariException {
    Credential credential = null;

    if ((alias != null) && !alias.isEmpty()) {
      Lock lock = getLock();
      lock.lock();
      try {
        KeyStore keyStore = cache.getIfPresent(alias);
        if (keyStore != null) {
          credential = getCredential(keyStore, alias);
        }
      } finally {
        lock.unlock();
      }
    }

    return credential;
  }
Retrieves the specified credential from this CredentialStore
<p/>
This implementation is thread-safe, allowing one thread at a time to access the credential store.

@param alias a string declaring the alias (or name) of the credential
@return a Credential or null of not found
@throws AmbariException if an error occurs while retrieving the new credential
ambari-server/src/main/java/org/apache/ambari/server/security/encryption/InMemoryCredentialStore.java