@NotThreadSafe public class InternalStreamConnection extends java.lang.Object implements InternalConnection
| Constructor and Description |
|---|
InternalStreamConnection(ServerId serverId,
StreamFactory streamFactory,
java.util.List<MongoCompressor> compressorList,
CommandListener commandListener,
com.mongodb.internal.connection.InternalConnectionInitializer connectionInitializer) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the connection.
|
ByteBuf |
getBuffer(int size)
Gets a buffer with the givens capacity.
|
ConnectionDescription |
getDescription()
Gets the description of this connection.
|
boolean |
isClosed()
Returns the closed state of the connection
|
void |
open()
Opens the connection so its ready for use
|
void |
openAsync(SingleResultCallback<java.lang.Void> callback)
Opens the connection so its ready for use
|
boolean |
opened()
Returns if the connection has been opened
|
ResponseBuffers |
receiveMessage(int responseTo)
Receive a response to a sent message from the server.
|
void |
receiveMessageAsync(int responseTo,
SingleResultCallback<ResponseBuffers> callback)
Asynchronously receive a response to a sent message from the server.
|
<T> T |
sendAndReceive(CommandMessage message,
Decoder<T> decoder,
SessionContext sessionContext)
Send a command message to the server.
|
<T> void |
sendAndReceiveAsync(CommandMessage message,
Decoder<T> decoder,
SessionContext sessionContext,
SingleResultCallback<T> callback)
Send a command message to the server.
|
void |
sendMessage(java.util.List<ByteBuf> byteBuffers,
int lastRequestId)
Send a message to the server.
|
void |
sendMessageAsync(java.util.List<ByteBuf> byteBuffers,
int lastRequestId,
SingleResultCallback<java.lang.Void> callback)
Asynchronously send a message to the server.
|
public InternalStreamConnection(ServerId serverId, StreamFactory streamFactory, java.util.List<MongoCompressor> compressorList, CommandListener commandListener, com.mongodb.internal.connection.InternalConnectionInitializer connectionInitializer)
public ConnectionDescription getDescription()
InternalConnectiongetDescription in interface InternalConnectionpublic void open()
InternalConnectionopen in interface InternalConnectionpublic void openAsync(SingleResultCallback<java.lang.Void> callback)
InternalConnectionopenAsync in interface InternalConnectioncallback - the callback to be called once the connection has been openedpublic void close()
InternalConnectionclose in interface InternalConnectionpublic boolean opened()
InternalConnectionopened in interface InternalConnectionpublic boolean isClosed()
InternalConnectionisClosed in interface InternalConnectionpublic <T> T sendAndReceive(CommandMessage message, Decoder<T> decoder, SessionContext sessionContext)
InternalConnectionsendAndReceive in interface InternalConnectionmessage - the command message to sendsessionContext - the session contextpublic <T> void sendAndReceiveAsync(CommandMessage message, Decoder<T> decoder, SessionContext sessionContext, SingleResultCallback<T> callback)
InternalConnectionsendAndReceiveAsync in interface InternalConnectionmessage - the command message to sendsessionContext - the session contextcallback - the callbackpublic void sendMessage(java.util.List<ByteBuf> byteBuffers, int lastRequestId)
InternalConnectionsendMessage in interface InternalConnectionbyteBuffers - the list of byte buffers to send.lastRequestId - the request id of the last message in byteBufferspublic ResponseBuffers receiveMessage(int responseTo)
InternalConnectionreceiveMessage in interface InternalConnectionresponseTo - the request id that this message is a response topublic void sendMessageAsync(java.util.List<ByteBuf> byteBuffers, int lastRequestId, SingleResultCallback<java.lang.Void> callback)
InternalConnectionsendMessageAsync in interface InternalConnectionbyteBuffers - the list of byte buffers to sendlastRequestId - the request id of the last message in byteBufferscallback - the callback to invoke on completionpublic void receiveMessageAsync(int responseTo,
SingleResultCallback<ResponseBuffers> callback)
InternalConnectionreceiveMessageAsync in interface InternalConnectionresponseTo - the request id that this message is a response tocallback - the callback to invoke on completionpublic ByteBuf getBuffer(int size)
BufferProvidergetBuffer in interface BufferProvidersize - the size required for the bufferCopyright © 2010 - 2023 Adobe. All Rights Reserved