javax.management.remote.generic
Interface MessageConnection


public interface MessageConnection

Interface specifying the full-duplex transport used by each end of a Generic Connector connection to communicate with the other end.

An instance of this interface can be communicated to the Generic Connector using the attribute GenericConnector.MESSAGE_CONNECTION in the Map passed to the constructor or the connect method.


Method Summary
 void close()
          Terminates this object connection.
 void connect(Map env)
          Establish the connection.
 String getConnectionId()
          The ID for this connection.
 Message readMessage()
          Reads a Message object from the other end of the connection.
 void writeMessage(Message msg)
          Writes a Message object to the other end of the connection.
 

Method Detail

connect

void connect(Map env)
             throws IOException

Establish the connection. This method must be called before any other method of this interface. The behavior is unspecified if not.

Parameters:
env - the properties of the connection.
Throws:
IOException - if the connection cannot be made.

readMessage

Message readMessage()
                    throws IOException,
                           ClassNotFoundException

Reads a Message object from the other end of the connection.

Returns:
the message got from the other end of the connection.
Throws:
IOException - if a message could not be read because of a communication problem.
ClassNotFoundException - If the class of a serialized object cannot be found.

writeMessage

void writeMessage(Message msg)
                  throws IOException

Writes a Message object to the other end of the connection.

Parameters:
msg - the message to be written.
Throws:
IOException - if the message could not be written because of a communication problem.

close

void close()
           throws IOException

Terminates this object connection. After calling this method, any current or new call to readMessage or writeMessage(Message) should produce an IOException.

Throws:
IOException - if an I/O error occurs when closing the connection. A best effort will have been made to clean up the connection's resources. The caller will not call any other methods of this object after close(), whether or not it gets IOException.

getConnectionId

String getConnectionId()

The ID for this connection.

Returns:
the ID for this connection. This method can return null if the connection handshake is not yet complete.


Open Source build 02
opendmk-1.0-b02 2007.10.01_19:17:46_MEST

Copyright 1998-2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.