use of com.alipay.sofa.jraft.rhea.cmd.pd.GetClusterInfoResponse in project sofa-jraft by sofastack.
the class DefaultPlacementDriverService method handleGetClusterInfoRequest.
@Override
public void handleGetClusterInfoRequest(final GetClusterInfoRequest request, final RequestProcessClosure<BaseRequest, BaseResponse> closure) {
final long clusterId = request.getClusterId();
final GetClusterInfoResponse response = new GetClusterInfoResponse();
response.setClusterId(clusterId);
if (!this.isLeader) {
response.setError(Errors.NOT_LEADER);
closure.sendResponse(response);
return;
}
try {
final Cluster cluster = this.metadataStore.getClusterInfo(clusterId);
response.setValue(cluster);
} catch (final Throwable t) {
LOG.error("Failed to handle: {}, {}.", request, StackTraceUtil.stackTrace(t));
response.setError(Errors.forException(t));
}
closure.sendResponse(response);
}
Aggregations