private String getTokenFromIMDSEndpoint(String tokenAudience) { MSIToken token = cache.get(tokenAudience); if (token != null && !token.isExpired()) { return token.accessToken(); } lock.lock(); try { token = cache.get(tokenAudience); if (token != null && !token.isExpired()) { return token.accessToken(); } try { token = retrieveTokenFromIDMSWithRetry(tokenAudience); if (token != null) { cache.put(tokenAudience, token); } } catch (IOException exception) { throw new RuntimeException(exception); } return token.accessToken(); } finally { lock.unlock(); } }
return msiToken.accessToken(); } catch (Exception e) { e.printStackTrace();
return msiToken.accessToken(); } catch (Exception e) { e.printStackTrace();