I - The type of the input this communication stack element handles.O - The type of the value this communication stack element returns.T - The type of the input compatible delegates have to expect as
input.V - The type of the output compatible delegates must return.public abstract class CommunicationStackLayer<I,O,T,V> extends java.lang.Object implements CommunicationStack<I,O>, CommStackTransformer<I,T,V,O>
| Modifier and Type | Field and Description |
|---|---|
protected java.util.logging.Logger |
logger
The logger
|
protected int[] |
syncObject
Object for sync purposes.
|
| Constructor and Description |
|---|
CommunicationStackLayer(CommunicationStack<T,V> delegate,
LogService logService)
Sets up this communication stack layer and sets the successor within the
communication stack this communication stack layer is assigned to.
|
| Modifier and Type | Method and Description |
|---|---|
O |
process(java.net.URI remoteIdentifier,
I input)
Handles the request and returns the response.
|
void |
shutdown()
Shuts down this communication stack layer and delegates the call to the
delegate.
|
protected abstract void |
shutdownStackLayer()
Shuts down this CommunicationStackLayer.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittransformInput, transformOutputprotected final int[] syncObject
protected final java.util.logging.Logger logger
public CommunicationStackLayer(CommunicationStack<T,V> delegate, LogService logService)
delegate - The successor communication stack element.logService - The log service to retrieve the logger from.public final O process(java.net.URI remoteIdentifier, I input) throws CommunicationStackException
CommunicationStackIt accepts the request as input, modifies it accordingly to the functionality this layer is meant for and delegates it to the lower communication stack layer. Beside it modifies the response returned by the lower communication stack layer and returns the result.
If this component is instructed to shutdown by calling
CommunicationStack.shutdown() this method returns immediately by
throwing a appropriate CommunicationStackException.
process in interface CommunicationStack<I,O>remoteIdentifier - The identifier of the object/service the request is
targeted at. This may be null in case the information
is not available for the communication service. This information
may also be provided by the input parameter (for instance in an
InvocationMessage.input - The request in the form of what this layer expects.CommunicationStackException - If there are problems processing the
request, a CommunicationStackException will be
thrown. This may encapsulate any occurred exception.protected abstract void shutdownStackLayer()
This method should be overwritten for communication stack layer depended shutdown behavior.
This method is called not until all active requests are handled. Further requests are refused.
public final void shutdown()
shutdown in interface CommStackTransformer<I,T,V,O>shutdown in interface CommunicationStack<I,O>CommunicationStack.shutdown()