public class ClientConnection extends CrtResource
CrtResource.ResourceInstance| Modifier and Type | Method and Description |
|---|---|
protected boolean |
canReleaseReferencesImmediately()
Override that determines whether a resource releases its dependencies at the same time the native handle is released or if it waits.
|
void |
closeConnection(int shutdownErrorCode)
Closes the connection if it hasn't been closed already.
|
static CompletableFuture<Void> |
connect(String hostName,
short port,
SocketOptions socketOptions,
ClientTlsContext tlsContext,
ClientBootstrap bootstrap,
ClientConnectionHandler connectionHandler)
Initiates a new outgoing event-stream-rpc connection.
|
CompletableFuture<Integer> |
getClosedFuture() |
boolean |
isOpen() |
ClientConnectionContinuation |
newStream(ClientConnectionContinuationHandler continuationHandler)
Create a new stream.
|
protected void |
releaseNativeHandle()
Required override method that must begin the release process of the acquired native handle
|
CompletableFuture<Void> |
sendProtocolMessage(List<Header> headers,
byte[] payload,
MessageType messsageType,
int messageFlags)
Sends a protocol message on the connection.
|
void |
sendProtocolMessage(List<Header> headers,
byte[] payload,
MessageType messsageType,
int messageFlags,
MessageFlushCallback callback)
Sends a protocol message on the connection.
|
acquireNativeHandle, addRef, addReferenceTo, close, collectNativeResource, collectNativeResources, decRef, getNativeHandle, getResourceLogDescription, isNull, logNativeResources, releaseReferences, removeReferenceTo, setDescription, swapReferenceTo, waitForNoResourcespublic void closeConnection(int shutdownErrorCode)
shutdownErrorCode - aws-c-* error code to shutdown with. Specify 0 for success.public boolean isOpen()
public CompletableFuture<Void> sendProtocolMessage(List<Header> headers, byte[] payload, MessageType messsageType, int messageFlags)
headers - List of event-stream headers. Can be null.payload - Payload to send for the message. Can be null.messsageType - Message type for the rpc message.messageFlags - Union of message flags from MessageFlags.getByteValue()public void sendProtocolMessage(List<Header> headers, byte[] payload, MessageType messsageType, int messageFlags, MessageFlushCallback callback)
headers - List of event-stream headers. Can be null.payload - Payload to send for the message. Can be null.messsageType - Message type for the rpc message.messageFlags - Union of message flags from MessageFlags.getByteValue()callback - will be invoked upon the message flushing to the underlying transportpublic ClientConnectionContinuation newStream(ClientConnectionContinuationHandler continuationHandler)
continuationHandler - handler to process continuation messages and state changes.public static CompletableFuture<Void> connect(String hostName, short port, SocketOptions socketOptions, ClientTlsContext tlsContext, ClientBootstrap bootstrap, ClientConnectionHandler connectionHandler)
hostName - hostname to connect to, this can be an IPv4 address, IPv6 address, a local socket address, or a
dns name.port - port to connect to hostName with. For local socket address, this value is ignored.socketOptions - socketOptions to use.tlsContext - (optional) tls context to use for using SSL/TLS in the connection.bootstrap - clientBootstrap object to run the connection on.connectionHandler - handler to process connection messages and state changes.public CompletableFuture<Integer> getClosedFuture()
protected void releaseNativeHandle()
CrtResourcereleaseNativeHandle in class CrtResourceprotected boolean canReleaseReferencesImmediately()
CrtResourcecanReleaseReferencesImmediately in class CrtResourceCopyright © 2021. All rights reserved.