code: private static long getNextRefresh(long tokenValiditySec) {
  		long interval = Config.JWT_REFRESH_INTERVAL_SEC;
  		// estimate when the next token refresh should be
  		// usually every hour, or halfway until the time it expires
  		if (tokenValiditySec < (2 * interval)) {
  			interval = (tokenValiditySec / 2);
  		}
  		return System.currentTimeMillis() + (interval * 1000);
  	}
docs: Decides when the next token refresh should be.
  @param tokenValiditySec token validity period
  @return a refresh timestamp to be used by API clients