rls: remove redundant request field in CachedRouteLookupResponse

This commit is contained in:
ZHANG Dapeng 2020-10-28 17:24:23 -07:00 committed by GitHub
parent 654f7c3dc6
commit 5111eca71b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 8 deletions

View File

@ -329,8 +329,6 @@ final class CachingRlsLbClient {
* Viewer class for cached {@link RouteLookupResponse} and associated {@link ChildPolicyWrapper}. * Viewer class for cached {@link RouteLookupResponse} and associated {@link ChildPolicyWrapper}.
*/ */
static final class CachedRouteLookupResponse { static final class CachedRouteLookupResponse {
private final RouteLookupRequest request;
// Should only have 1 of following 3 cache entries // Should only have 1 of following 3 cache entries
@Nullable @Nullable
private final DataCacheEntry dataCacheEntry; private final DataCacheEntry dataCacheEntry;
@ -340,11 +338,9 @@ final class CachingRlsLbClient {
private final BackoffCacheEntry backoffCacheEntry; private final BackoffCacheEntry backoffCacheEntry;
CachedRouteLookupResponse( CachedRouteLookupResponse(
RouteLookupRequest request,
DataCacheEntry dataCacheEntry, DataCacheEntry dataCacheEntry,
PendingCacheEntry pendingCacheEntry, PendingCacheEntry pendingCacheEntry,
BackoffCacheEntry backoffCacheEntry) { BackoffCacheEntry backoffCacheEntry) {
this.request = checkNotNull(request, "request");
this.dataCacheEntry = dataCacheEntry; this.dataCacheEntry = dataCacheEntry;
this.pendingCacheEntry = pendingCacheEntry; this.pendingCacheEntry = pendingCacheEntry;
this.backoffCacheEntry = backoffCacheEntry; this.backoffCacheEntry = backoffCacheEntry;
@ -354,15 +350,15 @@ final class CachingRlsLbClient {
} }
static CachedRouteLookupResponse pendingResponse(PendingCacheEntry pendingEntry) { static CachedRouteLookupResponse pendingResponse(PendingCacheEntry pendingEntry) {
return new CachedRouteLookupResponse(pendingEntry.request, null, pendingEntry, null); return new CachedRouteLookupResponse(null, pendingEntry, null);
} }
static CachedRouteLookupResponse backoffEntry(BackoffCacheEntry backoffEntry) { static CachedRouteLookupResponse backoffEntry(BackoffCacheEntry backoffEntry) {
return new CachedRouteLookupResponse(backoffEntry.request, null, null, backoffEntry); return new CachedRouteLookupResponse(null, null, backoffEntry);
} }
static CachedRouteLookupResponse dataEntry(DataCacheEntry dataEntry) { static CachedRouteLookupResponse dataEntry(DataCacheEntry dataEntry) {
return new CachedRouteLookupResponse(dataEntry.request, dataEntry, null, null); return new CachedRouteLookupResponse(dataEntry, null, null);
} }
boolean hasData() { boolean hasData() {
@ -404,7 +400,6 @@ final class CachingRlsLbClient {
@Override @Override
public String toString() { public String toString() {
return MoreObjects.toStringHelper(this) return MoreObjects.toStringHelper(this)
.add("request", request)
.add("dataCacheEntry", dataCacheEntry) .add("dataCacheEntry", dataCacheEntry)
.add("pendingCacheEntry", pendingCacheEntry) .add("pendingCacheEntry", pendingCacheEntry)
.add("backoffCacheEntry", backoffCacheEntry) .add("backoffCacheEntry", backoffCacheEntry)