Skip to content

Commit b4be7d1

Browse files
loadbalancer-experimental: remove/hide unused public API (#3139)
Motivation: Reduce public API that is not currently used. Modifications: - Make `LoadBalancingPolicy.name()` visibility pkg-private; - Remove `RequestTracker.ErrorClass.isLocal()`;
1 parent 9924380 commit b4be7d1

File tree

5 files changed

+8
-18
lines changed

5 files changed

+8
-18
lines changed

servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/LoadBalancingPolicy.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public abstract class LoadBalancingPolicy<ResolvedAddress, C extends LoadBalance
3939
* The name of the load balancing policy.
4040
* @return the name of the load balancing policy
4141
*/
42-
public abstract String name();
42+
abstract String name();
4343

4444
@Override
4545
public abstract String toString();

servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/P2CLoadBalancingPolicy.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ HostSelector<ResolvedAddress, C> buildSelector(final List<Host<ResolvedAddress,
6161
}
6262

6363
@Override
64-
public String name() {
64+
String name() {
6565
return "P2C";
6666
}
6767

servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/RequestTracker.java

+4-14
Original file line numberDiff line numberDiff line change
@@ -67,31 +67,21 @@ enum ErrorClass {
6767
/**
6868
* Failures caused locally, these would be things that failed due to an exception locally.
6969
*/
70-
LOCAL_ORIGIN_REQUEST_FAILED(true),
70+
LOCAL_ORIGIN_REQUEST_FAILED,
7171

7272
/**
7373
* Failures related to locally enforced timeouts waiting for responses from the peer.
7474
*/
75-
EXT_ORIGIN_TIMEOUT(false),
75+
EXT_ORIGIN_TIMEOUT,
7676

7777
/**
7878
* Failures returned from the remote peer. This will be things like 5xx responses.
7979
*/
80-
EXT_ORIGIN_REQUEST_FAILED(false),
80+
EXT_ORIGIN_REQUEST_FAILED,
8181

8282
/**
8383
* Failure due to cancellation.
8484
*/
85-
CANCELLED(true);
86-
87-
private final boolean isLocal;
88-
89-
ErrorClass(boolean isLocal) {
90-
this.isLocal = isLocal;
91-
}
92-
93-
public boolean isLocal() {
94-
return isLocal;
95-
}
85+
CANCELLED
9686
}
9787
}

servicetalk-loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancingPolicy.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ HostSelector<ResolvedAddress, C> buildSelector(final List<Host<ResolvedAddress,
4747
}
4848

4949
@Override
50-
public String name() {
50+
String name() {
5151
return "RoundRobin";
5252
}
5353

servicetalk-loadbalancer-experimental/src/test/java/io/servicetalk/loadbalancer/DefaultLoadBalancerTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ private static class TestLoadBalancerPolicy extends LoadBalancingPolicy<String,
442442
int rebuilds;
443443

444444
@Override
445-
public String name() {
445+
String name() {
446446
return "TestPolicy";
447447
}
448448

0 commit comments

Comments
 (0)