|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
org.jminor.common.server.AbstractRemoteServer<T>
public abstract class AbstractRemoteServer<T extends Remote>
A default RemoteServer implementation.
Field Summary |
---|
Fields inherited from class java.rmi.server.RemoteObject |
---|
ref |
Fields inherited from interface org.jminor.common.server.RemoteServer |
---|
SERVER_ADMIN_PREFIX |
Constructor Summary | |
---|---|
AbstractRemoteServer(int serverPort,
String serverName)
Instantiates a new AbstractRemoteServer |
|
AbstractRemoteServer(int serverPort,
String serverName,
RMIClientSocketFactory clientSocketFactory,
RMIServerSocketFactory serverSocketFactory)
Instantiates a new AbstractRemoteServer |
Method Summary | |
---|---|
T |
connect(ClientInfo clientInfo)
Establishes a connection to this RemoteServer |
T |
connect(User user,
UUID clientID,
String clientTypeID)
Establishes a connection to this RemoteServer |
boolean |
connectionsAvailable()
|
boolean |
containsConnection(ClientInfo client)
|
void |
disconnect(UUID clientID)
Disconnects the connection identified by the given key. |
protected abstract T |
doConnect(ClientInfo clientInfo)
Establishes the actual client connection. |
protected abstract void |
doDisconnect(T connection)
Disconnects the given connection. |
T |
getConnection(ClientInfo client)
|
int |
getConnectionCount()
|
int |
getConnectionLimit()
|
Map<ClientInfo,T> |
getConnections()
|
String |
getServerName()
|
int |
getServerPort()
|
protected void |
handleShutdown()
Called after shutdown has finished |
boolean |
isShuttingDown()
|
void |
setConnectionLimit(int connectionLimit)
|
void |
setLoginProxy(LoginProxy loginProxy)
|
void |
shutdown()
Shuts down this server. |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
---|
clone, exportObject, exportObject, exportObject, unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
---|
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
---|
equals, getRef, hashCode, toString, toStub |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.jminor.common.server.RemoteServer |
---|
getServerLoad |
Constructor Detail |
---|
public AbstractRemoteServer(int serverPort, String serverName) throws RemoteException
serverPort
- the port on which the server should be exportedserverName
- the name used when exporting this server
RemoteException
- in case of an exceptionpublic AbstractRemoteServer(int serverPort, String serverName, RMIClientSocketFactory clientSocketFactory, RMIServerSocketFactory serverSocketFactory) throws RemoteException
serverPort
- the port on which the server should be exportedserverName
- the name used when exporting this serverclientSocketFactory
- the client socket factory to useserverSocketFactory
- the server socket factory to use
RemoteException
- in case of an exceptionMethod Detail |
---|
public final Map<ClientInfo,T> getConnections()
public final boolean containsConnection(ClientInfo client)
client
- the client info
public final T getConnection(ClientInfo client)
client
- the client info
public final int getConnectionCount()
public final int getConnectionLimit()
public final void setConnectionLimit(int connectionLimit)
connectionLimit
- the maximum number of concurrent connections accepted by this server,
a negative number means no limit while 0 means the server is closed.public final boolean connectionsAvailable() throws RemoteException
connectionsAvailable
in interface RemoteServer<T extends Remote>
RemoteException
- in case of an exceptionpublic final T connect(User user, UUID clientID, String clientTypeID) throws RemoteException, ServerException.ServerFullException, ServerException.LoginException
connect
in interface RemoteServer<T extends Remote>
user
- the userclientID
- a UUID identifying the clientclientTypeID
- a String identifying the client
RemoteException
- in case of a RemoteException
ServerException.ServerFullException
- in case the server isn't accepting more connections
ServerException.LoginException
- in case the login failspublic final T connect(ClientInfo clientInfo) throws RemoteException, ServerException.ServerFullException, ServerException.LoginException
connect
in interface RemoteServer<T extends Remote>
clientInfo
- the client info
RemoteException
- in case of a RemoteException
ServerException.ServerFullException
- in case the server isn't accepting more connections
ServerException.LoginException
- in case the login failspublic final void disconnect(UUID clientID) throws RemoteException
disconnect
in interface RemoteServer<T extends Remote>
clientID
- the UUID identifying the client that should be disconnected
RemoteException
- in case of a communication errorpublic final String getServerName()
getServerName
in interface RemoteServer<T extends Remote>
public final int getServerPort()
getServerPort
in interface RemoteServer<T extends Remote>
public final void setLoginProxy(LoginProxy loginProxy)
loginProxy
- the login proxypublic final boolean isShuttingDown()
public final void shutdown() throws RemoteException
RemoteException
- in case of an exceptionprotected void handleShutdown() throws RemoteException
RemoteException
- in case of an exceptionprotected abstract T doConnect(ClientInfo clientInfo) throws RemoteException
clientInfo
- the client info
RemoteException
- in case of an exceptionprotected abstract void doDisconnect(T connection) throws RemoteException
connection
- the connection to disconnect
RemoteException
- in case of an exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |