Package org.apache.cassandra.streaming
Class StreamResultFuture
- java.lang.Object
-
- org.apache.cassandra.utils.concurrent.AbstractFuture<V>
-
- org.apache.cassandra.utils.concurrent.AsyncFuture<StreamState>
-
- org.apache.cassandra.streaming.StreamResultFuture
-
- All Implemented Interfaces:
com.google.common.util.concurrent.ListenableFuture<StreamState>,io.netty.util.concurrent.Future<StreamState>,java.util.concurrent.Future<StreamState>,Awaitable,Future<StreamState>
public final class StreamResultFuture extends AsyncFuture<StreamState>
A future on the result (StreamState) of a streaming plan. In practice, this object also groups all theStreamSessionfor the streaming job involved. One StreamSession will be created for every peer involved and said session will handle every streaming (outgoing and incoming) to that peer for this job.The future will return a result once every session is completed (successfully or not). If any session ended up with an error, the future will throw a StreamException.
You can attach
StreamEventHandlerto this object to listen onStreamEvents to track progress of the streaming.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.cassandra.utils.concurrent.Awaitable
Awaitable.AbstractAwaitable, Awaitable.AsyncAwaitable, Awaitable.Defaults, Awaitable.SyncAwaitable
-
-
Field Summary
Fields Modifier and Type Field Description TimeUUIDplanIdStreamOperationstreamOperation-
Fields inherited from class org.apache.cassandra.utils.concurrent.AbstractFuture
CANCELLED, UNCANCELLABLE, UNSET
-
-
Constructor Summary
Constructors Constructor Description StreamResultFuture(TimeUUID planId, StreamOperation streamOperation, StreamCoordinator coordinator)Create new StreamResult of givenplanIdand streamOperation.StreamResultFuture(TimeUUID planId, StreamOperation streamOperation, TimeUUID pendingRepair, PreviewKind previewKind)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEventListener(StreamEventHandler listener)static StreamResultFuturecreateFollower(int sessionIndex, TimeUUID planId, StreamOperation streamOperation, InetAddressAndPort from, StreamingChannel channel, int messagingVersion, TimeUUID pendingRepair, PreviewKind previewKind)static StreamResultFuturecreateInitiator(TimeUUID planId, StreamOperation streamOperation, java.util.Collection<StreamEventHandler> listeners, StreamCoordinator coordinator)booleanequals(java.lang.Object o)StreamCoordinatorgetCoordinator()StreamStategetCurrentState()StreamSessiongetSession(InetAddressAndPort peer, int sessionIndex)voidhandleProgress(ProgressInfo progress)inthashCode()-
Methods inherited from class org.apache.cassandra.utils.concurrent.AsyncFuture
await, awaitUntil, flatMap, map
-
Methods inherited from class org.apache.cassandra.utils.concurrent.AbstractFuture
addCallback, addCallback, addCallback, addCallback, addCallback, addCallback, addListener, addListener, addListener, addListeners, await, awaitThrowUncheckedOnInterrupt, awaitThrowUncheckedOnInterrupt, awaitUninterruptibly, awaitUninterruptibly, awaitUntilThrowUncheckedOnInterrupt, awaitUntilUninterruptibly, cancel, cause, description, flatMap, get, get, getNow, getWhenDone, isCancellable, isCancelled, isDone, isSuccess, isUncancellable, map, map, notifyExecutor, removeListener, removeListeners, setUncancellable, setUncancellableExclusive, toString, tryFailure, trySuccess
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.utils.concurrent.Future
await, awaitUninterruptibly, flatMap, rethrowIfFailed, sync, syncThrowUncheckedOnInterrupt, syncUninterruptibly
-
-
-
-
Field Detail
-
planId
public final TimeUUID planId
-
streamOperation
public final StreamOperation streamOperation
-
-
Constructor Detail
-
StreamResultFuture
public StreamResultFuture(TimeUUID planId, StreamOperation streamOperation, StreamCoordinator coordinator)
Create new StreamResult of givenplanIdand streamOperation. Constructor is package private. You need to useStreamPlan.execute()to get the instance.- Parameters:
planId- Stream plan IDstreamOperation- Stream streamOperation
-
StreamResultFuture
public StreamResultFuture(TimeUUID planId, StreamOperation streamOperation, TimeUUID pendingRepair, PreviewKind previewKind)
-
-
Method Detail
-
createInitiator
public static StreamResultFuture createInitiator(TimeUUID planId, StreamOperation streamOperation, java.util.Collection<StreamEventHandler> listeners, StreamCoordinator coordinator)
-
createFollower
public static StreamResultFuture createFollower(int sessionIndex, TimeUUID planId, StreamOperation streamOperation, InetAddressAndPort from, StreamingChannel channel, int messagingVersion, TimeUUID pendingRepair, PreviewKind previewKind)
-
getCoordinator
public StreamCoordinator getCoordinator()
-
addEventListener
public void addEventListener(StreamEventHandler listener)
-
getCurrentState
public StreamState getCurrentState()
- Returns:
- Current snapshot of streaming progress.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
handleProgress
public void handleProgress(ProgressInfo progress)
-
getSession
public StreamSession getSession(InetAddressAndPort peer, int sessionIndex)
-
-