Skip to content

Commit

Permalink
Revert "EJBCLIENT-356 use eagerNodes mechanism for faster discovery r…
Browse files Browse the repository at this point in the history
…esult only when org.jboss.ejb.client.discovery.additional-node-timeout sysprop is set (wildfly#481)"

This reverts commit 8ef14f3
  • Loading branch information
rachmatowicz committed Jan 13, 2021
1 parent 0d2ae0a commit b27f756
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,6 @@ public SessionID handleSessionCreation(final EJBSessionCreationInvocationContext
return sessionID;
}

/**
* Gets the value (in milliseconds) of discovery additional timeout,
* configured with system property {@code org.jboss.ejb.client.discovery.additional-node-timeout}.
*
* @return the value (in milliseconds) of discovery additional timeout
*/
public static long getDiscoveryAdditionalTimeout() {
return DISCOVERY_ADDITIONAL_TIMEOUT;
}

/**
* Intended to be called by interceptors which assign a new destination
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import javax.net.ssl.SSLContext;

import org.jboss.ejb._private.Logs;
import org.jboss.ejb.client.DiscoveryEJBClientInterceptor;
import org.jboss.ejb.client.EJBClientConnection;
import org.jboss.ejb.client.EJBClientContext;
import org.jboss.ejb.client.EJBModuleIdentifier;
Expand Down Expand Up @@ -375,7 +374,7 @@ final class DiscoveryAttempt implements DiscoveryRequest, DiscoveryResult {
/**
* nodes that have already been provided to the discovery provider eagerly
*/
private final Set<String> eagerNodes;
private final Set<String> eagerNodes = Collections.synchronizedSet(new HashSet<>());

DiscoveryAttempt(final ServiceType serviceType, final FilterSpec filterSpec, final DiscoveryResult discoveryResult, final RemoteEJBReceiver ejbReceiver, final AuthenticationContext authenticationContext) {
this.serviceType = serviceType;
Expand Down Expand Up @@ -422,8 +421,6 @@ public void handleDone(final EJBClientChannel clientChannel, final URI destinati
countDown();
}
};

eagerNodes = DiscoveryEJBClientInterceptor.getDiscoveryAdditionalTimeout() == 0 ? null : Collections.synchronizedSet(new HashSet<>());
}

void connectAndDiscover(URI uri, String clusterEffective) {
Expand Down Expand Up @@ -473,12 +470,12 @@ void countDown() {
final EJBModuleIdentifier module = filterSpec.accept(MI_EXTRACTOR);
if (phase2) {
if (node != null) {
if (eagerNodes == null || !eagerNodes.contains(node)) {
if (!eagerNodes.contains(node)) {
final NodeInformation information = nodes.get(node);
if (information != null) information.discover(serviceType, filterSpec, result);
}
} else for (NodeInformation information : nodes.values()) {
if (eagerNodes == null || !eagerNodes.contains(information.getNodeName())) {
if (!eagerNodes.contains(information.getNodeName())) {
information.discover(serviceType, filterSpec, result);
}
}
Expand All @@ -487,7 +484,7 @@ void countDown() {
boolean ok = false;
// optimize for simple module identifier and node name queries
if (node != null) {
if (eagerNodes == null || !eagerNodes.contains(node)) {
if (!eagerNodes.contains(node)) {
final NodeInformation information = nodes.get(node);
if (information != null) {
if (information.discover(serviceType, filterSpec, result)) {
Expand All @@ -496,13 +493,13 @@ void countDown() {
}
}
} else for (NodeInformation information : nodes.values()) {
if (eagerNodes == null || !eagerNodes.contains(information.getNodeName())) {
if (!eagerNodes.contains(information.getNodeName())) {
if (information.discover(serviceType, filterSpec, result)) {
ok = true;
}
}
}
if (ok || (eagerNodes != null && !eagerNodes.isEmpty())) {
if (ok || !eagerNodes.isEmpty()) {
result.complete();
} else {
// everything failed. We have to reconnect everything.
Expand Down Expand Up @@ -559,7 +556,7 @@ void countDown() {
countDown();
}
}
} else if (eagerNodes != null) {
} else {
final DiscoveryResult result = this.discoveryResult;
final String node = filterSpec.accept(NODE_EXTRACTOR);
if (node != null) {
Expand Down

0 comments on commit b27f756

Please sign in to comment.