use of org.jgroups.protocols.CENTRAL_LOCK 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.protocols.CENTRAL_LOCK 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.protocols.CENTRAL_LOCK in project JGroups by belaban.
the class ClusterSplitLockTest method setUp.
protected void setUp(Class<? extends Locking> locking_class) throws Exception {
for (int i = 0; i < MEMBERS; i++) {
Locking lock_prot = locking_class.getDeclaredConstructor().newInstance().level("debug");
if (lock_prot instanceof CENTRAL_LOCK)
((CENTRAL_LOCK) lock_prot).setNumberOfBackups(2);
Protocol[] stack = Util.getTestStack(lock_prot);
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.
assertEquals(channels[0].getAddress(), channels[0].getView().getCoord());
}
Aggregations