org.apache.yoko.orb.OCI
Interface TransportOperations

All Known Subinterfaces:
Transport
All Known Implementing Classes:
Transport_impl

public interface TransportOperations

The interface for a Transport object, which provides operations for sending and receiving octet streams. In addition, it is possible to register callbacks with the Transport object, which are invoked whenever data can be sent or received without blocking.

See Also:
Connector, Acceptor

Method Summary
 void close()
          Closes the Transport.
 TransportInfo get_info()
          Returns the information object associated with the Transport.
 int handle()
          The "handle" for this Transport.
 String id()
          The plugin id.
 SendReceiveMode mode()
          The send/receive capabilities of this Transport.
 boolean receive_detect(Buffer buf, boolean block)
          Similar to receive, but it signals a connection loss by returning FALSE instead of raising COMM_FAILURE.
 boolean receive_timeout_detect(Buffer buf, int timeout)
          Similar to receive_timeout, but it signals a connection loss by returning FALSE instead of raising COMM_FAILURE.
 void receive_timeout(Buffer buf, int timeout)
          Similar to receive, but it is possible to specify a timeout.
 void receive(Buffer buf, boolean block)
          Receives a buffer's contents.
 boolean send_detect(Buffer buf, boolean block)
          Similar to send, but it signals a connection loss by returning FALSE instead of raising COMM_FAILURE.
 boolean send_timeout_detect(Buffer buf, int timeout)
          Similar to send_timeout, but it signals a connection loss by returning FALSE instead of raising COMM_FAILURE.
 void send_timeout(Buffer buf, int timeout)
          Similar to send, but it is possible to specify a timeout.
 void send(Buffer buf, boolean block)
          Sends a buffer's contents.
 void shutdown()
          Shutdown the Transport.
 int tag()
          The profile id tag.
 

Method Detail

id

String id()
The plugin id.


tag

int tag()
The profile id tag.


mode

SendReceiveMode mode()
The send/receive capabilities of this Transport.


handle

int handle()
The "handle" for this Transport. The handle may only be used to determine whether the Transport object is ready to send or to receive data, e.g., with select() on Unix-based operating systems. All other uses (e.g., calls to read(), write(), close()) are strictly non-compliant. A handle value of -1 indicates that the protocol plug-in does not support "selectable" Transports.


close

void close()
Closes the Transport. After calling close, no operations on this Transport object and its associated TransportInfo object may be called. To ensure that no messages get lost when close is called, shutdown should be called first. Then dummy data should be read from the Transport, using one of the receive operations, until either an exception is raised, or until connection closure is detected. After that its save to call close, i.e., no messages can get lost.

Throws:
COMM_FAILURE - In case of an error.

shutdown

void shutdown()
Shutdown the Transport. Upon a successful shutdown, threads blocking in the receive operations will return or throw an exception. After calling shutdown, no operations on associated TransportInfo object may be called. To fully close the Transport, close must be called.

Throws:
COMM_FAILURE - In case of an error.

receive

void receive(Buffer buf,
             boolean block)
Receives a buffer's contents.

Parameters:
buf - The buffer to fill.
block - If set to TRUE, the operation blocks until the buffer is full. If set to FALSE, the operation fills as much of the buffer as possible without blocking.
Throws:
COMM_FAILURE - In case of an error.

receive_detect

boolean receive_detect(Buffer buf,
                       boolean block)
Similar to receive, but it signals a connection loss by returning FALSE instead of raising COMM_FAILURE.

Parameters:
buf - The buffer to fill.
block - If set to TRUE, the operation blocks until the buffer is full. If set to FALSE, the operation fills as much of the buffer as possible without blocking.
Returns:
FALSE if a connection loss is detected, TRUE otherwise.
Throws:
COMM_FAILURE - In case of an error.

receive_timeout

void receive_timeout(Buffer buf,
                     int timeout)
Similar to receive, but it is possible to specify a timeout. On return the caller can test whether there was a timeout by checking if the buffer has been filled completely.

Parameters:
buf - The buffer to fill.
timeout - The timeout value in milliseconds. A zero timeout is equivalent to calling receive(buf, FALSE).
Throws:
COMM_FAILURE - In case of an error.

receive_timeout_detect

boolean receive_timeout_detect(Buffer buf,
                               int timeout)
Similar to receive_timeout, but it signals a connection loss by returning FALSE instead of raising COMM_FAILURE.

Parameters:
buf - The buffer to fill.
timeout - The timeout value in milliseconds. A zero timeout is equivalent to calling receive(buf, FALSE).
Returns:
FALSE if a connection loss is detected, TRUE otherwise.
Throws:
COMM_FAILURE - In case of an error.

send

void send(Buffer buf,
          boolean block)
Sends a buffer's contents.

Parameters:
buf - The buffer to send.
block - If set to TRUE, the operation blocks until the buffer has completely been sent. If set to FALSE, the operation sends as much of the buffer's data as possible without blocking.
Throws:
COMM_FAILURE - In case of an error.

send_detect

boolean send_detect(Buffer buf,
                    boolean block)
Similar to send, but it signals a connection loss by returning FALSE instead of raising COMM_FAILURE.

Parameters:
buf - The buffer to fill.
block - If set to TRUE, the operation blocks until the entire buffer has been sent. If set to FALSE, the operation sends as much of the buffer's data as possible without blocking.
Returns:
FALSE if a connection loss is detected, TRUE otherwise.
Throws:
COMM_FAILURE - In case of an error.

send_timeout

void send_timeout(Buffer buf,
                  int timeout)
Similar to send, but it is possible to specify a timeout. On return the caller can test whether there was a timeout by checking if the buffer has been sent completely.

Parameters:
buf - The buffer to send.
timeout - The timeout value in milliseconds. A zero timeout is equivalent to calling send(buf, FALSE).
Throws:
COMM_FAILURE - In case of an error.

send_timeout_detect

boolean send_timeout_detect(Buffer buf,
                            int timeout)
Similar to send_timeout, but it signals a connection loss by returning FALSE instead of raising COMM_FAILURE.

Parameters:
buf - The buffer to fill.
timeout - The timeout value in milliseconds. A zero timeout is equivalent to calling send(buf, FALSE).
Returns:
FALSE if a connection loss is detected, TRUE otherwise.
Throws:
COMM_FAILURE - In case of an error.

get_info

TransportInfo get_info()
Returns the information object associated with the Transport.

Returns:
The Transport information object.


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.