public static GregorianCalendar get()

in src/main/java/com/aliyun/odps/jdbc/utils/CalendarCache.java [14:41]


  public static GregorianCalendar get(TimeZone timezone, String tzId, String calId) {
    CalendarCacheState state = localState.get();
    if (state.enabled) {
      GregorianCalendar res = state.map.get(calId);
      if (res == null) {
        res = createCalendar(timezone, tzId);
        state.map.put(calId, res);
      } else {
        if (timezone != null && !res.getTimeZone().hasSameRules(timezone)) {
          throw new IllegalArgumentException("Cached timezone is not equivalent to the requested one:" + timezone + "  VS  " + res.getTimeZone());
        }

        if (state.alwaysGregorian && res.getGregorianChange().getTime() != Long.MIN_VALUE) {
          throw new IllegalArgumentException("Cached calendar gregorian offset is not set as expected:" + res.getGregorianChange().getTime() + "  VS  " + Long.MIN_VALUE);
        }
      }

      if (state.produceClones) {
        res = (GregorianCalendar)res.clone();
      } else {
        res.clear();
      }

      return res;
    } else {
      return createCalendar(timezone, tzId);
    }
  }