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


Java StorageProxy.writeHintForMutation方法代码示例

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


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

示例1: writeHintsForUndeliveredEndpoints

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private void writeHintsForUndeliveredEndpoints(int startFrom)
{
    try
    {
        // Here we deserialize mutations 2nd time from byte buffer.
        // but this is ok, because timeout on batch direct delivery is rare
        // (it can happen only several seconds until node is marked dead)
        // so trading some cpu to keep less objects
        List<Mutation> replayingMutations = replayingMutations();
        for (int i = startFrom; i < replayHandlers.size(); i++)
        {
            Mutation undeliveredMutation = replayingMutations.get(i);
            int ttl = calculateHintTTL(replayingMutations);
            ReplayWriteResponseHandler handler = replayHandlers.get(i);

            if (ttl > 0 && handler != null)
                for (InetAddress endpoint : handler.undelivered)
                    StorageProxy.writeHintForMutation(undeliveredMutation, writtenAt, ttl, endpoint);
        }
    }
    catch (IOException e)
    {
        logger.error("Cannot schedule hints for undelivered batch", e);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:26,代码来源:BatchlogManager.java

示例2: replaySerializedMutation

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private void replaySerializedMutation(RowMutation mutation, long writtenAt)
{
    int ttl = calculateHintTTL(mutation, writtenAt);
    if (ttl <= 0)
        return; // the mutation isn't safe to replay.

    Set<InetAddress> liveEndpoints = new HashSet<InetAddress>();
    String ks = mutation.getKeyspaceName();
    Token<?> tk = StorageService.getPartitioner().getToken(mutation.key());
    for (InetAddress endpoint : Iterables.concat(StorageService.instance.getNaturalEndpoints(ks, tk),
                                                 StorageService.instance.getTokenMetadata().pendingEndpointsFor(tk, ks)))
    {
        if (endpoint.equals(FBUtilities.getBroadcastAddress()))
            mutation.apply();
        else if (FailureDetector.instance.isAlive(endpoint))
            liveEndpoints.add(endpoint); // will try delivering directly instead of writing a hint.
        else
            StorageProxy.writeHintForMutation(mutation, ttl, endpoint);
    }

    if (!liveEndpoints.isEmpty())
        attemptDirectDelivery(mutation, writtenAt, liveEndpoints);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:24,代码来源:BatchlogManager.java

示例3: replaySerializedMutation

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private void replaySerializedMutation(RowMutation mutation, long writtenAt) throws IOException
{
    int ttl = calculateHintTTL(mutation, writtenAt);
    if (ttl <= 0)
        return; // the mutation isn't safe to replay.

    Set<InetAddress> liveEndpoints = new HashSet<InetAddress>();
    String ks = mutation.getTable();
    Token tk = StorageService.getPartitioner().getToken(mutation.key());
    for (InetAddress endpoint : Iterables.concat(StorageService.instance.getNaturalEndpoints(ks, tk),
                                                 StorageService.instance.getTokenMetadata().pendingEndpointsFor(tk, ks)))
    {
        if (endpoint.equals(FBUtilities.getBroadcastAddress()))
            mutation.apply();
        else if (FailureDetector.instance.isAlive(endpoint))
            liveEndpoints.add(endpoint); // will try delivering directly instead of writing a hint.
        else
            StorageProxy.writeHintForMutation(mutation, ttl, endpoint);
    }

    if (!liveEndpoints.isEmpty())
        attemptDirectDelivery(mutation, writtenAt, liveEndpoints);
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:24,代码来源:BatchlogManager.java

示例4: replaySerializedMutation

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private void replaySerializedMutation(Mutation mutation, long writtenAt, RateLimiter rateLimiter)
{
    int ttl = calculateHintTTL(mutation, writtenAt);
    if (ttl <= 0)
        return; // the mutation isn't safe to replay.

    Set<InetAddress> liveEndpoints = new HashSet<>();
    String ks = mutation.getKeyspaceName();
    Token<?> tk = StorageService.getPartitioner().getToken(mutation.key());
    int mutationSize = (int) Mutation.serializer.serializedSize(mutation, VERSION);

    for (InetAddress endpoint : Iterables.concat(StorageService.instance.getNaturalEndpoints(ks, tk),
                                                 StorageService.instance.getTokenMetadata().pendingEndpointsFor(tk, ks)))
    {
        rateLimiter.acquire(mutationSize);
        if (endpoint.equals(FBUtilities.getBroadcastAddress()))
            mutation.apply();
        else if (FailureDetector.instance.isAlive(endpoint))
            liveEndpoints.add(endpoint); // will try delivering directly instead of writing a hint.
        else
            StorageProxy.writeHintForMutation(mutation, ttl, endpoint);
    }

    if (!liveEndpoints.isEmpty())
        attemptDirectDelivery(mutation, writtenAt, liveEndpoints);
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:27,代码来源:BatchlogManager.java

示例5: replaySerializedMutation

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private void replaySerializedMutation(Mutation mutation, long writtenAt, int version, RateLimiter rateLimiter)
{
    int ttl = calculateHintTTL(mutation, writtenAt);
    if (ttl <= 0)
        return; // the mutation isn't safe to replay.

    Set<InetAddress> liveEndpoints = new HashSet<>();
    String ks = mutation.getKeyspaceName();
    Token<?> tk = StorageService.getPartitioner().getToken(mutation.key());
    int mutationSize = (int) Mutation.serializer.serializedSize(mutation, version);

    for (InetAddress endpoint : Iterables.concat(StorageService.instance.getNaturalEndpoints(ks, tk),
                                                 StorageService.instance.getTokenMetadata().pendingEndpointsFor(tk, ks)))
    {
        rateLimiter.acquire(mutationSize);
        if (endpoint.equals(FBUtilities.getBroadcastAddress()))
            mutation.apply();
        else if (FailureDetector.instance.isAlive(endpoint))
            liveEndpoints.add(endpoint); // will try delivering directly instead of writing a hint.
        else
            StorageProxy.writeHintForMutation(mutation, ttl, endpoint);
    }

    if (!liveEndpoints.isEmpty())
        attemptDirectDelivery(mutation, writtenAt, liveEndpoints);
}
 
开发者ID:rajath26,项目名称:cassandra-trunk,代码行数:27,代码来源:BatchlogManager.java

示例6: replaySerializedMutation

import org.apache.cassandra.service.StorageProxy; //导入方法依赖的package包/类
private void replaySerializedMutation(RowMutation mutation, long writtenAt, RateLimiter rateLimiter) throws IOException
{
    int ttl = calculateHintTTL(mutation, writtenAt);
    if (ttl <= 0)
        return; // the mutation isn't safe to replay.

    Set<InetAddress> liveEndpoints = new HashSet<InetAddress>();
    String ks = mutation.getTable();
    Token tk = StorageService.getPartitioner().getToken(mutation.key());
    int mutationSize = (int) RowMutation.serializer.serializedSize(mutation, VERSION);

    for (InetAddress endpoint : Iterables.concat(StorageService.instance.getNaturalEndpoints(ks, tk),
                                                 StorageService.instance.getTokenMetadata().pendingEndpointsFor(tk, ks)))
    {
        rateLimiter.acquire(mutationSize);
        if (endpoint.equals(FBUtilities.getBroadcastAddress()))
            mutation.apply();
        else if (FailureDetector.instance.isAlive(endpoint))
            liveEndpoints.add(endpoint); // will try delivering directly instead of writing a hint.
        else
            StorageProxy.writeHintForMutation(mutation, ttl, endpoint);
    }

    if (!liveEndpoints.isEmpty())
        attemptDirectDelivery(mutation, writtenAt, liveEndpoints);
}
 
开发者ID:jackliu8722,项目名称:cassandra-1.2.16,代码行数:27,代码来源:BatchlogManager.java


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