org.apache.cassandra.dht
Class RangeStreamer

java.lang.Object
  extended by org.apache.cassandra.dht.RangeStreamer
All Implemented Interfaces:
IEndpointStateChangeSubscriber, IFailureDetectionEventListener

public class RangeStreamer
extends java.lang.Object
implements IEndpointStateChangeSubscriber, IFailureDetectionEventListener

Assists in streaming ranges to a node.


Nested Class Summary
static class RangeStreamer.FailureDetectorSourceFilter
          Source filter which excludes any endpoints that are not alive according to a failure detector.
static interface RangeStreamer.ISourceFilter
          A filter applied to sources to stream from when constructing a fetch map.
static class RangeStreamer.SingleDatacenterFilter
          Source filter which excludes any endpoints that are not in a specific data center.
 
Field Summary
protected  java.lang.String exceptionMessage
           
protected  java.util.concurrent.CountDownLatch latch
           
 
Constructor Summary
RangeStreamer(TokenMetadata metadata, java.net.InetAddress address, OperationType opType)
           
 
Method Summary
 void addRanges(java.lang.String table, java.util.Collection<Range<Token>> ranges)
           
 void addSourceFilter(RangeStreamer.ISourceFilter filter)
           
 void convict(java.net.InetAddress endpoint, double phi)
          Convict the specified endpoint.
 void fetch()
           
static com.google.common.collect.Multimap<java.net.InetAddress,Range<Token>> getWorkMap(com.google.common.collect.Multimap<Range<Token>,java.net.InetAddress> rangesWithSourceTarget)
           
 void onAlive(java.net.InetAddress endpoint, EndpointState state)
           
 void onChange(java.net.InetAddress endpoint, ApplicationState state, VersionedValue value)
           
 void onDead(java.net.InetAddress endpoint, EndpointState state)
           
 void onJoin(java.net.InetAddress endpoint, EndpointState epState)
          Use to inform interested parties about the change in the state for specified endpoint
 void onRemove(java.net.InetAddress endpoint)
           
 void onRestart(java.net.InetAddress endpoint, EndpointState epState)
          Called whenever a node is restarted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

latch

protected java.util.concurrent.CountDownLatch latch

exceptionMessage

protected volatile java.lang.String exceptionMessage
Constructor Detail

RangeStreamer

public RangeStreamer(TokenMetadata metadata,
                     java.net.InetAddress address,
                     OperationType opType)
Method Detail

addSourceFilter

public void addSourceFilter(RangeStreamer.ISourceFilter filter)

addRanges

public void addRanges(java.lang.String table,
                      java.util.Collection<Range<Token>> ranges)

getWorkMap

public static com.google.common.collect.Multimap<java.net.InetAddress,Range<Token>> getWorkMap(com.google.common.collect.Multimap<Range<Token>,java.net.InetAddress> rangesWithSourceTarget)

fetch

public void fetch()

onJoin

public void onJoin(java.net.InetAddress endpoint,
                   EndpointState epState)
Description copied from interface: IEndpointStateChangeSubscriber
Use to inform interested parties about the change in the state for specified endpoint

Specified by:
onJoin in interface IEndpointStateChangeSubscriber
Parameters:
endpoint - endpoint for which the state change occurred.
epState - state that actually changed for the above endpoint.

onChange

public void onChange(java.net.InetAddress endpoint,
                     ApplicationState state,
                     VersionedValue value)
Specified by:
onChange in interface IEndpointStateChangeSubscriber

onAlive

public void onAlive(java.net.InetAddress endpoint,
                    EndpointState state)
Specified by:
onAlive in interface IEndpointStateChangeSubscriber

onDead

public void onDead(java.net.InetAddress endpoint,
                   EndpointState state)
Specified by:
onDead in interface IEndpointStateChangeSubscriber

onRemove

public void onRemove(java.net.InetAddress endpoint)
Specified by:
onRemove in interface IEndpointStateChangeSubscriber

onRestart

public void onRestart(java.net.InetAddress endpoint,
                      EndpointState epState)
Description copied from interface: IEndpointStateChangeSubscriber
Called whenever a node is restarted. Note that there is no guarantee when that happens that the node was previously marked down. It will have only if state.isAlive() == false as state is from before the restarted node is marked up.

Specified by:
onRestart in interface IEndpointStateChangeSubscriber

convict

public void convict(java.net.InetAddress endpoint,
                    double phi)
Description copied from interface: IFailureDetectionEventListener
Convict the specified endpoint.

Specified by:
convict in interface IFailureDetectionEventListener
Parameters:
endpoint - endpoint to be convicted
phi - the value of phi with with ep was convicted


Copyright © 2012 The Apache Software Foundation