Skip to content

Commit

Permalink
[EJBCLIENT-132] Correct processing of ClientContext.getEJBReceiver(EJ…
Browse files Browse the repository at this point in the history
…BClientInvocationContext context, Set<Strng> excludedNodes) when nodes are excluded.
  • Loading branch information
rachmatowicz committed Mar 3, 2015
1 parent 4252fbd commit 61bd629
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -33,7 +33,7 @@

<groupId>org.jboss</groupId>
<artifactId>jboss-ejb-client</artifactId>
<version>1.0.28.Final-SNAPSHOT</version>
<version>1.0.29.Final-SNAPSHOT</version>

This comment has been minimized.

Copy link
@wolfc

wolfc Mar 20, 2015

Contributor

What's going on here?

This comment has been minimized.

Copy link
@dmlloyd

dmlloyd Mar 20, 2015

Member

Nothing, the commit is just based on a 1.0.28-aged commit ID (see the parent). This diff vanishes with the merge because it was merged during 1.0.29.


<name>JBoss EJB client</name>
<description>Client library for EJB applications working against JBoss AS</description>
Expand Down
20 changes: 14 additions & 6 deletions src/main/java/org/jboss/ejb/client/ClusterContext.java
Expand Up @@ -109,14 +109,18 @@ private EJBReceiverContext getEJBReceiverContext(final EJBClientInvocationContex
if (nodeManagers.isEmpty()) {
return null;
}
final Set<String> availableNodes = this.nodeManagers.keySet();
// BZ1192471: don't modify the original sets on invocation (these are updated only by server topology and module availability updates)
final Set<String> availableNodes = new HashSet<String>(this.nodeManagers.keySet());

// remove the excluded nodes
availableNodes.removeAll(excludedNodes);
if (availableNodes.isEmpty()) {
logger.debug("No nodes available in cluster " + this.clusterName + " for selecting a receiver context");
return null;
}
final Set<String> alreadyConnectedNodes = this.connectedNodes;
// BZ1192471: don't modify the original sets on invocation (these are updated only by server topology and module availability updates)
final Set<String> alreadyConnectedNodes = new HashSet<String>(this.connectedNodes);

// remove the excluded nodes
alreadyConnectedNodes.removeAll(excludedNodes);

Expand All @@ -129,8 +133,7 @@ private EJBReceiverContext getEJBReceiverContext(final EJBClientInvocationContex
return null;
}
logger.debug(this.clusterNodeSelector + " has selected node " + selectedNodeName + ", in cluster " + this.clusterName);
// add this selected node name to excluded set, so that we don't try fetching a receiver for it
// again
// add this selected node name to excluded set, so that we don't try fetching a receiver for it again
excludedNodes.add(selectedNodeName);

final ClusterNodeManager clusterNodeManager = this.nodeManagers.get(selectedNodeName);
Expand All @@ -142,7 +145,10 @@ private EJBReceiverContext getEJBReceiverContext(final EJBClientInvocationContex
// this means that the node was valid when the selection was happening, but was probably
// removed from the cluster before we could fetch a node manager for it
// let's try a different node, this current one will be excluded
final Set<String> nodesInThisCluster = this.nodeManagers.keySet();

// BZ1192471: don't modify the original sets on invocation (these are updated only by server topology and module availability updates)
final Set<String> nodesInThisCluster = new HashSet<String>(this.nodeManagers.keySet());

// if all nodes have been excluded/tried, just return null indicating no receiver is available
if (excludedNodes.containsAll(nodesInThisCluster)) {
logger.debug("All nodes have been tried for a receiver, in cluster " + clusterName + ". No suitable receiver found");
Expand Down Expand Up @@ -188,7 +194,9 @@ private EJBReceiverContext getEJBReceiverContext(final EJBClientInvocationContex
}
// try some other node (if any) in this cluster. The currently selected node is
// excluded from this next attempt
final Set<String> nodesInThisCluster = this.nodeManagers.keySet();
// BZ1192471: don't modify the original sets on invocation (these are updated only by server topology and module availability updates)
final Set<String> nodesInThisCluster = new HashSet<String>(this.nodeManagers.keySet());

// if all nodes have been excluded/tried, just return null indicating no receiver is available
if (excludedNodes.containsAll(nodesInThisCluster)) {
logger.debug("All nodes have been tried for a receiver, in cluster " + clusterName + ". No suitable receiver found");
Expand Down

0 comments on commit 61bd629

Please sign in to comment.