use of io.dingodb.store.row.cmd.pd.RegionHeartbeatRequest in project dingo by dingodb.
the class RegionHeartbeatSender method sendRegionHeartbeat.
private void sendRegionHeartbeat(final long lastTime) throws Exception {
final long now = System.currentTimeMillis();
final RegionHeartbeatRequest request = new RegionHeartbeatRequest();
request.setClusterId(this.regionEngine.getStoreEngine().getClusterId());
request.setLeastKeysOnSplit(this.regionEngine.getStoreEngine().getStoreOpts().getLeastKeysOnSplit());
request.setRegion(region);
request.setRegionStats(collectRegionStats(new TimeInterval(lastTime, now)));
request.setSelfEndpoint(selfEndpoint);
CompletableFuture<List<Instruction>> future = new CompletableFuture<>();
callAsyncWithRpc(future, request, 3, null);
future.whenCompleteAsync(this::processHeartbeatResponse);
future.thenRunAsync(() -> heartbeatTimer.newTimeout(new RegionHeartbeatTask(now), interval, TimeUnit.SECONDS));
}
Aggregations