com.sun.jaw.impl.adaptor.udp
Class AdaptorClient

java.lang.Object
  |
  +--com.sun.jaw.impl.adaptor.comm.AdaptorClient
        |
        +--com.sun.jaw.impl.adaptor.udp.AdaptorClient

public class AdaptorClient
extends AdaptorClient

The AdaptorClient class provides an implementation of the AdaptorMO interface based on the HTTP/UDP protocol.

Querying a Java Dynamic Management agent with the HTTP/UDP adaptor implies that an instance of AdaptorServerImpl is running on the remote Java Dynamic Management agent.

In order to identify the Java Dynamic Management agent the adaptor needs to communicate with, the method connect needs to be invoked.

It is possible to request the use of a specific proxy. To do so, once the object is instantiated, you need to call the setup method with a string containing the hostname and optionally a port number. By default the port 8083 will be used to communicate with the adaptor.

See Also:
AdaptorMO, AdaptorServerImpl, Serialized Form

Constructor Summary
AdaptorClient()
          Constructs an HTTP/UDP adaptor client.
 
Method Summary
 void connect(java.lang.Object context, java.lang.String host, int port, java.lang.String logicalName)
          Initializes the communication with the remote Java Dynamic Management agent.
protected  java.io.InputStream doReceive(AdaptorSocket sckt, boolean heartBeat)
          Calls the doReceive method on the specified adaptor socket.
 
Methods inherited from class com.sun.jaw.impl.adaptor.comm.AdaptorClient
cb_connect, cb_disconnect, cb_newDBMO, cb_newDBMO, cb_newMO, cb_newMO, deleteMO, disconnect, getAdaptorVersion, getClassLoader, getClassVersion, getClientVersion, getDomain, getIndexedValue, getMapperSrv, getObject, getObjectFromCache, getOnlyNames, getServerVersion, getTimeoutMilliSeconds, getValue, getValues, invokePerform, isConnected, newDBMO, newDBMO, newMO, newMO, newObj, newObj, setClassLoader, setIndexedValue, setMapperSrv, setTimeoutMilliSeconds, setup, setValue, setValues, transferObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdaptorClient

public AdaptorClient()
Constructs an HTTP/UDP adaptor client.
Method Detail

connect

public void connect(java.lang.Object context,
                    java.lang.String host,
                    int port,
                    java.lang.String logicalName)
Initializes the communication with the remote Java Dynamic Management agent.

As UDP is connectionless, we must detect asap that the server is not responding. So we modify the timoeut to a "not too short, not too long" value.

Parameters:
context - used to provide the client's authentication info.
host - host name of the server.
port - port number of the server.
logicalName - logical name of the server.
Throws:
CommunicationException - if there is a communication problem with the remote Managed Object Server.
UnauthorizedSecurityException - if the server cannot authenticate the client because the to client's authentication info is invalid.
Overrides:
connect in class AdaptorClient

doReceive

protected java.io.InputStream doReceive(AdaptorSocket sckt,
                                        boolean heartBeat)
                                 throws java.io.IOException
Calls the doReceive method on the specified adaptor socket.

As UDP is connectionless, we must detect asap that the server is not responding. Instead of waiting for an incoming message for a long timeout, the timeout is chopped into "small" chunks. When a timeout arises, we just check if the server is dead. If not, we go back waiting. Otherwise, we declare that the connection to the server has been lost.

Parameters:
sckt - The adaptor socket.
heartBeat - Checking cycle is active.
Returns:
The input stream for the specified adaptor socket.
Throws:
java.io.IOException - Signals that an I/O exception of some sort has occurred.
Overrides:
doReceive in class AdaptorClient