public class VisitorControlHandler extends Object
Modifier and Type | Class and Description |
---|---|
static class |
VisitorControlHandler.CompletionCode
Possible completion codes for visiting.
|
class |
VisitorControlHandler.Result
The result of the visitor, containing a completion code and an optional
error message.
|
Modifier and Type | Field and Description |
---|---|
private boolean |
completed |
private ProgressToken |
currentProgress |
private com.yahoo.vdslib.VisitorStatistics |
currentStatistics |
private VisitorControlHandler.Result |
result |
private VisitorControlSession |
session |
Constructor and Description |
---|
VisitorControlHandler() |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Abort this visitor
|
ProgressToken |
getProgress() |
VisitorControlHandler.Result |
getResult() |
com.yahoo.vdslib.VisitorStatistics |
getVisitorStatistics() |
boolean |
hasVisitedAnyBuckets()
Returns true iff the statistics reported by the visiting session indicates at least one
bucket has been completely visited.
|
boolean |
isDone() |
void |
onDone(VisitorControlHandler.CompletionCode code,
String message)
Callback called when the visitor is done.
|
void |
onProgress(ProgressToken token)
Callback called when progress has changed.
|
void |
onVisitorError(String message)
Callback for visitor error messages.
|
void |
onVisitorStatistics(com.yahoo.vdslib.VisitorStatistics vs)
Callback for visitor statistics updates.
|
void |
reset()
Called before the visitor starts.
|
void |
setSession(VisitorControlSession session) |
void |
waitUntilDone()
Waits until visiting is done.
|
boolean |
waitUntilDone(Duration timeout)
Waits until visiting is done, or the given timeout (in ms) expires.
|
boolean |
waitUntilDone(long timeoutMs)
Waits until visiting is done, or the given timeout (in ms) expires.
|
private VisitorControlSession session
private ProgressToken currentProgress
private boolean completed
private VisitorControlHandler.Result result
private com.yahoo.vdslib.VisitorStatistics currentStatistics
public void reset()
public void onProgress(ProgressToken token)
token
- the most recent progress token for this visitorpublic void onVisitorError(String message)
message
- the error messagepublic void onVisitorStatistics(com.yahoo.vdslib.VisitorStatistics vs)
vs
- The current statistics for this visitor.public boolean hasVisitedAnyBuckets()
public void onDone(VisitorControlHandler.CompletionCode code, String message)
code
- the completion codemessage
- an optional error messagepublic void setSession(VisitorControlSession session)
session
- the visitor session used for this visitorpublic ProgressToken getProgress()
public com.yahoo.vdslib.VisitorStatistics getVisitorStatistics()
public boolean isDone()
public boolean waitUntilDone(Duration timeout) throws InterruptedException
timeout
- Maximum time duration to wait before returning.InterruptedException
- If an interrupt signal was received while waiting.public boolean waitUntilDone(long timeoutMs) throws InterruptedException
timeoutMs
- The maximum amount of milliseconds to wait.InterruptedException
- If an interrupt signal was received while waiting.
TODO deprecate this in favor of waitUntilDone(Duration)public void waitUntilDone() throws InterruptedException
InterruptedException
- If an interrupt signal was received while waiting.public void abort()
public VisitorControlHandler.Result getResult()
Copyright © 2018. All rights reserved.