本文整理汇总了Java中com.hazelcast.core.LifecycleEvent类的典型用法代码示例。如果您正苦于以下问题:Java LifecycleEvent类的具体用法?Java LifecycleEvent怎么用?Java LifecycleEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LifecycleEvent类属于com.hazelcast.core包,在下文中一共展示了LifecycleEvent类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stateChanged
import com.hazelcast.core.LifecycleEvent; //导入依赖的package包/类
@Override
public void stateChanged(LifecycleEvent event) {
logger.info("stateChanged; event: {}", event);
if (LifecycleState.STARTED == event.getState()) {
xtxCache = nodeEngine.getHazelcastInstance().getMap(CN_XDM_TRANSACTION);
xddCache = nodeEngine.getHazelcastInstance().getMap(CN_XDM_DOCUMENT);
keyCache = nodeEngine.getHazelcastInstance().getMap(CN_XDM_KEY);
//readCatalog(catalog);
// too early
//checkPopulation(nodeEngine.getClusterService().getSize());
} else if (LifecycleState.SHUTTING_DOWN == event.getState()) {
xtxCache.flush();
xddCache.flush();
logger.info("stateChanged; Maps were flushed");
}
}
示例2: stateChanged
import com.hazelcast.core.LifecycleEvent; //导入依赖的package包/类
@Override
public void stateChanged(LifecycleEvent event) {
switch (event.getState()) {
case CLIENT_CONNECTION_OPENED:
logger.info("Connected to DVE cluster.");
break;
case CLIENT_CONNECTION_LOST:
logger.info("Disconnected from DVE cluster.");
break;
case SHUTDOWN:
cleanup();
if (autoReconnect) {
reconnect();
}
break;
default:
// logger.debug(event);
}
}
示例3: stateChanged
import com.hazelcast.core.LifecycleEvent; //导入依赖的package包/类
public void stateChanged(LifecycleEvent event) {
if (event.getState().equals(LifecycleState.SHUTDOWN)) {
leaveCluster();
} else if (event.getState().equals(LifecycleState.STARTED)) {
joinCluster();
}
}
示例4: fireLifecycleEvent
import com.hazelcast.core.LifecycleEvent; //导入依赖的package包/类
public void fireLifecycleEvent(final LifecycleState lifecycleState) {
callAsync(new Callable<Object>() {
public Object call() throws Exception {
fireLifecycleEvent(new LifecycleEvent(lifecycleState));
return null;
}
});
}
示例5: stateChanged
import com.hazelcast.core.LifecycleEvent; //导入依赖的package包/类
/**
* On {@link com.hazelcast.core.LifecycleEvent.LifecycleState} MERGED event all the topic listeners for the local node is added back. Since the data structures except for
* IMaps are not merged after a split brain scenario within Hazelcast (data structures from MERGED nodes are
* discarded)
* @param lifecycleEvent {@link LifecycleEvent}
*/
@Override
public void stateChanged(LifecycleEvent lifecycleEvent) {
try {
log.info("Hazelcast instance lifecycle changed state to " + lifecycleEvent.getState());
if (lifecycleEvent.getState() == LifecycleEvent.LifecycleState.MERGED) {
log.info("Hazelcast cluster merge detected after a split brain. Updating unmerged data structures");
AndesContext.getInstance().getClusterNotificationListenerManager().reInitializeListener();
AndesSubscriptionManager andesSubscriptionManager = AndesContext.getInstance()
.getAndesSubscriptionManager();
if(null != andesSubscriptionManager) {
andesSubscriptionManager.updateSubscriptionsAfterClusterMerge();
} else {
log.error("Andes Subscription Manager is not set. Local subscriptions are not synced with the " +
"main cluster");
}
// Notify that network partition has occurred.
networkPartitionDetector.networkPartitionMerged();
} else if (lifecycleEvent.getState() == LifecycleState.SHUTDOWN){
networkPartitionDetector.clusterOutageOccurred();
}
} catch (Throwable e) {
log.error("Error occurred while handling Hazelcast state change event " + lifecycleEvent.getState(), e);
}
}
示例6: stateChanged
import com.hazelcast.core.LifecycleEvent; //导入依赖的package包/类
public void stateChanged(LifecycleEvent event) {
if (event.getState().equals(LifecycleState.SHUTDOWN)) {
leaveCluster();
} else if (event.getState().equals(LifecycleState.STARTED)) {
joinCluster();
}
}
示例7: stateChanged
import com.hazelcast.core.LifecycleEvent; //导入依赖的package包/类
@Override
public void stateChanged(LifecycleEvent event) {
if (event.getState().equals(LifecycleState.SHUTDOWN)) {
sessionService.setFailedConnection(true);
}
}
示例8: onHazelcastStateChange
import com.hazelcast.core.LifecycleEvent; //导入依赖的package包/类
private void onHazelcastStateChange(final LifecycleEvent event) {
log.debug("Hazelcast lifecycle event: {}.", event);
if (event.getState() == LifecycleEvent.LifecycleState.SHUTTING_DOWN) {
cleanUp();
}
}
示例9: fireLifecycleEvent
import com.hazelcast.core.LifecycleEvent; //导入依赖的package包/类
public void fireLifecycleEvent(LifecycleState lifecycleState) {
fireLifecycleEvent(new LifecycleEvent(lifecycleState));
}
示例10: stateChanged
import com.hazelcast.core.LifecycleEvent; //导入依赖的package包/类
@Override
public void stateChanged(LifecycleEvent event) {
log.info("Hazelcast has new state: " + event);
}