How to implement cache synchronization in a tomcat 6.0 cluster environment?

I am currently working on porting a web application to work in a cluster. This application uses caches. Some of these caches are reloaded if the user saves something. I would like to inform other nodes of the cluster about this so that all nodes update their caches.

It seems that the tomcat server has a group message assembly. (Tribes) I wonder if I can use this messaging for my task and how to start an event listener all day.

Regards Michael

+3
source share
3 answers

, . tomcat lib.

  Michae

0

Hazelcast Topic. /-. node . smth node, "REFRESH". node , . :

String REFRESH = "REFRESH";
ITopic<String> topic = Hazelcast.getTopic("myTopic");
topic.addMessageListener(new MessageListener<String>() {
        public void onMessage(String msg) {
          if(REFRESH.equals(msg){   
           //do refresh
          }
        }
    });

//, sth.
topic.publish(Refresh);

0

CACHE, B/W / . JGROUP.

ex: node , node (refresh)

0

Source: https://habr.com/ru/post/1760518/


All Articles