stella.net
Class ParameterServer
java.lang.Object
util.PropertyContainer
util.PropertyResources
util.PropertyBundles
util.rmi.RmiPropertyContainer
util.rmi.AbstractRmiCaster
stella.CastingContainer
stella.net.ReceiverServer
stella.net.ErrorServer
stella.net.ParameterServer
- All Implemented Interfaces:
- Cloneable, Runnable, Remote, Caster, ClusterDepending, ErrorCaster, ErrorProcessing, RmiErrorCaster, CancelRunnable, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, RmiCaster, RmiPropertyBearing
public class ParameterServer
- extends ErrorServer
- implements ErrorCaster, ClusterDepending
A parameter server class. This class allows clients to connect to its
listening port to query instances of SocketParameter. The
functionality is as follows.
- After starting the server with the
startServer() method it
aquires a listening state on the port defined by #KEY_PORT.
- Incomming request spawn a new
ParameterServer.ParameterHandler thread.
This thread reads in the name of the parameter to be querried from
the client.
- The parameter name is than matched to a
SocketParameter
instance. Its SocketParameter.getAscii() method is used to
serialize the parameter value into a string.
- The string is written to the socket-stream. The stream is terminated
with a newline and flushed.
- This ends the protocol. The streams and the sockets are closed.
As the parameter server runs within the master mind, local error casting
is enabled.
| Methods inherited from class stella.CastingContainer |
addErrorListener, addRmiErrorListener, isValid, notifyErrorListener, removeErrorListener, removeRmiErrorListener, sendError, sendError, sendError, sendStatus, sendStatus, sendStatus |
| Methods inherited from class util.PropertyResources |
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString |
| Methods inherited from interface util.PropertySupplying |
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
KEY_TIMEOUT
public static final String KEY_TIMEOUT
- The key for join-time on cancel.
- See Also:
- Constant Field Values
DEFTIMEOUT
private static final long DEFTIMEOUT
- The default sleep interval between available queries.
- See Also:
- Constant Field Values
set
private ParameterClustering set
- The reference to the parameters served.
parameterGroup
private static final transient ThreadGroup parameterGroup
- The thread group commands run in.
request
private ParameterServer.ParameterHandler request
- The handler for dealing with parameter queries.
ParameterServer
public ParameterServer(Map prop)
throws RemoteException
- Constructs a new parameter server. The server thread must be started
explicetly with a call to
startServer().
SocketParameters
should be added prior to starting the parameter server, otherwise
synchronization on the look-up table may cause time delays.
- Throws:
RemoteException
registerCluster
public void registerCluster(ParameterClustering toserve)
- Registers the set of parameters served by this parameter server.
- Specified by:
registerCluster in interface ClusterDepending
startServer
public void startServer()
- Starts the server. The linked thread is already constructed in
ReceiverServer.ReceiverServer(Map), which also sets
the server priority.
cancel
public void cancel()
- Cancels the parameter server. If a connection is currently active, it
is first closed.
- Specified by:
cancel in interface CancelRunnable- Overrides:
cancel in class ReceiverServer
protocol
protected void protocol(Socket client)
- The method called as soon as a connection is established. It spwans
a
ParameterServer.ParameterHandler thread witch performs the actual
communication.
- Specified by:
protocol in class ReceiverServer
- Parameters:
client - The client socket.- See Also:
CommandReceiver,
ErrorReceiver