Package com.yahoo.documentapi
Interface VisitorControlSession
- All Known Subinterfaces:
VisitorDestinationSession,VisitorSession
- All Known Implementing Classes:
LocalVisitorSession,MessageBusVisitorDestinationSession,MessageBusVisitorSession
public interface VisitorControlSession
Superclass for document visiting functionality - accessing
documents in an order decided by the document repository. This allows much
higher read throughput than random access.
The class supplies an interface for functions that are common for different kinds of visitor sessions, such as acking visitor data and aborting the session.
- Author:
- HÃ¥kon Humberset
-
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Aborts the session.voidAcknowledges a response previously retrieved by thegetNextmethod.voiddestroy()Destroys this session and frees up any resources it has held.getNext()Returns the next response of this session.getNext(int timeoutMilliseconds) Returns the next response of this session.
-
Method Details
-
ack
Acknowledges a response previously retrieved by thegetNextmethod.- Parameters:
token- The ack token. You must get this from the visitor response returned by thegetNextmethod.
-
abort
void abort()Aborts the session. -
getNext
VisitorResponse getNext()Returns the next response of this session. This method returns immediately.- Returns:
- the next response, or null if no response is ready at this time
-
getNext
Returns the next response of this session. This will block until a response is ready or until the given timeout is reached- Parameters:
timeoutMilliseconds- the max time to wait for a response. If the number is 0, this will block without any timeout limit- Returns:
- the next response, or null if no response becomes ready before the timeout expires
- Throws:
InterruptedException- if this thread is interrupted while waiting
-
destroy
void destroy()Destroys this session and frees up any resources it has held.
-