|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sourceforge.jemm.comm.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.
Released under the Apache License V2.0 license by the JEMM Project
| Field Summary | |
|---|---|
protected boolean |
connected
|
protected ClientConnectionFactory |
connFactory
|
protected java.util.Map<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 |
LOG
|
protected RPCHandler |
rpcHandler
The underlying RPCHandler (calls are delegated) |
protected java.util.concurrent.ExecutorService |
threadPool
A thread pool for handling server callback requests |
| Constructor Summary | |
|---|---|
RPCClient(ClientConnectionFactory connFactory)
Creates o RPCClient instance using the given connection factory. |
|
RPCClient(java.lang.String hostname,
int port)
Creates an RPCClient instance. |
|
| 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 LOG
protected java.util.Map<java.lang.Class<?>,java.lang.Object> localIFMap
protected RPCHandler rpcHandler
protected java.util.concurrent.ExecutorService threadPool
protected volatile boolean connected
protected final ClientConnectionFactory connFactory
| Constructor Detail |
|---|
public RPCClient(java.lang.String hostname,
int port)
hostname - The servers hostnameport - The server's portpublic RPCClient(ClientConnectionFactory connFactory)
connFactory - The connection factory to use to connect to the RPCServer.| Method Detail |
|---|
public void connect()
throws ConnectionException
ConnectionException - 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 | |||||||||