Package com.yahoo.documentapi.local
Class LocalVisitorSession
java.lang.Object
com.yahoo.documentapi.local.LocalVisitorSession
- All Implemented Interfaces:
VisitorControlSession,VisitorSession
Local visitor session that copies and iterates through all items in the local document access.
Each document must be ack'ed for the session to be done visiting, unless the destination is remote.
Only document puts are sent by this session, and this is done from a separate thread.
- Author:
- jonmv
-
Constructor Summary
ConstructorsConstructorDescriptionLocalVisitorSession(LocalDocumentAccess access, VisitorParameters parameters) -
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.Returns the token set in the parameters used to create this.com.yahoo.messagebus.TracegetTrace()Returns the tracing information so far about the visitor.booleanisDone()Checks if visiting is done.booleanwaitUntilDone(long timeoutMs) Waits until visiting is done, or the given timeout (in ms) expires.
-
Constructor Details
-
LocalVisitorSession
public LocalVisitorSession(LocalDocumentAccess access, VisitorParameters parameters) throws com.yahoo.document.select.parser.ParseException - Throws:
com.yahoo.document.select.parser.ParseException
-
-
Method Details
-
isDone
public boolean isDone()Description copied from interface:VisitorSessionChecks if visiting is done.- Specified by:
isDonein interfaceVisitorSession- Returns:
- True if visiting is done (either by error or success).
-
getProgress
Returns the token set in the parameters used to create this.- Specified by:
getProgressin interfaceVisitorSession- Returns:
- The progress token.
-
getTrace
public com.yahoo.messagebus.Trace getTrace()Description copied from interface:VisitorSessionReturns the tracing information so far about the visitor.- Specified by:
getTracein interfaceVisitorSession- Returns:
- Returns the trace.
-
waitUntilDone
Description copied from interface:VisitorSessionWaits until visiting is done, or the given timeout (in ms) expires. Will wait forever if timeout is 0.- Specified by:
waitUntilDonein interfaceVisitorSession- Parameters:
timeoutMs- The maximum amount of milliseconds to wait.- Returns:
- True if visiting is done (either by error or success).
- Throws:
InterruptedException- If an interrupt signal was received while waiting.
-
ack
Description copied from interface:VisitorControlSessionAcknowledges a response previously retrieved by thegetNextmethod.- Specified by:
ackin interfaceVisitorControlSession- Parameters:
token- The ack token. You must get this from the visitor response returned by thegetNextmethod.
-
abort
public void abort()Description copied from interface:VisitorControlSessionAborts the session.- Specified by:
abortin interfaceVisitorControlSession
-
getNext
Description copied from interface:VisitorControlSessionReturns the next response of this session. This method returns immediately.- Specified by:
getNextin interfaceVisitorControlSession- Returns:
- the next response, or null if no response is ready at this time
-
getNext
Description copied from interface:VisitorControlSessionReturns the next response of this session. This will block until a response is ready or until the given timeout is reached- Specified by:
getNextin interfaceVisitorControlSession- 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
public void destroy()Description copied from interface:VisitorControlSessionDestroys this session and frees up any resources it has held.- Specified by:
destroyin interfaceVisitorControlSession
-