use of io.dingodb.store.row.cmd.pd.StoreHeartbeatRequest in project dingo by dingodb.
the class StoreHeartbeatSender method sendStoreHeartbeat.
private void sendStoreHeartbeat(final long nextDelay, final boolean forceRefreshLeader, final long lastTime) {
final long now = System.currentTimeMillis();
final StoreHeartbeatRequest request = new StoreHeartbeatRequest();
request.setClusterId(this.storeEngine.getClusterId());
final TimeInterval timeInterval = new TimeInterval(lastTime, now);
final StoreStats stats = this.statsCollector.collectStoreStats(timeInterval);
request.setStats(stats);
final HeartbeatClosure<Object> closure = new HeartbeatClosure<Object>() {
@Override
public void run(final Status status) {
final boolean forceRefresh = !status.isOk() && ErrorsHelper.isInvalidPeer(getError());
final StoreHeartbeatTask nexTask = new StoreHeartbeatTask(nextDelay, now, forceRefresh);
heartbeatTimer.newTimeout(nexTask, nexTask.getNextDelay(), TimeUnit.SECONDS);
}
};
final Endpoint endpoint = this.pdClient.getPdLeader(forceRefreshLeader, this.heartbeatRpcTimeoutMillis);
callAsyncWithRpc(endpoint, request, closure);
}
use of io.dingodb.store.row.cmd.pd.StoreHeartbeatRequest in project dingo by dingodb.
the class StoreHeartbeatSender method sendStoreHeartbeat.
private void sendStoreHeartbeat(final long nextDelay, final boolean forceRefreshLeader, final long lastTime) {
final long now = System.currentTimeMillis();
final StoreHeartbeatRequest request = new StoreHeartbeatRequest();
request.setClusterId(this.storeEngine.getClusterId());
final TimeInterval timeInterval = new TimeInterval(lastTime, now);
final StoreStats stats = this.statsCollector.collectStoreStats(timeInterval);
stats.setLocation(CURRENT_LOCATION);
request.setStats(stats);
final HeartbeatClosure<Object> closure = new HeartbeatClosure<Object>() {
@Override
public void run(final Status status) {
final boolean forceRefresh = !status.isOk() && ErrorsHelper.isInvalidPeer(getError());
final StoreHeartbeatTask nexTask = new StoreHeartbeatTask(nextDelay, now, forceRefresh);
heartbeatTimer.newTimeout(nexTask, nexTask.getNextDelay(), TimeUnit.SECONDS);
}
};
final Endpoint endpoint = this.pdClient.getPdLeader(forceRefreshLeader, this.heartbeatRpcTimeoutMillis);
callAsyncWithRpc(endpoint, request, closure);
}
Aggregations