code: private static boolean expiring(Date expiry) {
          long timeRemaining = expiry.getTime() - System.currentTimeMillis();
          return timeRemaining < EXPIRY_TIME_MILLIS;
      }
docs: Session credentials that expire in less than a minute are considered expiring.
  
  @param expiry expiration time of a session