本文整理汇总了Java中org.apache.cassandra.gms.IFailureDetector类的典型用法代码示例。如果您正苦于以下问题:Java IFailureDetector类的具体用法?Java IFailureDetector怎么用?Java IFailureDetector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFailureDetector类属于org.apache.cassandra.gms包,在下文中一共展示了IFailureDetector类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: sendReplicationNotification
import org.apache.cassandra.gms.IFailureDetector; //导入依赖的package包/类
/**
* Sends a notification to a node indicating we have finished replicating data.
*
* @param remote node to send notification to
*/
private void sendReplicationNotification(InetAddress remote)
{
// notify the remote token
MessageOut msg = new MessageOut(MessagingService.Verb.REPLICATION_FINISHED);
IFailureDetector failureDetector = FailureDetector.instance;
if (logger.isDebugEnabled())
logger.debug("Notifying {} of replication completion\n", remote);
while (failureDetector.isAlive(remote))
{
AsyncOneResponse iar = MessagingService.instance().sendRR(msg, remote);
try
{
iar.get(DatabaseDescriptor.getRpcTimeout(), TimeUnit.MILLISECONDS);
return; // done
}
catch(TimeoutException e)
{
// try again
}
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:27,代码来源:StorageService.java
示例2: getWorkMap
import org.apache.cassandra.gms.IFailureDetector; //导入依赖的package包/类
static Multimap<InetAddress, Range> getWorkMap(Multimap<Range, InetAddress> rangesWithSourceTarget, IFailureDetector failureDetector)
{
/*
* Map whose key is the source node and the value is a map whose key is the
* target and value is the list of ranges to be sent to it.
*/
Multimap<InetAddress, Range> sources = ArrayListMultimap.create();
// TODO look for contiguous ranges and map them to the same source
for (Range range : rangesWithSourceTarget.keySet())
{
for (InetAddress source : rangesWithSourceTarget.get(range))
{
if (failureDetector.isAlive(source))
{
sources.put(source, range);
break;
}
}
}
return sources;
}
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:23,代码来源:BootStrapper.java
示例3: getNewSourceRanges
import org.apache.cassandra.gms.IFailureDetector; //导入依赖的package包/类
/**
* Finds living endpoints responsible for the given ranges
*
* @param keyspaceName the keyspace ranges belong to
* @param ranges the ranges to find sources for
* @return multimap of addresses to ranges the address is responsible for
*/
private Multimap<InetAddress, Range<Token>> getNewSourceRanges(String keyspaceName, Set<Range<Token>> ranges)
{
InetAddress myAddress = FBUtilities.getBroadcastAddress();
Multimap<Range<Token>, InetAddress> rangeAddresses = Keyspace.open(keyspaceName).getReplicationStrategy().getRangeAddresses(tokenMetadata.cloneOnlyTokenMap());
Multimap<InetAddress, Range<Token>> sourceRanges = HashMultimap.create();
IFailureDetector failureDetector = FailureDetector.instance;
// find alive sources for our new ranges
for (Range<Token> range : ranges)
{
Collection<InetAddress> possibleRanges = rangeAddresses.get(range);
IEndpointSnitch snitch = DatabaseDescriptor.getEndpointSnitch();
List<InetAddress> sources = snitch.getSortedListByProximity(myAddress, possibleRanges);
assert (!sources.contains(myAddress));
for (InetAddress source : sources)
{
if (failureDetector.isAlive(source))
{
sourceRanges.put(source, range);
break;
}
}
}
return sourceRanges;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:35,代码来源:StorageService.java
示例4: FailureDetectorSourceFilter
import org.apache.cassandra.gms.IFailureDetector; //导入依赖的package包/类
public FailureDetectorSourceFilter(IFailureDetector fd)
{
this.fd = fd;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:RangeStreamer.java
示例5: removeNode
import org.apache.cassandra.gms.IFailureDetector; //导入依赖的package包/类
/**
* Remove a node that has died, attempting to restore the replica count.
* If the node is alive, decommission should be attempted. If decommission
* fails, then removeToken should be called. If we fail while trying to
* restore the replica count, finally forceRemoveCompleteion should be
* called to forcibly remove the node without regard to replica count.
*
* @param hostIdString token for the node
*/
public void removeNode(String hostIdString)
{
InetAddress myAddress = FBUtilities.getBroadcastAddress();
UUID localHostId = tokenMetadata.getHostId(myAddress);
UUID hostId = UUID.fromString(hostIdString);
InetAddress endpoint = tokenMetadata.getEndpointForHostId(hostId);
if (endpoint == null)
throw new UnsupportedOperationException("Host ID not found.");
Collection<Token> tokens = tokenMetadata.getTokens(endpoint);
if (endpoint.equals(myAddress))
throw new UnsupportedOperationException("Cannot remove self");
if (Gossiper.instance.getLiveMembers().contains(endpoint))
throw new UnsupportedOperationException("Node " + endpoint + " is alive and owns this ID. Use decommission command to remove it from the ring");
// A leaving endpoint that is dead is already being removed.
if (tokenMetadata.isLeaving(endpoint))
logger.warn("Node {} is already being removed, continuing removal anyway", endpoint);
if (!replicatingNodes.isEmpty())
throw new UnsupportedOperationException("This node is already processing a removal. Wait for it to complete, or use 'removenode force' if this has failed.");
// Find the endpoints that are going to become responsible for data
for (String keyspaceName : Schema.instance.getNonSystemKeyspaces())
{
// if the replication factor is 1 the data is lost so we shouldn't wait for confirmation
if (Keyspace.open(keyspaceName).getReplicationStrategy().getReplicationFactor() == 1)
continue;
// get all ranges that change ownership (that is, a node needs
// to take responsibility for new range)
Multimap<Range<Token>, InetAddress> changedRanges = getChangedRangesForLeaving(keyspaceName, endpoint);
IFailureDetector failureDetector = FailureDetector.instance;
for (InetAddress ep : changedRanges.values())
{
if (failureDetector.isAlive(ep))
replicatingNodes.add(ep);
else
logger.warn("Endpoint {} is down and will not receive data for re-replication of {}", ep, endpoint);
}
}
removingNode = endpoint;
tokenMetadata.addLeavingEndpoint(endpoint);
PendingRangeCalculatorService.instance.update();
// the gossiper will handle spoofing this node's state to REMOVING_TOKEN for us
// we add our own token so other nodes to let us know when they're done
Gossiper.instance.advertiseRemoving(endpoint, hostId, localHostId);
// kick off streaming commands
restoreReplicaCount(endpoint, myAddress);
// wait for ReplicationFinishedVerbHandler to signal we're done
while (!replicatingNodes.isEmpty())
{
Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
}
excise(tokens, endpoint);
// gossiper will indicate the token has left
Gossiper.instance.advertiseTokenRemoved(endpoint, hostId);
replicatingNodes.clear();
removingNode = null;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:80,代码来源:StorageService.java
示例6: getWorkMap
import org.apache.cassandra.gms.IFailureDetector; //导入依赖的package包/类
public static Multimap<InetAddress, Range<Token>> getWorkMap(Multimap<Range<Token>, InetAddress> rangesWithSourceTarget, String keyspace,
IFailureDetector fd, boolean useStrictConsistency)
{
return getRangeFetchMap(rangesWithSourceTarget, Collections.<ISourceFilter>singleton(new FailureDetectorSourceFilter(fd)), keyspace, useStrictConsistency);
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:6,代码来源:RangeStreamer.java
示例7: ActiveRepairService
import org.apache.cassandra.gms.IFailureDetector; //导入依赖的package包/类
public ActiveRepairService(IFailureDetector failureDetector, Gossiper gossiper)
{
this.failureDetector = failureDetector;
this.gossiper = gossiper;
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:6,代码来源:ActiveRepairService.java
注:本文中的org.apache.cassandra.gms.IFailureDetector类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论