public interface Connection
The user-level interface to a connection.
-
Method Summary
Modifier and TypeMethodDescriptionGets a description of the connection as human readable text, suitable for logging or error messages.void
abort()
Aborts this connection.void
close()
Closes the connection gracefully after waiting for all outstanding invocations to complete.createProxy
(Identity id) Creates a special proxy (a "fixed proxy") that always uses this connection.void
Disables the inactivity check on this connection.void
flushBatchRequests
(CompressBatch compress) Flushes any pending batch requests for this connection.flushBatchRequestsAsync
(CompressBatch compress) Flushes any pending batch requests for this connection.Gets the object adapter associated with this connection.Gets the endpoint from which the connection was created.getInfo()
Gets the connection information.void
setAdapter
(ObjectAdapter adapter) Associates an object adapter with this connection.void
setBufferSize
(int rcvSize, int sndSize) Sets the size of the receive and send buffers.void
setCloseCallback
(CloseCallback callback) Sets a close callback on the connection.void
Throws an exception that provides the reason for the closure of this connection.type()
Gets the connection type.
-
Method Details
-
abort
void abort()Aborts this connection. -
close
void close()Closes the connection gracefully after waiting for all outstanding invocations to complete. This method blocks until the connection has been closed, or if it takes longer than the configured close timeout, the connection is aborted with aCloseTimeoutException
. -
createProxy
Creates a special proxy (a "fixed proxy") that always uses this connection.- Parameters:
id
- The identity of the target object.- Returns:
- A fixed proxy with the provided identity.
- See Also:
-
setAdapter
Associates an object adapter with this connection. When a connection receives a request, it dispatches this request using its associated object adapter. If the associated object adapter is null, the connection rejects any incoming request with anObjectNotExistException
. The default object adapter of an incoming connection is the object adapter that created this connection; the default object adapter of an outgoing connection is the communicator's default object adapter.- Parameters:
adapter
- The object adapter to associate with the connection.- See Also:
-
getAdapter
ObjectAdapter getAdapter()Gets the object adapter associated with this connection.- Returns:
- The object adapter associated with this connection.
- See Also:
-
getEndpoint
Endpoint getEndpoint()Gets the endpoint from which the connection was created.- Returns:
- The endpoint from which the connection was created.
-
flushBatchRequests
Flushes any pending batch requests for this connection. This corresponds to all batch requests invoked on fixed proxies associated with the connection.- Parameters:
compress
- Specifies whether or not the queued batch requests should be compressed before being sent over the wire.
-
flushBatchRequestsAsync
Flushes any pending batch requests for this connection. This corresponds to all batch requests invoked on fixed proxies associated with the connection.- Parameters:
compress
- Specifies whether or not the queued batch requests should be compressed before being sent over the wire.- Returns:
- A future that becomes available when the flush completes.
-
setCloseCallback
Sets a close callback on the connection. The callback is called by the connection when it's closed. The callback is called from the Ice thread pool associated with the connection.- Parameters:
callback
- The close callback object.
-
disableInactivityCheck
void disableInactivityCheck()Disables the inactivity check on this connection. -
type
String type()Gets the connection type. This corresponds to the endpoint type, such as "tcp", "udp", etc.- Returns:
- The type of the connection.
-
_toString
String _toString()Gets a description of the connection as human readable text, suitable for logging or error messages. This method remains usable after the connection is closed or aborted.- Returns:
- The description of the connection as human readable text.
-
getInfo
ConnectionInfo getInfo()Gets the connection information.- Returns:
- The connection information.
-
setBufferSize
void setBufferSize(int rcvSize, int sndSize) Sets the size of the receive and send buffers.- Parameters:
rcvSize
- The size of the receive buffer.sndSize
- The size of the send buffer.
-
throwException
void throwException()Throws an exception that provides the reason for the closure of this connection. For example, this method throws CloseConnectionException when the connection was closed gracefully by the peer; it throws ConnectionAbortedException when the connection is aborted. This method does nothing if the connection is not yet closed.
-