當前位置: 首頁>>代碼示例>>Java>>正文


Java CuratorFrameworkState.LATENT屬性代碼示例

本文整理匯總了Java中org.apache.curator.framework.imps.CuratorFrameworkState.LATENT屬性的典型用法代碼示例。如果您正苦於以下問題:Java CuratorFrameworkState.LATENT屬性的具體用法?Java CuratorFrameworkState.LATENT怎麽用?Java CuratorFrameworkState.LATENT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.curator.framework.imps.CuratorFrameworkState的用法示例。


在下文中一共展示了CuratorFrameworkState.LATENT屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: register

@Override
public void register(String service, String version, String address) {
    if(zkClient.getState() == CuratorFrameworkState.LATENT){
        zkClient.start();
    }
    if (version == null || version == ""){
        version ="1.0.0";
    }
    //創建臨時節點
    try {
        zkClient.create()
                .creatingParentsIfNeeded()
                .withMode(CreateMode.EPHEMERAL)
                .forPath("/"+service+"/"+version+"/"+address);
    } catch (Exception e) {
        logger.error("register service address to zookeeper exception:{}",e);
        throw new ThriftException("register service address to zookeeper exception:{}", e);
    }
}
 
開發者ID:somewhereMrli,項目名稱:albedo-thrift,代碼行數:19,代碼來源:ThriftServerAddressRegisterZookeeper.java

示例2: register

@Override
public void register(String service, String version, String address) {
    if(curatorFramework.getState() == CuratorFrameworkState.LATENT){
        curatorFramework.start();
    }
    if (version == null || version == ""){
        version = ThriftConstant.DEFAULT_VERSION;
    }

    //創建臨時節點
    try {
        String path = "/"+service+"/"+version+"/"+address;
        logger.info("register: {}", path);
        curatorFramework.create()
                .creatingParentsIfNeeded()
                .withMode(CreateMode.EPHEMERAL_SEQUENTIAL)
                .forPath(path);
    } catch (Exception e) {
        logger.error("register service address to zookeeper exception:{}",e);
        throw new ThriftException("register service address to zookeeper exception:{}", e);
    }
}
 
開發者ID:somewhereMrli,項目名稱:albedo-thrift,代碼行數:22,代碼來源:ZookeeperServiceRegister.java

示例3: afterPropertiesSet

@Override
public void afterPropertiesSet() throws Exception {
    // 如果zk尚未啟動,則啟動
    if (zkClient.getState() == CuratorFrameworkState.LATENT) {
        zkClient.start();
    }
    buildPathChildrenCache(zkClient, getServicePath(), true);
    cachedPath.start(StartMode.POST_INITIALIZED_EVENT);
    countDownLatch.await();
}
 
開發者ID:somewhereMrli,項目名稱:albedo-thrift,代碼行數:10,代碼來源:ThriftServerAddressProviderZookeeper.java

示例4: getCuratorFramework

/**
 * Getting the curator oject to start the zookeeper connection estabished
 * 
 * @param curator
 * @return curator object
 */
public static CuratorFramework getCuratorFramework(CuratorFramework curator) {
	if (curator.getState() == CuratorFrameworkState.LATENT) {
		curator.start();

		try {
			curator.blockUntilConnected();
		} catch (InterruptedException e) {
			// Ignore
			log.error("error while setting curator framework :" + e.getMessage());
		}
	}

	return curator;
}
 
開發者ID:att,項目名稱:dmaap-framework,代碼行數:20,代碼來源:KafkaConsumerCache.java

示例5: init

/** Initializes this IP Finder by creating the appropriate Curator objects. */
private void init() {
    if (!initGuard.compareAndSet(false, true))
        return;

    String sysPropZkConnString = System.getProperty(PROP_ZK_CONNECTION_STRING);

    if (sysPropZkConnString != null && sysPropZkConnString.trim().length() > 0)
        zkConnectionString = sysPropZkConnString;

    if (log.isInfoEnabled())
        log.info("Initializing ZooKeeper IP Finder.");

    if (curator == null) {
        A.notNullOrEmpty(zkConnectionString, String.format("ZooKeeper URL (or system property %s) cannot be null " +
            "or empty if a CuratorFramework object is not provided explicitly", PROP_ZK_CONNECTION_STRING));
        curator = CuratorFrameworkFactory.newClient(zkConnectionString, retryPolicy);
    }

    if (curator.getState() == CuratorFrameworkState.LATENT)
        curator.start();

    A.ensure(curator.getState() == CuratorFrameworkState.STARTED, "CuratorFramework can't be started.");

    discovery = ServiceDiscoveryBuilder.builder(IgniteInstanceDetails.class)
        .client(curator)
        .basePath(basePath)
        .serializer(new JsonInstanceSerializer<>(IgniteInstanceDetails.class))
        .build();
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:30,代碼來源:TcpDiscoveryZookeeperIpFinder.java

示例6: isUninitialized

public boolean isUninitialized() {
    return client.getState() == CuratorFrameworkState.LATENT;
}
 
開發者ID:odiszapc,項目名稱:stem,代碼行數:3,代碼來源:ZookeeperClient.java

示例7: start

@Override
public void start() throws Exception {
    if (_curator.getState() == CuratorFrameworkState.LATENT) {
        _curator.start();
    }
}
 
開發者ID:bazaarvoice,項目名稱:curator-extensions,代碼行數:6,代碼來源:ManagedCuratorFramework.java

示例8: isStopped

/**
 * 判斷Zookeeper客戶端是是否已徑關閉
 * 
 * @param client Zookeeper客戶端
 * @return 是否已徑關閉
 */
private boolean isStopped(final CuratorFramework client) {
    return client.getState() == CuratorFrameworkState.STOPPED || client.getState() == CuratorFrameworkState.LATENT;
}
 
開發者ID:ErinDavid,項目名稱:elastic-config,代碼行數:9,代碼來源:ZookeeperListenerManager.java


注:本文中的org.apache.curator.framework.imps.CuratorFrameworkState.LATENT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。