public interface Connection
Represents a connection that uses the Ice protocol.
-
Method Summary
Modifier and TypeMethodDescriptionReturns a description of the connection as human readable text, suitable for logging or error messages.voidabort()Aborts this connection.voidclose()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.voidDisables the inactivity check on this connection.voidflushBatchRequests(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()Returns the connection information.voidsetAdapter(ObjectAdapter adapter) Associates an object adapter with this connection.voidsetBufferSize(int rcvSize, int sndSize) Sets the size of the receive and send buffers.voidsetCloseCallback(CloseCallback callback) Sets a close callback on the connection.voidThrows an exception that provides the reason for the closure of this connection.type()Returns 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 this 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()Returns the connection type. This corresponds to the endpoint type, such as "tcp", "udp", etc.- Returns:
- the type of the connection
-
_toString
String _toString()Returns 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()Returns 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 buffersndSize- 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 throwsCloseConnectionExceptionwhen the connection was closed gracefully by the peer; it throwsConnectionAbortedExceptionwhen the connection is aborted withabort(). This method does nothing if the connection is not yet closed.
-