本文整理汇总了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);
}
}
}
示例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);
}
示例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");
}
示例6: verifyHazelcastInstance
import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
@Override
protected void verifyHazelcastInstance(HazelcastInstance hazelcastInstance) {
verify(hazelcastInstance).getCluster();
verify(cluster).addMembershipListener(any(MembershipListener.class));
}
示例7: addMemberListener
import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
@Override
public void addMemberListener(MembershipListener mebershipListener) {
HazelcastListenerManager.addMemberListener(mebershipListener);
}
示例8: addMembershipListener
import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
public void addMembershipListener(MembershipListener listener) {
listeners.add(listener);
}
示例9: removeMembershipListener
import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
public void removeMembershipListener(MembershipListener listener) {
listeners.remove(listener);
}
示例10: registerListener
import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
public void registerListener(MembershipListener listener) {
this.memberShipListeners.add(listener);
}
示例11: removeListener
import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
public void removeListener(MembershipListener listener) {
this.memberShipListeners.remove(listener);
}
示例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);
}
示例13: addMemberListener
import com.hazelcast.core.MembershipListener; //导入依赖的package包/类
public void addMemberListener(MembershipListener mebershipListener);