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


Java Gossiper.instance方法代码示例

本文整理汇总了Java中org.apache.cassandra.gms.Gossiper.instance方法的典型用法代码示例。如果您正苦于以下问题:Java Gossiper.instance方法的具体用法?Java Gossiper.instance怎么用?Java Gossiper.instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.gms.Gossiper的用法示例。


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

示例1: reloadGossiperState

import org.apache.cassandra.gms.Gossiper; //导入方法依赖的package包/类
private void reloadGossiperState()
{
    if (Gossiper.instance != null)
    {
        ReconnectableSnitchHelper pendingHelper = new ReconnectableSnitchHelper(this, myDC, preferLocal);
        Gossiper.instance.register(pendingHelper);
        
        pendingHelper = snitchHelperReference.getAndSet(pendingHelper);
        if (pendingHelper != null)
            Gossiper.instance.unregister(pendingHelper);
    }
    // else this will eventually rerun at gossiperStarting()
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:14,代码来源:GossipingPropertyFileSnitch.java

示例2: waitForSchemaAgreement

import org.apache.cassandra.gms.Gossiper; //导入方法依赖的package包/类
private int waitForSchemaAgreement(InetAddress endpoint) throws TimeoutException
{
    Gossiper gossiper = Gossiper.instance;
    int waited = 0;
    // first, wait for schema to be gossiped.
    while (gossiper.getEndpointStateForEndpoint(endpoint) != null && gossiper.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.SCHEMA) == null)
    {
        Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
        waited += 1000;
        if (waited > 2 * StorageService.RING_DELAY)
            throw new TimeoutException("Didin't receive gossiped schema from " + endpoint + " in " + 2 * StorageService.RING_DELAY + "ms");
    }
    if (gossiper.getEndpointStateForEndpoint(endpoint) == null)
        throw new TimeoutException("Node " + endpoint + " vanished while waiting for agreement");
    waited = 0;
    // then wait for the correct schema version.
    // usually we use DD.getDefsVersion, which checks the local schema uuid as stored in the system keyspace.
    // here we check the one in gossip instead; this serves as a canary to warn us if we introduce a bug that
    // causes the two to diverge (see CASSANDRA-2946)
    while (gossiper.getEndpointStateForEndpoint(endpoint) != null && !gossiper.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.SCHEMA).value.equals(
            gossiper.getEndpointStateForEndpoint(FBUtilities.getBroadcastAddress()).getApplicationState(ApplicationState.SCHEMA).value))
    {
        Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
        waited += 1000;
        if (waited > 2 * StorageService.RING_DELAY)
            throw new TimeoutException("Could not reach schema agreement with " + endpoint + " in " + 2 * StorageService.RING_DELAY + "ms");
    }
    if (gossiper.getEndpointStateForEndpoint(endpoint) == null)
        throw new TimeoutException("Node " + endpoint + " vanished while waiting for agreement");
    logger.debug("schema for {} matches local schema", endpoint);
    return waited;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:33,代码来源:HintedHandOffManager.java

示例3: waitForSchemaAgreement

import org.apache.cassandra.gms.Gossiper; //导入方法依赖的package包/类
private int waitForSchemaAgreement(InetAddress endpoint) throws TimeoutException
{
    Gossiper gossiper = Gossiper.instance;
    int waited = 0;
    // first, wait for schema to be gossiped.
    while (gossiper.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.SCHEMA) == null)
    {
        Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
        waited += 1000;
        if (waited > 2 * StorageService.RING_DELAY)
            throw new TimeoutException("Didin't receive gossiped schema from " + endpoint + " in " + 2 * StorageService.RING_DELAY + "ms");
    }
    waited = 0;
    // then wait for the correct schema version.
    // usually we use DD.getDefsVersion, which checks the local schema uuid as stored in the system keyspace.
    // here we check the one in gossip instead; this serves as a canary to warn us if we introduce a bug that
    // causes the two to diverge (see CASSANDRA-2946)
    while (!gossiper.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.SCHEMA).value.equals(
            gossiper.getEndpointStateForEndpoint(FBUtilities.getBroadcastAddress()).getApplicationState(ApplicationState.SCHEMA).value))
    {
        Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
        waited += 1000;
        if (waited > 2 * StorageService.RING_DELAY)
            throw new TimeoutException("Could not reach schema agreement with " + endpoint + " in " + 2 * StorageService.RING_DELAY + "ms");
    }
    logger.debug("schema for {} matches local schema", endpoint);
    return waited;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:29,代码来源:HintedHandOffManager.java


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