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 theStreamSession
for 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
StreamEventHandler
to this object to listen onStreamEvent
s 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 TimeUUID
planId
StreamOperation
streamOperation
-
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 givenplanId
and 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 void
addEventListener(StreamEventHandler listener)
static StreamResultFuture
createFollower(int sessionIndex, TimeUUID planId, StreamOperation streamOperation, InetAddressAndPort from, StreamingChannel channel, int messagingVersion, TimeUUID pendingRepair, PreviewKind previewKind)
static StreamResultFuture
createInitiator(TimeUUID planId, StreamOperation streamOperation, java.util.Collection<StreamEventHandler> listeners, StreamCoordinator coordinator)
boolean
equals(java.lang.Object o)
StreamCoordinator
getCoordinator()
StreamState
getCurrentState()
StreamSession
getSession(InetAddressAndPort peer, int sessionIndex)
void
handleProgress(ProgressInfo progress)
int
hashCode()
-
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 givenplanId
and 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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
handleProgress
public void handleProgress(ProgressInfo progress)
-
getSession
public StreamSession getSession(InetAddressAndPort peer, int sessionIndex)
-
-