class CallableClientServer
extends java.lang.Object
CallableClient
instances.
There should usually be only one instance of this class for each
SampXmlRpcServer - see getInstance(org.astrogrid.samp.xmlrpc.SampXmlRpcServerFactory)
.Modifier and Type | Field and Description |
---|---|
private ClientXmlRpcHandler |
clientHandler_ |
private SampXmlRpcServer |
server_ |
private static java.util.Map |
serverMap_ |
private java.net.URL |
url_ |
Constructor and Description |
---|
CallableClientServer(SampXmlRpcServer server)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addClient(HubConnection connection,
CallableClient callable)
Adds a CallableClient object to this server.
|
void |
close()
Tidies up resources.
|
static CallableClientServer |
getInstance(SampXmlRpcServerFactory serverFact)
Returns an instance of CallableClientServer for use with a given
XML-RPC server.
|
java.net.URL |
getUrl()
Returns the XML-RPC endpoint for this server.
|
(package private) boolean |
hasClients()
Indicates whether this server currently has any clients.
|
void |
removeClient(HubConnection connection)
Removes a CallableClient object from this server.
|
private final java.net.URL url_
private SampXmlRpcServer server_
private ClientXmlRpcHandler clientHandler_
private static final java.util.Map serverMap_
public CallableClientServer(SampXmlRpcServer server) throws java.io.IOException
getInstance(org.astrogrid.samp.xmlrpc.SampXmlRpcServerFactory)
method exists as well.server
- XML-RPC server hosting this client serverjava.io.IOException
public java.net.URL getUrl()
public void addClient(HubConnection connection, CallableClient callable)
connection
- hub connection for the registered client on behalf
of which the client will operatecallable
- callable client objectpublic void removeClient(HubConnection connection)
privateKey
- hub connection for which this client was addedpublic void close()
boolean hasClients()
public static CallableClientServer getInstance(SampXmlRpcServerFactory serverFact) throws java.io.IOException
server
,
that one will be returned. Otherwise a new one will be constructed,
installed and returned.
To prevent memory leaks, once any clients added to the returned server have been removed (the client count drops to zero), the server will be closed and cannot be re-used.
server
- XML-RPC serverserver
java.io.IOException