Package com.yahoo.documentapi.messagebus
Class MessageBusSyncSession
java.lang.Object
com.yahoo.documentapi.messagebus.MessageBusSyncSession
- All Implemented Interfaces:
MessageBusSession,Session,SyncSession,com.yahoo.messagebus.ReplyHandler
public class MessageBusSyncSession
extends Object
implements MessageBusSession, SyncSession, com.yahoo.messagebus.ReplyHandler
An implementation of the SyncSession interface running over message bus.
- Author:
- Simon Thoresen Hult, bjorncs
-
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroys this session and frees up any resources it has held.com.yahoo.document.Documentget(com.yahoo.document.DocumentId id, DocumentOperationParameters parameters, Duration timeout) Gets a document with timeout.com.yahoo.document.DocumentGets a document with timeout.getNext()Returns the next response of this session.getNext(int timeout) 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.voidhandleReply(com.yahoo.messagebus.Reply reply) voidput(com.yahoo.document.DocumentPut documentPut) Puts a document.voidput(com.yahoo.document.DocumentPut documentPut, DocumentOperationParameters parameters) Puts a document.booleanremove(com.yahoo.document.DocumentRemove documentRemove) Removes a document if it is present and condition is fulfilled.booleanremove(com.yahoo.document.DocumentRemove documentRemove, DocumentOperationParameters parameters) Removes a document if it is present.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.com.yahoo.messagebus.ReplysyncSend(com.yahoo.messagebus.Message msg) Perform a synchronous sending of a message.booleanupdate(com.yahoo.document.DocumentUpdate update) Updates a document.booleanupdate(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.SyncSession
get
-
Method Details
-
handleReply
public void handleReply(com.yahoo.messagebus.Reply reply) - Specified by:
handleReplyin interfacecom.yahoo.messagebus.ReplyHandler
-
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 -
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. -
syncSend
public com.yahoo.messagebus.Reply syncSend(com.yahoo.messagebus.Message msg) Perform a synchronous sending of a message. This method block until the message is successfuly sent and a corresponding reply has been received.- Parameters:
msg- The message to send.- Returns:
- The reply received.
-
put
public void put(com.yahoo.document.DocumentPut documentPut) Description copied from interface:SyncSessionPuts a document. When this method returns, the document is safely received. This enables setting condition compared to using Document.- Specified by:
putin interfaceSyncSession- Parameters:
documentPut- the DocumentPut operation
-
put
Description copied from interface:SyncSessionPuts a document. When this method returns, the document is safely received.- Specified by:
putin interfaceSyncSession- Parameters:
documentPut- the DocumentPut operationparameters- parameters for the operation
-
get
Description copied from interface:SyncSessionGets a document with timeout.- Specified by:
getin interfaceSyncSession- Parameters:
id- the id of the document to gettimeout- timeout. If timeout is null, an unspecified default will be used- Returns:
- the document with this id, or null if there is none
-
get
public com.yahoo.document.Document get(com.yahoo.document.DocumentId id, DocumentOperationParameters parameters, Duration timeout) Description copied from interface:SyncSessionGets a document with timeout.- Specified by:
getin interfaceSyncSession- Parameters:
id- the id of the document to getparameters- parameters for the operationtimeout- timeout. If timeout is null, an unspecified default will be used- Returns:
- the known document having this id, or null if there is no document having this id
-
remove
public boolean remove(com.yahoo.document.DocumentRemove documentRemove) Description copied from interface:SyncSessionRemoves a document if it is present and condition is fulfilled.- Specified by:
removein interfaceSyncSession- Parameters:
documentRemove- document to delete- Returns:
- true if the document with this id was removed, false otherwise
-
remove
public boolean remove(com.yahoo.document.DocumentRemove documentRemove, DocumentOperationParameters parameters) Description copied from interface:SyncSessionRemoves a document if it is present.- Specified by:
removein interfaceSyncSession- Parameters:
documentRemove- document remove operationparameters- parameters for the operation- Returns:
- true if the document with this id was removed, false otherwise.
-
update
public boolean update(com.yahoo.document.DocumentUpdate update) Description copied from interface:SyncSessionUpdates a document.- Specified by:
updatein interfaceSyncSession- Parameters:
update- the updates to perform- Returns:
- false if the updates could not be applied as the document does not exist and
create-if-non-existentis not set.
-
update
public boolean update(com.yahoo.document.DocumentUpdate update, DocumentOperationParameters parameters) Description copied from interface:SyncSessionUpdates a document.- Specified by:
updatein interfaceSyncSession- Parameters:
update- the updates to perform.parameters- parameters for the operation- Returns:
- false if the updates could not be applied as the document does not exist and
create-if-non-existentis not set.
-
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.
-