@Test public void getDurationInMillisTest() { assertThat(getDurationInMillis(() -> Duration.ofHours(1)), is(3_600_000L)); }
static Long getDurationInMillis(Supplier<Duration> durationSupplier) { if (durationSupplier == null) return null; Duration duration = durationSupplier.get(); if (duration == null) return null; return duration.toMillis(); }
SynchronizedGeneratorIdentity implements GeneratorIdentityHolder { static Long getDurationInMillis(Supplier<Duration> durationSupplier) { if (durationSupplier == null) return null; Duration duration = durationSupplier.get(); if (duration == null) return null; return duration.toMillis(); } }
SynchronizedGeneratorIdentity implements GeneratorIdentityHolder { static Long getDurationInMillis(Supplier<Duration> durationSupplier) { if (durationSupplier == null) return null; Duration duration = durationSupplier.get(); if (duration == null) return null; return duration.toMillis(); } SynchronizedGeneratorIdentity(MonitoringZookeeperConnection zooKeeperConnection,
                                         String zNode,
                                         int clusterId,
                                         Supplier<Duration> claimDurationSupplier,
                                         Supplier<Duration> acquisitionTimeoutSupplier); }
SynchronizedGeneratorIdentity implements GeneratorIdentityHolder { static Long getDurationInMillis(Supplier<Duration> durationSupplier) { if (durationSupplier == null) return null; Duration duration = durationSupplier.get(); if (duration == null) return null; return duration.toMillis(); } SynchronizedGeneratorIdentity(MonitoringZookeeperConnection zooKeeperConnection,
                                         String zNode,
                                         int clusterId,
                                         Supplier<Duration> claimDurationSupplier,
                                         Supplier<Duration> acquisitionTimeoutSupplier); static SynchronizedGeneratorIdentity basedOn(String quorum,
                                                        String znode,
                                                        Supplier<Duration> claimDurationSupplier,
                                                        Supplier<Duration> acquisitionTimeoutSupplier); static SynchronizedGeneratorIdentity basedOn(String quorum,
                                                        String znode,
                                                        Long claimDuration); @Override int getClusterId(); @Override int getGeneratorId(); String getZNode(); void relinquishGeneratorIdClaim(); @Override void close(); }
SynchronizedGeneratorIdentity implements GeneratorIdentityHolder { static Long getDurationInMillis(Supplier<Duration> durationSupplier) { if (durationSupplier == null) return null; Duration duration = durationSupplier.get(); if (duration == null) return null; return duration.toMillis(); } SynchronizedGeneratorIdentity(MonitoringZookeeperConnection zooKeeperConnection,
                                         String zNode,
                                         int clusterId,
                                         Supplier<Duration> claimDurationSupplier,
                                         Supplier<Duration> acquisitionTimeoutSupplier); static SynchronizedGeneratorIdentity basedOn(String quorum,
                                                        String znode,
                                                        Supplier<Duration> claimDurationSupplier,
                                                        Supplier<Duration> acquisitionTimeoutSupplier); static SynchronizedGeneratorIdentity basedOn(String quorum,
                                                        String znode,
                                                        Long claimDuration); @Override int getClusterId(); @Override int getGeneratorId(); String getZNode(); void relinquishGeneratorIdClaim(); @Override void close();  }