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


Java MembershipListener类代码示例

本文整理汇总了Java中com.hazelcast.core.MembershipListener的典型用法代码示例。如果您正苦于以下问题:Java MembershipListener类的具体用法?Java MembershipListener怎么用?Java MembershipListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MembershipListener类属于com.hazelcast.core包,在下文中一共展示了MembershipListener类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeListeners

import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
private void initializeListeners(Config config) {
    for (final ListenerConfig listenerCfg : config.getListenerConfigs()) {
        Object listener = listenerCfg.getImplementation();
        if (listener == null) {
            try {
                listener = Serializer.newInstance(Serializer.loadClass(listenerCfg.getClassName()));
            } catch (Exception e) {
                logger.log(Level.SEVERE, e.getMessage(), e);
            }
        }
        if (listener instanceof InstanceListener) {
            factory.addInstanceListener((InstanceListener) listener);
        } else if (listener instanceof MembershipListener) {
            clusterImpl.addMembershipListener((MembershipListener) listener);
        } else if (listener instanceof MigrationListener) {
            concurrentMapManager.partitionServiceImpl.addMigrationListener((MigrationListener) listener);
        } else if (listener != null) {
            final String error = "Unknown listener type: " + listener.getClass();
            Throwable t = new IllegalArgumentException(error);
            logger.log(Level.WARNING, error, t);
        }
    }
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:24,代码来源:Node.java

示例2: initializeListeners

import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
private void initializeListeners(Config config) {
    for (final ListenerConfig listenerCfg : config.getListenerConfigs()) {
        Object listener = listenerCfg.getImplementation();
        if (listener == null) {
            try {
                listener = Serializer.newInstance(Serializer.loadClass(listenerCfg.getClassName()));
            } catch (Exception e) {
                logger.log(Level.SEVERE, e.getMessage(), e);
            }
        }
        if (listener instanceof InstanceListener) {
            factory.addInstanceListener((InstanceListener) listener);
        } else if (listener instanceof MembershipListener) {
            clusterImpl.addMembershipListener((MembershipListener) listener);
        } else if (listener instanceof MigrationListener) {
            concurrentMapManager.partitionServiceImpl.addMigrationListener((MigrationListener) listener);
        } else if (listener instanceof LifecycleListener) {
            factory.lifecycleService.addLifecycleListener((LifecycleListener) listener);
        } else if (listener != null) {
            final String error = "Unknown listener type: " + listener.getClass();
            Throwable t = new IllegalArgumentException(error);
            logger.log(Level.WARNING, error, t);
        }
    }
}
 
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:26,代码来源:Node.java

示例3: addMemberListener

import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
public static void addMemberListener(MembershipListener membershipListener){//添加成员事件监听
	instance.getCluster().addMembershipListener(membershipListener);
}
 
开发者ID:DaiDongLiang,项目名称:DSC,代码行数:4,代码来源:HazelcastListenerManager.java

示例4: MembershipListenerManager

import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
public MembershipListenerManager(HazelcastClient client) {
    this.client = client;
    final ClientConfig clientConfig = client.getClientConfig();
    if (clientConfig != null) {
        for (Object listener : clientConfig.getListeners()) {
            if (listener instanceof MembershipListener) {
                registerListener((MembershipListener) listener);
            }
        }
    }
}
 
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:12,代码来源:MembershipListenerManager.java

示例5: trainHazelcastInstance

import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
@Override
protected void trainHazelcastInstance(HazelcastInstance hazelcastInstance) {
    when(hazelcastInstance.getCluster()).thenReturn(cluster);
    argument = ArgumentCaptor.forClass(MembershipListener.class);
    when(cluster.addMembershipListener(argument.capture())).thenReturn("foo");
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:HazelcastInstanceConsumerTest.java

示例6: verifyHazelcastInstance

import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
@Override
protected void verifyHazelcastInstance(HazelcastInstance hazelcastInstance) {
    verify(hazelcastInstance).getCluster();
    verify(cluster).addMembershipListener(any(MembershipListener.class));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:6,代码来源:HazelcastInstanceConsumerTest.java

示例7: addMemberListener

import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
@Override
public void addMemberListener(MembershipListener mebershipListener) {
	HazelcastListenerManager.addMemberListener(mebershipListener);	
}
 
开发者ID:DaiDongLiang,项目名称:DSC,代码行数:5,代码来源:HazelcastService.java

示例8: addMembershipListener

import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
public void addMembershipListener(MembershipListener listener) {
    listeners.add(listener);
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:4,代码来源:ClusterImpl.java

示例9: removeMembershipListener

import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
public void removeMembershipListener(MembershipListener listener) {
    listeners.remove(listener);
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:4,代码来源:ClusterImpl.java

示例10: registerListener

import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
public void registerListener(MembershipListener listener) {
    this.memberShipListeners.add(listener);
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:4,代码来源:MembershipListenerManager.java

示例11: removeListener

import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
public void removeListener(MembershipListener listener) {
    this.memberShipListeners.remove(listener);
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:4,代码来源:MembershipListenerManager.java

示例12: init

import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
/**
 * Initialize with a member event listener, and broadcast message listener			
 * @param clusterListener
 * @param msgListener
 */
public void init(final MembershipListener clusterListener){
		
	hazelcast.getCluster().addMembershipListener(clusterListener);
							
}
 
开发者ID:javanotes,项目名称:reactive-data,代码行数:11,代码来源:HazelcastInstanceProxy.java

示例13: addMemberListener

import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
public void addMemberListener(MembershipListener mebershipListener); 
开发者ID:DaiDongLiang,项目名称:DSC,代码行数:2,代码来源:IHazelcastService.java


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