本文整理汇总了Java中com.hazelcast.core.MembershipEvent.MEMBER_ADDED属性的典型用法代码示例。如果您正苦于以下问题:Java MembershipEvent.MEMBER_ADDED属性的具体用法?Java MembershipEvent.MEMBER_ADDED怎么用?Java MembershipEvent.MEMBER_ADDED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.hazelcast.core.MembershipEvent
的用法示例。
在下文中一共展示了MembershipEvent.MEMBER_ADDED属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
@Override
public final void update(Observable arg0, Object arg1) {
if(arg1 instanceof MembershipEvent)
{
MembershipEvent me = (MembershipEvent) arg1;
switch(me.getEventType())
{
case MembershipEvent.MEMBER_ADDED:
handleMemberAdded(me.getMember());
break;
case MembershipEvent.MEMBER_REMOVED:
handleMemberRemoved(me.getMember());
break;
case MembershipEvent.MEMBER_ATTRIBUTE_CHANGED:
MemberAttributeEvent ma = (MemberAttributeEvent) arg1;
handleMemberModified(ma.getMember(), ma.getOperationType());
break;
default: break;
}
}
}
示例2: testAddInstance
@Test
public void testAddInstance() throws InterruptedException {
MockEndpoint added = getMockEndpoint("mock:added");
added.setExpectedMessageCount(1);
when(member.getSocketAddress()).thenReturn(new InetSocketAddress("foo.bar", 12345));
MembershipEvent event = new MembershipEvent(cluster, member, MembershipEvent.MEMBER_ADDED, null);
argument.getValue().memberAdded(event);
assertMockEndpointsSatisfied(5000, TimeUnit.MILLISECONDS);
// check headers
Exchange ex = added.getExchanges().get(0);
Map<String, Object> headers = ex.getIn().getHeaders();
this.checkHeaders(headers, HazelcastConstants.ADDED);
}