Package com.mongodb.internal.connection
Interface InternalConnection
-
- All Superinterfaces:
BufferProvider
- All Known Implementing Classes:
InternalStreamConnection
public interface InternalConnection extends BufferProvider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Closes the connection.ConnectionDescriptiongetDescription()Gets the description of this connection.booleanisClosed()Returns the closed state of the connectionvoidopen()Opens the connection so its ready for usevoidopenAsync(SingleResultCallback<java.lang.Void> callback)Opens the connection so its ready for usebooleanopened()Returns if the connection has been openedResponseBuffersreceiveMessage(int responseTo)Receive a response to a sent message from the server.voidreceiveMessageAsync(int responseTo, SingleResultCallback<ResponseBuffers> callback)Asynchronously receive a response to a sent message from the server.<T> TsendAndReceive(CommandMessage message, Decoder<T> decoder, SessionContext sessionContext)Send a command message to the server.<T> voidsendAndReceiveAsync(CommandMessage message, Decoder<T> decoder, SessionContext sessionContext, SingleResultCallback<T> callback)Send a command message to the server.voidsendMessage(java.util.List<ByteBuf> byteBuffers, int lastRequestId)Send a message to the server.voidsendMessageAsync(java.util.List<ByteBuf> byteBuffers, int lastRequestId, SingleResultCallback<java.lang.Void> callback)Asynchronously send a message to the server.-
Methods inherited from interface com.mongodb.connection.BufferProvider
getBuffer
-
-
-
-
Method Detail
-
getDescription
ConnectionDescription getDescription()
Gets the description of this connection.- Returns:
- the connection description
-
open
void open()
Opens the connection so its ready for use
-
openAsync
void openAsync(SingleResultCallback<java.lang.Void> callback)
Opens the connection so its ready for use- Parameters:
callback- the callback to be called once the connection has been opened
-
close
void close()
Closes the connection.
-
opened
boolean opened()
Returns if the connection has been opened- Returns:
- true if connection has been opened
-
isClosed
boolean isClosed()
Returns the closed state of the connection- Returns:
- true if connection is closed
-
sendAndReceive
<T> T sendAndReceive(CommandMessage message, Decoder<T> decoder, SessionContext sessionContext)
Send a command message to the server.- Parameters:
message- the command message to sendsessionContext- the session context
-
sendAndReceiveAsync
<T> void sendAndReceiveAsync(CommandMessage message, Decoder<T> decoder, SessionContext sessionContext, SingleResultCallback<T> callback)
Send a command message to the server.- Parameters:
message- the command message to sendsessionContext- the session contextcallback- the callback
-
sendMessage
void sendMessage(java.util.List<ByteBuf> byteBuffers, int lastRequestId)
Send a message to the server. The connection may not make any attempt to validate the integrity of the message.- Parameters:
byteBuffers- the list of byte buffers to send.lastRequestId- the request id of the last message in byteBuffers
-
receiveMessage
ResponseBuffers receiveMessage(int responseTo)
Receive a response to a sent message from the server.- Parameters:
responseTo- the request id that this message is a response to- Returns:
- the response
-
sendMessageAsync
void sendMessageAsync(java.util.List<ByteBuf> byteBuffers, int lastRequestId, SingleResultCallback<java.lang.Void> callback)
Asynchronously send a message to the server. The connection may not make any attempt to validate the integrity of the message.- Parameters:
byteBuffers- the list of byte buffers to sendlastRequestId- the request id of the last message in byteBufferscallback- the callback to invoke on completion
-
receiveMessageAsync
void receiveMessageAsync(int responseTo, SingleResultCallback<ResponseBuffers> callback)Asynchronously receive a response to a sent message from the server.- Parameters:
responseTo- the request id that this message is a response tocallback- the callback to invoke on completion
-
-