Browse code

Chore: CircuitBreaker signature & type erasure did shit

Thomas Cataldo authored on 11/04/2019 20:15:28
Showing 3 changed files
... ...
@@ -202,7 +202,7 @@ public class ReplicationSession {
202 202
 		} else {
203 203
 			logger.info("REPL S: {}", forLog);
204 204
 		}
205
-		return circuitBreaker.apply(vertx, this, () -> write(res));
205
+		return circuitBreaker.applyPromised(vertx, this, () -> write(res));
206 206
 	}
207 207
 
208 208
 	private CompletableFuture<Void> write(String s) {
... ...
@@ -80,7 +80,7 @@ public final class ProtocolExecutor {
80 80
 				logger.debug("Got parsed request: {}", protocolQuery);
81 81
 			}
82 82
 
83
-			ProtocolCircuitBreaker.INSTANCE.apply(vertx, bs, () -> {
83
+			ProtocolCircuitBreaker.INSTANCE.applyCall(vertx, bs, () -> {
84 84
 				callProtocol(protocolQuery);
85 85
 				return null;
86 86
 			}).whenComplete((v, ex) -> {
... ...
@@ -56,7 +56,7 @@ public class CircuitBreaker<T> {
56 56
 		errorCounts.remove(partition.apply(errorSource));
57 57
 	}
58 58
 
59
-	public <R> CompletableFuture<R> apply(Vertx vertx, T partitionable, Callable<R> to) {
59
+	public <R> CompletableFuture<R> applyCall(Vertx vertx, T partitionable, Callable<R> to) {
60 60
 		CompletableFuture<R> future = new CompletableFuture<>();
61 61
 		String partKey = partition.apply(partitionable);
62 62
 		int count = errorCounts.count(partKey);
... ...
@@ -81,7 +81,7 @@ public class CircuitBreaker<T> {
81 81
 		return future;
82 82
 	}
83 83
 
84
-	public <R> CompletableFuture<R> apply(Vertx vertx, T partitionable, Supplier<CompletableFuture<R>> to) {
84
+	public <R> CompletableFuture<R> applyPromised(Vertx vertx, T partitionable, Supplier<CompletableFuture<R>> to) {
85 85
 		String partKey = partition.apply(partitionable);
86 86
 		int count = errorCounts.count(partKey);
87 87
 		if (count == 0) {