-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the LoadBalancer to the io.vertx.net.endpoint package
- Loading branch information
Showing
20 changed files
with
65 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
* | ||
* @author <a href="mailto:[email protected]">Julien Viet</a> | ||
*/ | ||
public interface Interaction { | ||
public interface EndpointInteraction { | ||
|
||
/** | ||
* Report a failure. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,11 @@ | |
|
||
import io.vertx.core.Future; | ||
import io.vertx.core.net.endpoint.EndpointNode; | ||
import io.vertx.core.net.endpoint.Interaction; | ||
import io.vertx.core.net.endpoint.EndpointInteraction; | ||
import io.vertx.core.impl.ContextInternal; | ||
import io.vertx.core.impl.VertxInternal; | ||
import io.vertx.core.net.endpoint.InteractionMetrics; | ||
import io.vertx.core.loadbalancing.LoadBalancer; | ||
import io.vertx.core.net.endpoint.LoadBalancer; | ||
import io.vertx.core.net.Address; | ||
import io.vertx.core.net.SocketAddress; | ||
import io.vertx.core.net.impl.endpoint.Endpoint; | ||
|
@@ -38,7 +38,7 @@ | |
* | ||
* @author <a href="mailto:[email protected]">Julien Viet</a> | ||
*/ | ||
public class EndpointResolverImpl<S, A extends Address, E> implements io.vertx.core.net.endpoint.EndpointResolver<A> { | ||
public class EndpointResolverImpl<S, A extends Address, E> implements EndpointResolverInternal<A> { | ||
|
||
private final VertxInternal vertx; | ||
private final LoadBalancer loadBalancer; | ||
|
@@ -104,11 +104,11 @@ private EndpointNode selectEndpoint(S state, String routingKey) { | |
} | ||
return null; | ||
} | ||
public EndpointNode selectNode(String routingKey) { | ||
public EndpointNode selectNode(String key) { | ||
if (!endpointResolver.isValid(state)) { | ||
throw new IllegalStateException("Cannot resolve address " + address ); | ||
} | ||
EndpointNode endpoint = selectEndpoint(state, routingKey); | ||
EndpointNode endpoint = selectEndpoint(state, key); | ||
if (endpoint == null) { | ||
throw new IllegalStateException("No results for " + address ); | ||
} | ||
|
@@ -245,11 +245,11 @@ public SocketAddress address() { | |
return endpointResolver.addressOf(endpoint); | ||
} | ||
@Override | ||
public Interaction initiateInteraction() { | ||
public EndpointInteraction newInteraction() { | ||
lastAccessed.set(System.currentTimeMillis()); | ||
InteractionMetrics metrics = this.metrics; | ||
Object metric = metrics.initiateRequest(); | ||
return new Interaction() { | ||
return new EndpointInteraction() { | ||
@Override | ||
public void reportRequestBegin() { | ||
metrics.reportRequestBegin(metric); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.