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


Java LifecycleEvent类代码示例

本文整理汇总了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");
	}
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:17,代码来源:PopulationManagementImpl.java

示例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);
	}

}
 
开发者ID:Tesora,项目名称:tesora-dve-pub,代码行数:21,代码来源:HazelcastGroupClient.java

示例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();
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:8,代码来源:ClusterListener.java

示例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;
        }
    });
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:9,代码来源:LifecycleServiceClientImpl.java

示例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);
    }
}
 
开发者ID:wso2,项目名称:andes,代码行数:35,代码来源:HazelcastLifecycleListener.java

示例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();
	}
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:8,代码来源:ClusterListener.java

示例7: stateChanged

import com.hazelcast.core.LifecycleEvent; //导入依赖的package包/类
@Override
public void stateChanged(LifecycleEvent event) {
    if (event.getState().equals(LifecycleState.SHUTDOWN)) {
        sessionService.setFailedConnection(true);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-wm,代码行数:7,代码来源:ClientLifecycleListener.java

示例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();
	}
}
 
开发者ID:Kelleth,项目名称:age3-nanorobots,代码行数:7,代码来源:HazelcastDiscoveryService.java

示例9: fireLifecycleEvent

import com.hazelcast.core.LifecycleEvent; //导入依赖的package包/类
public void fireLifecycleEvent(LifecycleState lifecycleState) {
    fireLifecycleEvent(new LifecycleEvent(lifecycleState));
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:4,代码来源:LifecycleServiceImpl.java

示例10: stateChanged

import com.hazelcast.core.LifecycleEvent; //导入依赖的package包/类
@Override
public void stateChanged(LifecycleEvent event) {
	log.info("Hazelcast has new state: " + event);
}
 
开发者ID:lumongo,项目名称:lumongo,代码行数:5,代码来源:HazelcastManager.java


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