|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sourceforge.jemmrpc.client.RPCClient
public class RPCClient
RPCClient is the client end of an interface RPC connection. The class allows the client program
to both make RPC calls to a server instance and also present interfaces for the server to call
back on. See EchoClient/EchoServer for a simple example.
| Field Summary | |
|---|---|
protected boolean |
connected
|
protected java.lang.String |
hostname
The server hostname |
protected java.util.HashMap<java.lang.Class<?>,java.lang.Object> |
localIFMap
A map of the local interfaces offered by the client to the server |
protected static org.apache.log4j.Logger |
logger
|
protected int |
port
The server port |
protected RPCHandler |
rpcHandler
The underlying RPCHandler (calls are delegated) |
protected java.net.Socket |
socket
The connection socket |
protected java.util.concurrent.ExecutorService |
threadPool
A thread pool for handling server callback requests |
| Constructor Summary | |
|---|---|
RPCClient(java.lang.String hostname,
int port)
Creates an instance of Client. |
|
| Method Summary | |
|---|---|
void |
close()
Close the connection to the server. |
void |
connect()
Make the connection to the remote server. |
void |
connectionTerminated()
Notification that the RPCHandler has had the connection terminated. |
java.lang.Object |
getServerIF(java.lang.Class<?> ifClass)
Get a remote interface implemented by the server. |
boolean |
isConnected()
Returns whether the client is connected to the server |
void |
registerIF(java.lang.Class<?> ifClass,
java.lang.Object ifImplentor)
Register an interface that the client offers for callback from the server. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.log4j.Logger logger
protected java.util.HashMap<java.lang.Class<?>,java.lang.Object> localIFMap
protected java.lang.String hostname
protected int port
protected java.net.Socket socket
protected RPCHandler rpcHandler
protected java.util.concurrent.ExecutorService threadPool
protected volatile boolean connected
| Constructor Detail |
|---|
public RPCClient(java.lang.String hostname,
int port)
hostname - The servers hostnameport - The server's port| Method Detail |
|---|
public void connect()
throws java.io.IOException
java.io.IOException - On connection error.
public void registerIF(java.lang.Class<?> ifClass,
java.lang.Object ifImplentor)
ifClass - The interface being offered.ifImplentor - The implementor of the interface that will process the requestspublic java.lang.Object getServerIF(java.lang.Class<?> ifClass)
ifClass - The interface required.
public void close()
public boolean isConnected()
public void connectionTerminated()
RPCHandlerListener
connectionTerminated in interface RPCHandlerListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||