本文整理汇总了Java中org.jgroups.View.create方法的典型用法代码示例。如果您正苦于以下问题:Java View.create方法的具体用法?Java View.create怎么用?Java View.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jgroups.View
的用法示例。
在下文中一共展示了View.create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testNonConflictingMerge
import org.jgroups.View; //导入方法依赖的package包/类
public void testNonConflictingMerge() {
Address ip1=Util.createRandomAddress("x"), ip2=Util.createRandomAddress("y");
View tmp_view=View.create(a1,1,a1,a2,a3,ip1,ip2);
MutableDigest cons_d=new MutableDigest(tmp_view.getMembersRaw());
cons_d.set(ip1,10,10);
cons_d.set(ip2,20,20);
cons_d.merge(d);
Assert.assertEquals(cons_d.capacity(), 5);
Assert.assertEquals(cons_d.get(ip1)[0], 10);
Assert.assertEquals(cons_d.get(ip2)[0], 20);
Assert.assertEquals(cons_d.get(a1)[0], 500);
Assert.assertEquals(cons_d.get(a2)[0], 26);
Assert.assertEquals(cons_d.get(a3)[0], 25);
Assert.assertEquals(cons_d.get(ip1)[1], 10);
Assert.assertEquals(cons_d.get(ip2)[1], 20);
Assert.assertEquals(cons_d.get(a1)[1], 501);
Assert.assertEquals(cons_d.get(a2)[1], 26);
Assert.assertEquals(cons_d.get(a3)[1], 33);
}
示例2: becomeSingletonMember
import org.jgroups.View; //导入方法依赖的package包/类
void becomeSingletonMember(Address mbr) {
View new_view=View.create(mbr, 0, mbr); // create singleton view with mbr as only member
// set the initial digest (since I'm the first member)
Digest initial_digest=new Digest(mbr, 0, 0);
gms.installView(new_view, initial_digest);
gms.becomeCoordinator(); // not really necessary - installView() should do it
gms.getUpProtocol().up(new Event(Event.BECOME_SERVER));
gms.getDownProtocol().down(new Event(Event.BECOME_SERVER));
log.debug("%s: created cluster (first member). My view is %s, impl is %s",
gms.getLocalAddress(), gms.getViewId(), gms.getImpl().getClass().getName());
}
示例3: setUp
import org.jgroups.View; //导入方法依赖的package包/类
@BeforeClass
void setUp() throws Exception {
a=Util.createRandomAddress("A");
b=Util.createRandomAddress("B");
c=Util.createRandomAddress("C");
d=Util.createRandomAddress("D");
e=Util.createRandomAddress("E");
f=Util.createRandomAddress("F");
g=Util.createRandomAddress("G");
h=Util.createRandomAddress("H");
i=Util.createRandomAddress("I");
members=Arrays.asList(a, b, c, d, e, f, g, h);
view=View.create(a, 34, a, b, c, d, e, f, g, h);
}
示例4: makeView
import org.jgroups.View; //导入方法依赖的package包/类
private static View makeView(Address coord, Address ... members) {
return View.create(coord, 1, members);
}