Java Reference
In-Depth Information
Note
In our sample, we are using the
seats.values()
call to get all the elements from our
distributed map, which is in fact an instance of
org.infinispan.Cache
. This opera-
tion is normally discouraged in distributed caches (not replicated) and has its own limita-
tions. Check out the Javadoc for this method at
https://docs.jboss.org/infinispan/6.0/
apidocs/org/infinispan/Cache.html#values()
for more information. This is however, no
longer the case for the newest version of Infinispan:
http://infinispan.org/infinispan-7.0/
.
Coding the cluster-aware remote client
The remote EJB client will not need any particular change in order to be able to achieve
high availability.
We will only need to prepare a
jboss-ejb-client.properties
file, which will
contain the list of servers that will be initially contacted (via remoting) by our client ap-
plication:
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=node1,node2
remote.connection.node1.host=localhost
remote.connection.node1.port = 8080
remote.connection.node1.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.node2.host=localhost
remote.connection.node2.port = 8280
remote.connection.node2.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
As you can see from this file, we assume that you are running a two-node cluster on the
localhost
address: the first one running the default port settings and the second one
using an offset of
200
(just as shown in the second paragraph of the
Starting a cluster of
standalone nodes
section).
Replace the
remote.connection.nodeX.host
variable's value with the actual IP
or host if you are running your server nodes on different machines from your client.