@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getSegmentsCount() > 0) { hash = (37 * hash) + SEGMENTS_FIELD_NUMBER; hash = (53 * hash) + getSegmentsList().hashCode(); } hash = (37 * hash) + DELEGATIONTOKEN_FIELD_NUMBER; hash = (53 * hash) + getDelegationToken().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof io.pravega.controller.stream.api.grpc.v1.Controller.SuccessorResponse)) { return super.equals(obj); } io.pravega.controller.stream.api.grpc.v1.Controller.SuccessorResponse other = (io.pravega.controller.stream.api.grpc.v1.Controller.SuccessorResponse) obj; boolean result = true; result = result && getSegmentsList() .equals(other.getSegmentsList()); result = result && getDelegationToken() .equals(other.getDelegationToken()); result = result && unknownFields.equals(other.unknownFields); return result; }
@Override public CompletableFuture<StreamSegmentsWithPredecessors> getSuccessors(Segment segment) { Exceptions.checkNotClosed(closed.get(), this); long traceId = LoggerHelpers.traceEnter(log, "getSuccessors", segment); final CompletableFuture<SuccessorResponse> resultFuture = this.retryConfig.runAsync(() -> { RPCAsyncCallback<SuccessorResponse> callback = new RPCAsyncCallback<>(traceId, "getSuccessors"); client.getSegmentsImmediatlyFollowing(ModelHelper.decode(segment), callback); return callback.getFuture(); }, this.executor); return resultFuture.thenApply(successors -> { log.debug("Received the following data from the controller {}", successors.getSegmentsList()); Map<SegmentWithRange, List<Long>> result = new HashMap<>(); for (SuccessorResponse.SegmentEntry entry : successors.getSegmentsList()) { result.put(ModelHelper.encode(entry.getSegment()), entry.getValueList()); } return new StreamSegmentsWithPredecessors(result, successors.getDelegationToken()); }).whenComplete((x, e) -> { if (e != null) { log.warn("getSuccessors failed: ", e); } LoggerHelpers.traceLeave(log, "getSuccessors", traceId); }); }