Class MessageBusAsyncSession
- All Implemented Interfaces:
AsyncSession,MessageBusSession,Session
- Author:
- bratseth, Einar Rosenvinge
-
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroys this session and frees up any resources it has held.get(com.yahoo.document.DocumentId id) Gets a document.get(com.yahoo.document.DocumentId id, DocumentOperationParameters parameters) Gets a document.doubleReturns the current send window size of the session.getNext()Returns the next response of this session.getNext(int timeoutMilliseconds) Returns the next response of this session.getRoute()Returns the route to send all messages to when sending through this session.intReturns the trace level used when sending messages through this session.put(com.yahoo.document.Document document) Puts a document.put(com.yahoo.document.DocumentPut documentPut, DocumentOperationParameters parameters) Puts a document, with optional conditions on the operation.remove(com.yahoo.document.DocumentId id) Removes a document if it is present.remove(com.yahoo.document.DocumentRemove remove, DocumentOperationParameters parameters) Removes a document if it is present.send(com.yahoo.messagebus.Message msg) A convenience method for assigning the internal trace level and route string to a message before sending it through the internal mbus session object.voidSets the route to send all messages to when sending through this session.voidsetTraceLevel(int traceLevel) Sets the trace level used when sending messages through this session.update(com.yahoo.document.DocumentUpdate update) Updates a document.update(com.yahoo.document.DocumentUpdate update, DocumentOperationParameters parameters) Updates a document.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.yahoo.documentapi.AsyncSession
put, remove
-
Method Details
-
put
Description copied from interface:AsyncSessionPuts a document. This method returns immediately.
If this result is a success, this call will cause one or more
DocumentResponseobjects to appear within the timeout time of this session. The response returned later will either be a success, or contain the document submitted here. If it was not a success, this method has no further effects.- Specified by:
putin interfaceAsyncSession- Parameters:
document- the Document to put- Returns:
- the synchronous result of this operation
-
put
public Result put(com.yahoo.document.DocumentPut documentPut, DocumentOperationParameters parameters) Description copied from interface:AsyncSessionPuts a document, with optional conditions on the operation. This method returns immediately.
If this result is a success, this call will cause one or more
DocumentResponseobjects to appear within the timeout time of this session. The response returned later will either be a success, or contain the document submitted here. If it was not a success, this method has no further effects.- Specified by:
putin interfaceAsyncSession- Parameters:
documentPut- the DocumentPut to performparameters- parameters for the operation- Returns:
- the synchronous result of this operation
-
get
Description copied from interface:AsyncSessionGets a document. This method returns immediately.
If this result is a success, this call will cause one or more
DocumentResponseobjects to appear within the timeout time of this session. The response returned later will contain the requested document if it is a success. If it was not a success, this method has no further effects.- Specified by:
getin interfaceAsyncSession- Parameters:
id- the id of the document to get- Returns:
- the synchronous result of this operation
-
get
Description copied from interface:AsyncSessionGets a document. This method returns immediately.
If this result is a success, this call will cause one or more
DocumentResponseobjects to appear within the timeout time of this session. The response returned later will contain the requested document if it is a success. If it was not a success, this method has no further effects.- Specified by:
getin interfaceAsyncSession- Parameters:
id- the id of the document to getparameters- parameters for the operation- Returns:
- the synchronous result of this operation
-
remove
Description copied from interface:AsyncSessionRemoves a document if it is present. This method returns immediately.
If this result is a success, this call will cause one or more
RemoveResponseobjects to appear within the timeout time of this session. The response returned later will either be a success, or contain the document id submitted here. If it was not a success, this method has no further effects.- Specified by:
removein interfaceAsyncSession- Parameters:
id- the id of the document to remove- Returns:
- the synchronous result of this operation
-
remove
public Result remove(com.yahoo.document.DocumentRemove remove, DocumentOperationParameters parameters) Description copied from interface:AsyncSessionRemoves a document if it is present. This method returns immediately.
If this result is a success, this call will cause one or more
DocumentIdResponseobjects to appear within the timeout time of this session. The response returned later will either be a success, or contain the document id submitted here. If it was not a success, this method has no further effects.- Specified by:
removein interfaceAsyncSession- Parameters:
remove- the document remove operationparameters- parameters for the operation- Returns:
- the synchronous result of this operation
-
update
Description copied from interface:AsyncSessionUpdates a document. This method returns immediately.
If this result is a success, this call will cause one or more
DocumentUpdateResponsewithin the timeout time of this session. The returned response returned later will either be a success or contain the update submitted here. If it was not a success, this method has no further effects.- Specified by:
updatein interfaceAsyncSession- Parameters:
update- the updates to perform- Returns:
- the synchronous result of this operation
-
update
public Result update(com.yahoo.document.DocumentUpdate update, DocumentOperationParameters parameters) Description copied from interface:AsyncSessionUpdates a document. This method returns immediately.
If this result is a success, this call will cause one or more
DocumentUpdateResponsewithin the timeout time of this session. The returned response returned later will either be a success or contain the update submitted here. If it was not a success, this method has no further effects.- Specified by:
updatein interfaceAsyncSession- Parameters:
update- the updates to performparameters- parameters for the operation- Returns:
- the synchronous result of this operation
-
send
A convenience method for assigning the internal trace level and route string to a message before sending it through the internal mbus session object.- Parameters:
msg- the message to send.- Returns:
- the document api result object.
-
getNext
Description copied from interface:SessionReturns the next response of this session. This method returns immediately. -
getNext
Description copied from interface:SessionReturns the next response of this session. This will block until a response is ready or until the given timeout is reached- Specified by:
getNextin interfaceSession- Parameters:
timeoutMilliseconds- the max time to wait for a response.- 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:SessionDestroys this session and frees up any resources it has held. Making further calls on a destroyed session causes a runtime exception. -
getRoute
Description copied from interface:MessageBusSessionReturns the route to send all messages to when sending through this session.- Specified by:
getRoutein interfaceMessageBusSession- Returns:
- The route string.
-
setRoute
Description copied from interface:MessageBusSessionSets the route to send all messages to when sending through this session.- Specified by:
setRoutein interfaceMessageBusSession- Parameters:
route- The route string.
-
getTraceLevel
public int getTraceLevel()Description copied from interface:MessageBusSessionReturns the trace level used when sending messages through this session.- Specified by:
getTraceLevelin interfaceMessageBusSession- Returns:
- The trace level.
-
setTraceLevel
public void setTraceLevel(int traceLevel) Description copied from interface:MessageBusSessionSets the trace level used when sending messages through this session.- Specified by:
setTraceLevelin interfaceMessageBusSession- Parameters:
traceLevel- The trace level to set.
-
getCurrentWindowSize
public double getCurrentWindowSize()Description copied from interface:AsyncSessionReturns the current send window size of the session.- Specified by:
getCurrentWindowSizein interfaceAsyncSession- Returns:
- Returns the window size.
-