jayunit100
jayunit100

Reputation: 17648

Sharing a semaphore or other java object over a cluster using standard JDK libraries

Is there a native JDK solution for storing objects in memory, over a network? In particular, a way to share and synchronize a semaphore ?

Upvotes: 0

Views: 1229

Answers (3)

Ryan Stewart
Ryan Stewart

Reputation: 128849

It depends what exactly you mean by "native JDK solution". Netflix Curator, a rich client for ZooKeeper, is pure Java and has a cross-JVM Semaphore implementation which does exactly what it sounds like: providing shared leases across all participating JVMs. Curator is available in Maven Central if that makes a difference.

Upvotes: 1

8192K
8192K

Reputation: 5290

You should try Java RMI: http://docs.oracle.com/javase/tutorial/rmi/index.html

I think it should be able to provide synchronisation over the net. If you don't want to use a server like Zookeeper, this is the best solution I can think of.

Upvotes: 0

jdevelop
jdevelop

Reputation: 12296

I'd suggest to use ZooKeeper, it has excellent support for remote lock management.

Upvotes: 1

Related Questions