@Test public void testEtcdLeaseIsAvailable() throws ExecutionException, InterruptedException { Client client = Client.builder() .endpoints(container.clientEndpoint()) .build(); HeartbeatProperties heartbeatProperties = new HeartbeatProperties(); heartbeatProperties.setInterval(5); EtcdHeartbeatLease heartbeatLease = new EtcdHeartbeatLease(client, heartbeatProperties); Long leaseId = heartbeatLease.getLeaseId(); assertNotNull(leaseId); LeaseTimeToLiveResponse leaseTimeToLiveResponse = client.getLeaseClient().timeToLive(leaseId, LeaseOption.DEFAULT).get(); Thread.sleep(10); assertEquals(leaseTimeToLiveResponse.getGrantedTTL(), heartbeatProperties.getInterval()); assertTrue(leaseTimeToLiveResponse.getTTl() > 0); assertTrue(leaseTimeToLiveResponse.getTTl() < heartbeatProperties.getInterval()); }
public Long getLeaseId() { initLease(); return leaseId; }
EtcdHeartbeatLease implements AutoCloseable { public Long getLeaseId() { initLease(); return leaseId; } }
EtcdHeartbeatLease implements AutoCloseable { public Long getLeaseId() { initLease(); return leaseId; } EtcdHeartbeatLease(Client etcdClient, HeartbeatProperties properties); }
EtcdHeartbeatLease implements AutoCloseable { public Long getLeaseId() { initLease(); return leaseId; } EtcdHeartbeatLease(Client etcdClient, HeartbeatProperties properties); void initLease(); Long getLeaseId(); void revoke(); @Override void close(); }
EtcdHeartbeatLease implements AutoCloseable { public Long getLeaseId() { initLease(); return leaseId; } EtcdHeartbeatLease(Client etcdClient, HeartbeatProperties properties); void initLease(); Long getLeaseId(); void revoke(); @Override void close();  }