当前位置: 首页>>代码示例>>Java>>正文


Java MembershipEvent.MEMBER_ADDED属性代码示例

本文整理汇总了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;
    }
  }
  
}
 
开发者ID:javanotes,项目名称:reactive-data,代码行数:24,代码来源:AbstractMembershipEventObserver.java

示例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);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:HazelcastInstanceConsumerTest.java


注:本文中的com.hazelcast.core.MembershipEvent.MEMBER_ADDED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。