Hello,
I'm trying to understand clustering in Wildfly. In current state I have two standalone instances with node name for example wildfly_1_test, wildfly_2_test.
It seems everything is fine. In logs there are rebalance informations by infinispans, artemis bridge etc on both instances.
Fore example part of logs:
2024-12-17T09:39:41.430763894Z 09:39:41,430 INFO [org.infinispan.LIFECYCLE] (non-blocking-thread-wildfly_1_test-p5-t26) [Context=demo.war/default] ISPN100010: Finished rebalance with members [wildfly_1_test, wildfly_2_test], topology id 8
09:39:41,772 INFO [org.apache.activemq.artemis.core.server] (Thread-2 (ActiveMQ-server-ActiveMQServerImpl::name=default)) AMQ221027: Bridge ClusterConnectionBridge@1088e8e2 [name=$.artemis.internal.sf.my-cluster.de0a7b3a-bc57-11ef-98c3-0242ac1c050b, queue=QueueImpl[name=$.artemis.internal.sf.my-cluster.de0a7b3a-bc57-11ef-98c3-0242ac1c050b, postOffice=PostOfficeImpl [server=ActiveMQServerImpl::name=default], temp=false]@3732521d targetConnector=ServerLocatorImpl (identity=(Cluster-connection-bridge::ClusterConnectionBridge@1088e8e2 [name=$.artemis.internal.sf.my-cluster.de0a7b3a-bc57-11ef-98c3-0242ac1c050b, queue=QueueImpl[name=$.artemis.internal.sf.my-cluster.de0a7b3a-bc57-11ef-98c3-0242ac1c050b, postOffice=PostOfficeImpl [server=ActiveMQServerImpl::name=default], temp=false]@3732521d targetConnector=ServerLocatorImpl [initialConnectors=[TransportConfiguration(name=http-connector, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory)?httpUpgradeEndpoint=http-acceptor&activemqServerName=default&httpUpgradeEnabled=true&port=8080&host=6c0a0afa6429], discoveryGroupConfiguration=null]]::ClusterConnectionImpl@468452930[nodeUUID=de31ffe8-bc57-11ef-a2c4-0242ac1c050a, connector=TransportConfiguration(name=http-connector, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory)?httpUpgradeEndpoint=http-acceptor&activemqServerName=default&httpUpgradeEnabled=true&port=8080&host=7065b04b37dc, address=jms, server=ActiveMQServerImpl::name=default])) [initialConnectors=[TransportConfiguration(name=http-connector, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory)?httpUpgradeEndpoint=http-acceptor&activemqServerName=default&httpUpgradeEnabled=true&port=8080&host=6c0a0afa6429], discoveryGroupConfiguration=null]] is connected
I created simple demo.war application with @Stateful EJB:
@Stateful
@LocalBean
public class Calculator {
private int number = 0;
public void add(int number) {
this.number += number;
}
public int getNumber() {
return number;
}
}
When I called method
add(5) from
wildfly_1_test node
then
number = 5 (for example from servlet)
.But when I called method add(5) froom wildfly_2_test node then number is again 5.
I thought there will be shared state but each node have own instance. How it is works? I found something like @Clustering annotation but it's old annotations.
Thank you for advice.