|
Parsing Engine | |||||||||
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
danbikel.switchboard.AbstractSwitchboardUser
danbikel.switchboard.AbstractServer
public abstract class AbstractServer
Provides a convenient default implementation of the Server
interface, allowing subclasses to focus solely on the services they will
provide to clients.
N.B.: Subclasses should take care to properly call the
AbstractSwitchboardUser.unexportWhenDead
method.
A note on fault tolerance: In order to ensure the
fault-tolerance of clients, subclasses should ensure that they use
socket factories that set the SO_TIMEOUT values of their
TCP/IP sockets to some integer greater than 0, by calling the
constructors of this class with non-zero timeout
arguments, or by providing custom socket factories that provide at
least the functionality of TimeoutSocketFactory
.
Subclasses that use sockets other than TCP/IP sockets should have
similar non-infinite timeouts.
AbstractSwitchboardUser.unexportWhenDead()
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class danbikel.switchboard.AbstractSwitchboardUser |
---|
AbstractSwitchboardUser.Alive, AbstractSwitchboardUser.SBUserRetry |
Field Summary | |
---|---|
protected boolean |
acceptClientsOnlyByRequest
Indicates whether this server will only accept clients that specifically request it. |
protected int |
maxClients
The maximum number of clients this server is willing to accept. |
Fields inherited from class danbikel.switchboard.AbstractSwitchboardUser |
---|
aliveSynch, aliveTimeout, className, defaultMaxSwitchboardTries, defaultTimeout, dieSynch, id, infiniteTries, maxSwitchboardTries, registered, switchboard, switchboardName, timeout, timeToDie |
Fields inherited from class java.rmi.server.RemoteObject |
---|
ref |
Fields inherited from interface danbikel.switchboard.Server |
---|
acceptUnlimitedClients |
Constructor Summary | |
---|---|
protected |
AbstractServer()
Constructs a non-exported AbstractServer object. |
protected |
AbstractServer(int timeout)
Constructs a new server with the specified timeout value for its RMI sockets, to receive RMI calls on an anonymous port. |
protected |
AbstractServer(int maxClients,
boolean acceptClientsOnlyByRequest,
int timeout,
int port)
Constructs a new server that will accept no more than the specified number of clients, will optionally accept clients only by request, that will use the specified timeout for its RMI sockets and will accept RMI calls on the specified port. |
protected |
AbstractServer(int maxClients,
boolean acceptClientsOnlyByRequest,
int port,
RMIClientSocketFactory csf,
RMIServerSocketFactory ssf)
Constructs a new server that will accept no more than the specified number of clients, will optionally accept clients only by request, will accept RMI calls on the specified port and will use the specified socket factories to create its RMI sockets. |
protected |
AbstractServer(int timeout,
int port)
Constructs a new server with the specified timeout value for its RMI sockets, to receive RMI calls on the specified port. |
protected |
AbstractServer(int port,
RMIClientSocketFactory csf,
RMIServerSocketFactory ssf)
Constructs a new server that will accept RMI calls on the specified port, using the specified socket factories to create RMI sockets. |
Method Summary | |
---|---|
boolean |
acceptClientsOnlyByRequest()
Returns whether this server will only accept clients that specifically request it. |
static void |
disableHttp(Properties props)
|
int |
maxClients()
Returns the maximum number of clients this server is willing to accept. |
protected void |
register(String switchboardName)
Registers this server with the specified switchboard. |
protected void |
reRegister()
Re-registers this server with the switchboard. |
static void |
setPolicyFile(Class cl,
Properties props)
Calls AbstractSwitchboardUser.setPolicyFile(Class,String) with the specified class
and the value of the SwitchboardRemote.serverPolicyFile
property obtained from the specified Properties object. |
protected static void |
setPolicyFile(Properties props)
Calls AbstractSwitchboardUser.setPolicyFile(String) with the value of the
SwitchboardRemote.serverPolicyFile property obtained from
the specified Properties object. |
Methods inherited from class danbikel.switchboard.AbstractSwitchboardUser |
---|
alive, cleanup, die, disableHttp, getAliveTimeout, getSwitchboard, getSwitchboard, getSwitchboard, getSwitchboard, getSwitchboard, getSwitchboard, host, id, nonZeroTimeout, setPolicyFile, setPolicyFile, startAliveThread, unexportWhenDead |
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 |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface danbikel.switchboard.Server |
---|
id |
Methods inherited from interface danbikel.switchboard.SwitchboardUser |
---|
alive, die, host |
Field Detail |
---|
protected int maxClients
protected boolean acceptClientsOnlyByRequest
Constructor Detail |
---|
protected AbstractServer()
AbstractServer
object.
protected AbstractServer(int timeout) throws RemoteException
Warning: Using a value of 0 for the
timeout
argument will cause the distributed system
implemented by this package to be non-fault-tolerant. Use a timeout
value greater than 0 to ensure the fault-tolerance of
the distributed computing system.
timeout
- the time in milliseconds before client-side
(switchboard-side) sockets used for this remote object time out; a value
of 0 specifies infinite timeout, which is dangerous
RemoteException
protected AbstractServer(int timeout, int port) throws RemoteException
Warning: Using a value of 0 for the
timeout
argument will cause the distributed system
implemented by this package to be non-fault-tolerant. Use a timeout
value greater than 0 to ensure the fault-tolerance of
the distributed computing system.
timeout
- the time in milliseconds before client-side
(switchboard-side) sockets used for this remote object time out; a value
of 0 specifies infinite timeout, which is dangerousport
- the port on which to receive RMI calls
RemoteException
protected AbstractServer(int maxClients, boolean acceptClientsOnlyByRequest, int timeout, int port) throws RemoteException
maxClients
- the maximum number of clients this server is
willing to acceptacceptClientsOnlyByRequest
- if true
, then
this server will only accept clients that request it specificallytimeout
- the timeout value, in milliseconds, to be used for the
client-side (switchboard-side) RMI sockets of this objectport
- the port on which to receive RMI calls
RemoteException
protected AbstractServer(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException
Warning: Custom socket factories should ensure that their
sockets have some sort of timeout mechanism (such as implemented
for TCP/IP sockets by TimeoutSocketFactory
).
If sockets do not time out, then the distributed system implemented
by this package will not be fault-tolerant.
port
- the port on which to receive RMI callscsf
- the factory from which to create client-side RMI socketsssf
- the factory from which to create server-side RMI sockets
RemoteException
protected AbstractServer(int maxClients, boolean acceptClientsOnlyByRequest, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException
Warning: Custom socket factories should ensure that their
sockets have some sort of timeout mechanism (such as implemented
for TCP/IP sockets by TimeoutSocketFactory
).
If sockets do not time out, then the distributed system implemented
by this package will not be fault-tolerant.
maxClients
- the maximum number of clients this server is
willing to acceptacceptClientsOnlyByRequest
- if true
, then
this server will only accept clients that request it specificallyport
- the port on which to receive RMI callscsf
- the factory from which to create client-side RMI socketsssf
- the factory from which to create server-side RMI sockets
RemoteException
Method Detail |
---|
protected static void setPolicyFile(Properties props)
AbstractSwitchboardUser.setPolicyFile(String)
with the value of the
SwitchboardRemote.serverPolicyFile
property obtained from
the specified Properties
object.
props
- the Properties
object from which to
obtain the value of the SwitchboardRemote.serverPolicyFile
propertypublic static void setPolicyFile(Class cl, Properties props)
AbstractSwitchboardUser.setPolicyFile(Class,String)
with the specified class
and the value of the SwitchboardRemote.serverPolicyFile
property obtained from the specified Properties
object.
props
- the Properties
object from which to
obtain the value of the SwitchboardRemote.serverPolicyFile
propertypublic static void disableHttp(Properties props)
protected void reRegister() throws RemoteException
reRegister
in class AbstractSwitchboardUser
RemoteException
protected void register(String switchboardName) throws RemoteException, MalformedURLException
RemoteException
MalformedURLException
public int maxClients() throws RemoteException
maxClients
in interface Server
RemoteException
SwitchboardRemote.register(Server)
public boolean acceptClientsOnlyByRequest()
acceptClientsOnlyByRequest
in interface Server
SwitchboardRemote.register(Server)
,
SwitchboardRemote.getServer(int,int)
|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |