Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distributed synchronized execution

I'm trying to accomplish something that in terms of concept is very simple to understand. I want to synchronize a block of java code between different machines. There are two instances of a programa running in different machines that cannot run at the same time.

I've heard of zookeeper, jgroups and akka too, but while reading the documentation it seemed to me a bit overkill for what I'm trying to do. Does anyone have any idea if there's anything more straight forward to use?

Thanks in advance,

Rui

like image 309
rpvilao Avatar asked Mar 22 '26 10:03

rpvilao


2 Answers

I think Hazelcast's Distributed Lock ( http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#lock ) may be helpful. Hazelcast is relatively lightweight so should hopefully not be overkill.

like image 52
Paul Cager Avatar answered Mar 24 '26 23:03

Paul Cager


If all the technologies you mentioned (also take a look at Terracotta) are too sophisticated for your needs, maybe simple database locking?

SELECT FOR UPDATE statement will lock given database record, making other clients running this query to block. Simple, yet safe and reliable.

like image 20
Tomasz Nurkiewicz Avatar answered Mar 25 '26 00:03

Tomasz Nurkiewicz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!