[
https://issues.jboss.org/browse/WFLY-11645?page=com.atlassian.jira.plugin...
]
Richard Achmatowicz edited comment on WFLY-11645 at 1/25/19 4:01 AM:
---------------------------------------------------------------------
What is a clustered bean?
On the one hand, this is a bean deployed on a node in a cluster. In the case of SFSBs, if
this bean has passivationEnabled=true, arrangements are made for making that beans state
available across the cluster to support fail-over (selecting a different target for the
invocation when a previous one failed). So, SFSBs are special in this respect.
On the other hand, from the point of view of the EJB client, a clustered bean is a proxy
which has affinity to a cluster. This can apply to proxies for SFSB as well as SLSBs. To
tie the proxy to the cluster, you need only (in theory) assign the strong affinity or the
weak affinity of the proxy as type ClusterAffinity, but in practice, we usually tie the
proxy to a cluster using the strong affinity. What this does is place a restriction on the
targets chosen for the invocation; in this case, the target must point to some node within
the cluster named in the affinity.
For a clustered SFSB proxy, where the strong affinity is used to specify affinity to the
cluster, if you wanted to send a invocations to a particular node in the cluster, you can
do it by setting the weak affinity of the proxy to a NodeAffinity for the node within the
cluster. For a clustered SLSB proxy, you should be able to do the same. Whether or not you
still can is another matter; i'm looking at writing a test to verify that these
"edge case" affinity combinations work properly.
It is true that on invocations for SFSB and SLSBs, strong affinity was being forced to the
"cluster affinity", which would result in the behavior that you observed, but
this was incorrect and a fix is in place to change it
(
https://issues.jboss.org/browse/WFLY-11489). However, the bean will still be tied to the
cluster as before, even after the fix.
One of the reasons why the affinity to the cluster is retained after invocation is that if
you remove affinity to the cluster (as in your example), from the EJB client point of
view, this bean is no longer a clustered bean and fail-over will not happen.
was (Author: rachmato):
What is a clustered bean? On the one hand, this is a bean deployed on a node in a cluster.
In the case of SFSBs, if this bean has passivationEnabled=true, arrangements are made for
making that beans state available across the cluster to support fail-over (selecting a
different target for the invocation when a previous one failed). So, SFSBs are special in
this respect. On the other hand, from the point of view of the EJB client, a clustered
bean is a proxy which has affinity to a cluster. This can apply to proxies for SFSB as
well as SLSBs. To tie the proxy to the cluster, you need only (in theory) assign the
strong affinity or the weak affinity of the proxy as type ClusterAffinity, but in
practice, we usually tie the proxy to a cluster using the strong affinity. What this does
is place a restriction on the targets chosen for the invocation; in this case, the target
must point to some node within the cluster named in the affinity.
For a clustered SFSB proxy, where the strong affinity is used to specify affinity to the
cluster, if you wanted to send a invocations to a particular node in the cluster, you can
do it by setting the weak affinity of the proxy to a NodeAffinity for the node within the
cluster. For a clustered SLSB proxy, you should be able to do the same. Whether or not you
still can is another matter; i'm looking at writing a test to verify that these
"egde case" affinity combinations work properly.
It is true that on invocations for SFSB and SLSBs, strong affinity was being forced to the
"cluster affinity", which would result in the behavior that you observed, but
this was incorrect and a fix is in place to change it
(
https://issues.jboss.org/browse/WFLY-11489)
A way to prevent automatic changes of affinity when invoking
clustered beans
----------------------------------------------------------------------------
Key: WFLY-11645
URL:
https://issues.jboss.org/browse/WFLY-11645
Project: WildFly
Issue Type: Feature Request
Components: Clustering, EJB
Reporter: Jan Martiska
Priority: Major
When invoking a clustered bean, a user might want to set an affinity so that the
invocations go to a particular node. This is done via EJB client APIs:
{noformat}
EJBClient.setStrongAffinity(beanProxy, new NodeAffinity("node1"));
{noformat}
however, if the bean is clustered, after each invocation, the affinity is automatically
reset to a ClusterAffinity. So the user would have to apply this again before each
invocation. There should be a way to tell EJB client to not do this.
--
This message was sent by Atlassian Jira
(v7.12.1#712002)