| 958 | } |
| 959 | |
| 960 | @VisibleForTesting |
| 961 | static final class DropEntry { |
| 962 | private final GrpclbClientLoadRecorder loadRecorder; |
| 963 | private final String token; |
| 964 | |
| 965 | DropEntry(GrpclbClientLoadRecorder loadRecorder, String token) { |
| 966 | this.loadRecorder = checkNotNull(loadRecorder, "loadRecorder"); |
| 967 | this.token = checkNotNull(token, "token"); |
| 968 | } |
| 969 | |
| 970 | PickResult picked() { |
| 971 | loadRecorder.recordDroppedRequest(token); |
| 972 | return DROP_PICK_RESULT; |
| 973 | } |
| 974 | |
| 975 | @Override |
| 976 | public String toString() { |
| 977 | // This is printed in logs. Only include useful information. |
| 978 | return "drop(" + token + ")"; |
| 979 | } |
| 980 | |
| 981 | @Override |
| 982 | public int hashCode() { |
| 983 | return Objects.hashCode(loadRecorder, token); |
| 984 | } |
| 985 | |
| 986 | @Override |
| 987 | public boolean equals(Object other) { |
| 988 | if (!(other instanceof DropEntry)) { |
| 989 | return false; |
| 990 | } |
| 991 | DropEntry that = (DropEntry) other; |
| 992 | return Objects.equal(loadRecorder, that.loadRecorder) && Objects.equal(token, that.token); |
| 993 | } |
| 994 | } |
| 995 | |
| 996 | @VisibleForTesting |
| 997 | interface RoundRobinEntry { |
nothing calls this directly
no outgoing calls
no test coverage detected