예제 #1
0
 /**
  * Refreshes the rules from the underlying data provider.
  *
  * <p>This method is an extension point that allows providers to refresh their rules dynamically
  * at a time of the applications choosing. After calling this method, the offset stored in any
  * {@link ZonedDateTime} may be invalid for the zone ID.
  *
  * <p>Dynamic behavior is entirely optional and most providers, including the default provider, do
  * not support it.
  *
  * @return true if the rules were updated
  * @throws ZoneRulesException if an error occurs during the refresh
  */
 public static boolean refresh() {
   boolean changed = false;
   for (ZoneRulesProvider provider : PROVIDERS) {
     changed |= provider.provideRefresh();
   }
   return changed;
 }
예제 #2
0
 /**
  * Registers the provider.
  *
  * @param provider the provider to register, not null
  * @throws ZoneRulesException if unable to complete the registration
  */
 private static void registerProvider0(ZoneRulesProvider provider) {
   for (String zoneId : provider.provideZoneIds()) {
     Objects.requireNonNull(zoneId, "zoneId");
     ZoneRulesProvider old = ZONES.putIfAbsent(zoneId, provider.provideBind(zoneId));
     if (old != null) {
       throw new ZoneRulesException(
           "Unable to register zone as one already registered with that ID: "
               + zoneId
               + ", currently loading from provider: "
               + provider);
     }
   }
 }
예제 #3
0
 @Override
 protected NavigableMap<String, ZoneRules> provideVersions(String zoneId) {
   return provider.provideVersions(zoneId);
 }
예제 #4
0
 private BoundProvider(ZoneRulesProvider provider, String zoneId) {
   this.provider = provider;
   this.zoneId = zoneId;
   this.rules = provider.provideRules(zoneId);
 }