List of usage examples for com.amazonaws SDKGlobalConfiguration getGlobalTimeOffset
@Deprecated public static int getGlobalTimeOffset()
From source file:io.fineo.client.auth.CognitoCredentialsProvider.java
License:Open Source License
/** * Returns true if a new STS session needs to be started. A new STS session * is needed when no session has been started yet, or if the last session is * within the configured refresh threshold. * * @return True if a new STS session needs to be started. *///from www . j av a 2 s . c o m protected boolean needsNewSession() { if (sessionCredentials == null) { return true; } long currentTime = System.currentTimeMillis() - SDKGlobalConfiguration.getGlobalTimeOffset() * 1000; long timeRemaining = sessionCredentialsExpiration.getTime() - currentTime; return timeRemaining < (refreshThreshold * 1000); }