private boolean needsNewSession() {
        if (sessionCredentials == null) return true;

        long timeRemaining = sessionCredentialsExpiration.getTime() - System.currentTimeMillis();
        return timeRemaining < (this.refreshThreshold * 1000);
    }
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.
aws-java-sdk-sts/src/main/java/com/amazonaws/auth/WebIdentityFederationSessionCredentialsProvider.java