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


Java SystemKeyspace.getPreferredIP方法代码示例

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


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

示例1: fetchAsync

import org.apache.cassandra.db.SystemKeyspace; //导入方法依赖的package包/类
public StreamResultFuture fetchAsync()
{
    for (Map.Entry<String, Map.Entry<InetAddress, Collection<Range<Token>>>> entry : toFetch.entries())
    {
        String keyspace = entry.getKey();
        InetAddress source = entry.getValue().getKey();
        InetAddress preferred = SystemKeyspace.getPreferredIP(source);
        Collection<Range<Token>> ranges = entry.getValue().getValue();
        /* Send messages to respective folks to stream data over to me */
        if (logger.isDebugEnabled())
            logger.debug("{}ing from {} ranges {}", description, source, StringUtils.join(ranges, ", "));
        streamPlan.requestRanges(source, preferred, keyspace, ranges);
    }

    return streamPlan.execute();
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:17,代码来源:RangeStreamer.java

示例2: initiateStreaming

import org.apache.cassandra.db.SystemKeyspace; //导入方法依赖的package包/类
private void initiateStreaming()
{
    long repairedAt = ActiveRepairService.UNREPAIRED_SSTABLE;
    InetAddress dest = request.dst;
    InetAddress preferred = SystemKeyspace.getPreferredIP(dest);
    if (desc.parentSessionId != null && ActiveRepairService.instance.getParentRepairSession(desc.parentSessionId) != null)
        repairedAt = ActiveRepairService.instance.getParentRepairSession(desc.parentSessionId).repairedAt;
    logger.info(String.format("[streaming task #%s] Performing streaming repair of %d ranges with %s", desc.sessionId, request.ranges.size(), request.dst));
    StreamResultFuture op = new StreamPlan("Repair", repairedAt, 1)
                                .flushBeforeTransfer(true)
                                // request ranges from the remote node
                                .requestRanges(dest, preferred, desc.keyspace, request.ranges, desc.columnFamily)
                                // send ranges to the remote node
                                .transferRanges(dest, preferred, desc.keyspace, request.ranges, desc.columnFamily)
                                .execute();
    op.addEventListener(this);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:18,代码来源:StreamingRepairTask.java

示例3: fetchAsync

import org.apache.cassandra.db.SystemKeyspace; //导入方法依赖的package包/类
public StreamResultFuture fetchAsync()
{
    for (Map.Entry<String, Map.Entry<InetAddress, Collection<Range<Token>>>> entry : toFetch.entries())
    {
        String keyspace = entry.getKey();
        InetAddress source = entry.getValue().getKey();
        InetAddress preferred = SystemKeyspace.getPreferredIP(source);
        Collection<Range<Token>> ranges = entry.getValue().getValue();

        // filter out already streamed ranges
        Set<Range<Token>> availableRanges = stateStore.getAvailableRanges(keyspace, StorageService.instance.getTokenMetadata().partitioner);
        if (ranges.removeAll(availableRanges))
        {
            logger.info("Some ranges of {} are already available. Skipping streaming those ranges.", availableRanges);
        }

        if (logger.isTraceEnabled())
            logger.trace("{}ing from {} ranges {}", description, source, StringUtils.join(ranges, ", "));
        /* Send messages to respective folks to stream data over to me */
        streamPlan.requestRanges(source, preferred, keyspace, ranges);
    }

    return streamPlan.execute();
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:25,代码来源:RangeStreamer.java

示例4: startSync

import org.apache.cassandra.db.SystemKeyspace; //导入方法依赖的package包/类
/**
 * Starts sending/receiving our list of differences to/from the remote endpoint: creates a callback
 * that will be called out of band once the streams complete.
 */
protected void startSync(List<Range<Token>> differences)
{
    InetAddress local = FBUtilities.getBroadcastAddress();
    // We can take anyone of the node as source or destination, however if one is localhost, we put at source to avoid a forwarding
    InetAddress dst = r2.endpoint.equals(local) ? r1.endpoint : r2.endpoint;
    InetAddress preferred = SystemKeyspace.getPreferredIP(dst);

    String message = String.format("Performing streaming repair of %d ranges with %s", differences.size(), dst);
    logger.info("[repair #{}] {}", desc.sessionId, message);
    boolean isIncremental = false;
    if (desc.parentSessionId != null)
    {
        ActiveRepairService.ParentRepairSession prs = ActiveRepairService.instance.getParentRepairSession(desc.parentSessionId);
        isIncremental = prs.isIncremental;
    }
    Tracing.traceRepair(message);
    new StreamPlan("Repair", repairedAt, 1, false, isIncremental).listeners(this)
                                        .flushBeforeTransfer(true)
                                        // request ranges from the remote node
                                        .requestRanges(dst, preferred, desc.keyspace, differences, desc.columnFamily)
                                        // send ranges to the remote node
                                        .transferRanges(dst, preferred, desc.keyspace, differences, desc.columnFamily)
                                        .execute();
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:29,代码来源:LocalSyncTask.java

示例5: run

import org.apache.cassandra.db.SystemKeyspace; //导入方法依赖的package包/类
public void run()
{
    InetAddress dest = request.dst;
    InetAddress preferred = SystemKeyspace.getPreferredIP(dest);
    logger.info(String.format("[streaming task #%s] Performing streaming repair of %d ranges with %s", desc.sessionId, request.ranges.size(), request.dst));
    boolean isIncremental = false;
    if (desc.parentSessionId != null)
    {
        ActiveRepairService.ParentRepairSession prs = ActiveRepairService.instance.getParentRepairSession(desc.parentSessionId);
        isIncremental = prs.isIncremental;
    }
    new StreamPlan("Repair", repairedAt, 1, false, isIncremental).listeners(this)
                                        .flushBeforeTransfer(true)
                                        // request ranges from the remote node
                                        .requestRanges(dest, preferred, desc.keyspace, request.ranges, desc.columnFamily)
                                        // send ranges to the remote node
                                        .transferRanges(dest, preferred, desc.keyspace, request.ranges, desc.columnFamily)
                                        .execute();
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:20,代码来源:StreamingRepairTask.java

示例6: streamHints

import org.apache.cassandra.db.SystemKeyspace; //导入方法依赖的package包/类
private Future<StreamState> streamHints()
{
    // StreamPlan will not fail if there are zero files to transfer, so flush anyway (need to get any in-memory hints, as well)
    ColumnFamilyStore hintsCF = Keyspace.open(Keyspace.SYSTEM_KS).getColumnFamilyStore(SystemKeyspace.HINTS_CF);
    FBUtilities.waitOnFuture(hintsCF.forceFlush());

    // gather all live nodes in the cluster that aren't also leaving
    List<InetAddress> candidates = new ArrayList<>(StorageService.instance.getTokenMetadata().cloneAfterAllLeft().getAllEndpoints());
    candidates.remove(FBUtilities.getBroadcastAddress());
    for (Iterator<InetAddress> iter = candidates.iterator(); iter.hasNext(); )
    {
        InetAddress address = iter.next();
        if (!FailureDetector.instance.isAlive(address))
            iter.remove();
    }

    if (candidates.isEmpty())
    {
        logger.warn("Unable to stream hints since no live endpoints seen");
        return Futures.immediateFuture(null);
    }
    else
    {
        // stream to the closest peer as chosen by the snitch
        DatabaseDescriptor.getEndpointSnitch().sortByProximity(FBUtilities.getBroadcastAddress(), candidates);
        InetAddress hintsDestinationHost = candidates.get(0);
        InetAddress preferred = SystemKeyspace.getPreferredIP(hintsDestinationHost);

        // stream all hints -- range list will be a singleton of "the entire ring"
        Token token = StorageService.getPartitioner().getMinimumToken();
        List<Range<Token>> ranges = Collections.singletonList(new Range<>(token, token));

        return new StreamPlan("Hints").transferRanges(hintsDestinationHost,
                                                      preferred,
                                                                  Keyspace.SYSTEM_KS,
                                                                  ranges,
                                                                  SystemKeyspace.HINTS_CF)
                                                  .execute();
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:41,代码来源:StorageService.java

示例7: OutboundTcpConnectionPool

import org.apache.cassandra.db.SystemKeyspace; //导入方法依赖的package包/类
OutboundTcpConnectionPool(InetAddress remoteEp)
{
    id = remoteEp;
    resetEndpoint = SystemKeyspace.getPreferredIP(remoteEp);
    started = new CountDownLatch(1);

    cmdCon = new OutboundTcpConnection(this);
    ackCon = new OutboundTcpConnection(this);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:10,代码来源:OutboundTcpConnectionPool.java

示例8: OutboundTcpConnectionPool

import org.apache.cassandra.db.SystemKeyspace; //导入方法依赖的package包/类
OutboundTcpConnectionPool(InetAddress remoteEp)
{
    id = remoteEp;
    resetedEndpoint = SystemKeyspace.getPreferredIP(remoteEp);

    cmdCon = new OutboundTcpConnection(this);
    cmdCon.start();
    ackCon = new OutboundTcpConnection(this);
    ackCon.start();

    metrics = new ConnectionMetrics(id, this);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:13,代码来源:OutboundTcpConnectionPool.java

示例9: OutboundTcpConnectionPool

import org.apache.cassandra.db.SystemKeyspace; //导入方法依赖的package包/类
OutboundTcpConnectionPool(InetAddress remoteEp)
{
    id = remoteEp;
    resetEndpoint = SystemKeyspace.getPreferredIP(remoteEp);
    started = new CountDownLatch(1);

    smallMessages = new OutboundTcpConnection(this);
    largeMessages = new OutboundTcpConnection(this);
    gossipMessages = new OutboundTcpConnection(this);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:11,代码来源:OutboundTcpConnectionPool.java

示例10: OutboundTcpConnectionPool

import org.apache.cassandra.db.SystemKeyspace; //导入方法依赖的package包/类
OutboundTcpConnectionPool(InetAddress remoteEp)
{
    id = remoteEp;
    resetedEndpoint = SystemKeyspace.getPreferredIP(remoteEp);
    started = new CountDownLatch(1);

    cmdCon = new OutboundTcpConnection(this);
    ackCon = new OutboundTcpConnection(this);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:10,代码来源:OutboundTcpConnectionPool.java


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