stella.net
Class ErrorReceiver
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.ErrorReceiver
- All Implemented Interfaces:
- Cloneable, Runnable, Remote, ErrorProcessing, RmiErrorCaster, CancelRunnable, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, RmiCaster, RmiPropertyBearing
public class ErrorReceiver
- extends ErrorServer
The ascii-error receiver. This class comprises all the necessary methods to
read in ascii-versions of an ErrorEvent via a socket. It acts as
a fully functional RMI-based ErrorCaster
and can therefore
be used as a converter from ascii-string-via-sockets to a fully RMI
message caster. The details of
the class functionality can be described as follows.
- On startup this class creates a server socket listening on the
port specified in the properties of this receiver. This is part of the
parent class behaviour.
- When a connection is established a helper thread is spawned.
The helper thread,
ErrorReceiver.ErrorHandler, takes over the client socket
and is responsible for the entire communication ('protocol'). This
helper thread is an extension to ErrorReceiver.ErrorHandler.
- The main receiver class immediately retakes the listening
state once the protocol thread is started.
- The
ErrorReceiver.ErrorHandler first establishes the streams to the
client (parent class functionality) and reads in the error event.
- Then the receiver's
ErrorServer.processError(stella.ErrorEvent) method is called that casts
the error event to the registered listeners.
- It is not yet defined whether a reply (like gotError) should be
sent back to the client.
- Now the
ErrorReceiver.ErrorHandler returns from its runProtocol
method which results in closing of all streams and the socket.
|
Constructor Summary |
ErrorReceiver(Map qualify)
Constructs a new receiver with the specified properties. |
|
Method Summary |
void |
cancel()
Cancels the parameter server. |
protected void |
protocol(Socket client)
The method to handle the communication from the error-sending client
to this receiver. |
| 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_ERRORGROUP
public static final String KEY_ERRORGROUP
- The key in the properties for the alarm thread group.
- See Also:
- Constant Field Values
KEY_TIMEOUT
public static final String KEY_TIMEOUT
- The key for join-time on cancel.
- See Also:
- Constant Field Values
KEY_AVAILABLE
public static final String KEY_AVAILABLE
- The key for sleep intervalls on available queries.
- See Also:
- Constant Field Values
DEFTIMEOUT
private static final long DEFTIMEOUT
- The default sleep interval between available queries.
- See Also:
- Constant Field Values
DEFERRORGROUP
private static final ThreadGroup DEFERRORGROUP
- The thread group commands run in.
DEFAVAILABLE
private static final long DEFAVAILABLE
- The default sleep interval between available queries.
- See Also:
- Constant Field Values
errorgroup
private ThreadGroup errorgroup
- The thread group to use for error handlers.
receive
private ErrorReceiver.ErrorHandler receive
- The protocol handler for incoming errors.
lockread
private Object lockread
- Used for locking during read.
ErrorReceiver
public ErrorReceiver(Map qualify)
throws RemoteException
- Constructs a new receiver with the specified properties. Use of this
constructor ensures no additional properties to be set.
This constructor exports the newly created error receiver to the
registry as an unicast object.
- Throws:
RemoteException
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 to handle the communication from the error-sending client
to this receiver. It takes the client socket as an argument and
spawns a
ErrorReceiver.ErrorHandler thread that implements the
error-receiving protocol. The priority the handler thread should
run at is defined in the base class and is querried with the
ReceiverServer.getHandlerPriority() method.
As soon as the handler is started this
method returns, allowing the receiver to regain its listening stage
quickly.
- Specified by:
protocol in class ReceiverServer
- Parameters:
client - The client socket.- See Also:
CommandReceiver,
ErrorReceiver