use of org.jgroups.blocks.locking.LockService in project JGroups by belaban.
the class LockServiceTest method init.
@BeforeClass
protected void init() throws Exception {
c1 = createChannel("A");
s1 = new LockService(c1);
c1.connect("LockServiceTest");
c2 = createChannel("B");
s2 = new LockService(c2);
c2.connect("LockServiceTest");
c3 = createChannel("C");
s3 = new LockService(c3);
c3.connect("LockServiceTest");
Util.waitUntilAllChannelsHaveSameView(10000, 1000, c1, c2, c3);
lock = s1.getLock(LOCK);
}
use of org.jgroups.blocks.locking.LockService in project JGroups by belaban.
the class LockServiceConcurrencyTest method init.
@BeforeMethod
protected void init() throws Exception {
a = new JChannel(Util.getTestStack(new CENTRAL_LOCK())).name("A");
ls_a = new LockService(a);
a.connect("LockServiceConcurrencyTest");
b = new JChannel(Util.getTestStack(new CENTRAL_LOCK())).name("B");
ls_b = new LockService(b);
b.connect("LockServiceConcurrencyTest");
Util.waitUntilAllChannelsHaveSameView(10000, 1000, a, b);
}
use of org.jgroups.blocks.locking.LockService in project JGroups by belaban.
the class ClusterSplitLockTest method setUp.
@BeforeMethod
protected void setUp() throws Exception {
for (int i = 0; i < MEMBERS; i++) {
Protocol[] stack = Util.getTestStack(new CENTRAL_LOCK().level("debug").setValue("num_backups", 2));
channels[i] = new JChannel(stack);
lockServices[i] = new LockService(channels[i]);
channels[i].setName(memberName(i));
channels[i].connect("TEST");
execs[i] = Executors.newCachedThreadPool();
if (i == 0) {
Util.sleep(500);
}
}
Util.waitUntilAllChannelsHaveSameView(10000, 1000, channels);
// Make sure A is coordinator, because we blindly assume it is in the tests below.
assertTrue(channels[0].getView().getCoord().equals(channels[0].getAddress()));
}
use of org.jgroups.blocks.locking.LockService in project JGroups by belaban.
the class LockServiceDemo method start.
public void start() throws Exception {
ch = new JChannel(props);
if (name != null)
ch.setName(name);
lock_service = new LockService(ch);
lock_service.addLockListener(this);
ch.connect("lock-cluster");
JmxConfigurator.registerChannel(ch, Util.getMBeanServer(), "lock-service", ch.getClusterName(), true);
try {
loop();
} catch (Exception e) {
e.printStackTrace();
} finally {
Util.close(ch);
}
}
use of org.jgroups.blocks.locking.LockService in project JGroups by belaban.
the class LockServiceDemo method start.
public void start(JChannel ch) throws Exception {
this.ch = ch;
lock_service = new LockService(ch);
lock_service.addLockListener(this);
ch.connect("lock-cluster");
JmxConfigurator.registerChannel(ch, Util.getMBeanServer(), "lock-service", ch.getClusterName(), true);
try {
loop();
} catch (Exception e) {
e.printStackTrace();
} finally {
Util.close(ch);
}
}
Aggregations