|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectoutputStrategy.OutputStrategyController
public class OutputStrategyController
Controller class of component OutputStrategy
.
Collects messages until an output criterion is fulfilled (certain number of messages collected or timeout reached).
Messages are added by component MessageProcessor
. When the
output criterion is fulfilled, the collected messages are bypassed to the
InputOutputHandler
(component), which sends them to their
destination.
Nested Class Summary | |
---|---|
private class |
OutputStrategyController.OutputTask
Simple TimerTask , which puts out the batch it is linked to. |
Field Summary | |
---|---|
private int |
batchSize
Number of messages the upcoming batch will contain (according to the OutputStrategy component on this mix' predecessor). |
private boolean |
BELONGS_TO_FIRST_MIX
Indicates whether this OutputStrategyController belongs to
the first mix of the cascade or not. |
private boolean |
BELONGS_TO_LAST_MIX
Indicates whether this OutputStrategyController belongs to
the last mix of the cascade or not. |
private int |
INITIAL_BUFFER_SIZE
Initial size of the Buffer used to store messages until
output. |
private InputOutputHandlerController |
inputOutputHandler
Reference on component InputOutputHandler . |
private static InternalInformationPortController |
internalInformationPort
Reference on component InternalInformationPort . |
private boolean |
isReplyBatchPending
Indicates whether the batch sent lastly has already been answered. |
private static java.util.logging.Logger |
LOGGER
Logger used to log and display information. |
private int |
neededChannelEstablishMessages
Minimum number of ChannelEstablishMessage s that must be
collected, before putting out the request batch (if at least one
ChannelEstablishMessage is in the batch). |
private int |
neededForwardChannelMessages
Minimum number of ForwardChannelMessage s that must be
collected, before putting out the request batch. |
private int |
neededReplyMessages
Minimum number of ReplyMessages s that must be collected,
before putting out the reply batch. |
private int |
numberOfChannelEstablishMessages
Number of ChannelEstablishMessage s currently in request
batch. |
private int |
numberOfChannelReleaseMessages
Number of ChannelReleaseMessage s currently in request
batch. |
private int |
numberOfForwardChannelMessages
Number of ForwardChannelMessage s currently in request
batch. |
private Batch |
replyBatch
Data structure used to store replies before output. |
private java.util.Timer |
replyTimeoutTimer
Timer used to detect TIMEOUT for replies. |
private Batch |
requestBatch
Data structure used to store requests before output. |
private java.util.Timer |
requestTimeoutTimer
Timer used to detect TIMEOUT for requests. |
private long |
TIMEOUT
Amount of time, after which the batch is put out, no matter how many messages it contains. |
Constructor Summary | |
---|---|
OutputStrategyController()
Generates a new OutputStrategy component, which collects
messages until an output criterion is fulfilled (certain number of
messages collected or timeout reached). |
Method Summary | |
---|---|
void |
addReply(Reply reply)
Can be used to add a Reply , that shall be put out
according to the underlying output strategy. |
void |
addRequest(Request request)
Can be used to add a Request , that shall be put out
according to the underlying output strategy. |
private static java.lang.String |
getProperty(java.lang.String key)
Simply used to shorten method calls (calls internalInformationPort.getProperty(key) ). |
void |
initialize(InputOutputHandlerController inputOutputHandler)
Initialization method for this component. |
private boolean |
isOutputCriterionForReplyBatchFulfilled()
Indicates whether the output criterion for replyBatch is
fulfilled or not. |
private boolean |
isOutputCriterionForRequestBatchFulfilled()
Indicates whether the output criterion for requestBatch is
fulfilled or not. |
private void |
putOutReplyBatch()
Puts out collected messages in replyBatch . |
private void |
putOutRequestBatch()
Puts out collected messages in requestBatch and prepares
variables for next batch. |
void |
setBatchSize(int newSize)
Number of messages the upcoming batch will contain (according to the OutputStrategy component on this mix' predecessor). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static InternalInformationPortController internalInformationPort
InternalInformationPort
.
Used to display and/or log data and read general settings.
private static final java.util.logging.Logger LOGGER
private InputOutputHandlerController inputOutputHandler
InputOutputHandler
.
Used to bypass collected messages, when output criterion fulfilled.
private final int INITIAL_BUFFER_SIZE
Buffer
used to store messages until
output. Gets resized automatically if it runs out of space.
private boolean BELONGS_TO_LAST_MIX
OutputStrategyController
belongs to
the last mix of the cascade or not.
private boolean BELONGS_TO_FIRST_MIX
OutputStrategyController
belongs to
the first mix of the cascade or not.
private final long TIMEOUT
private Batch requestBatch
private Batch replyBatch
private java.util.Timer requestTimeoutTimer
TIMEOUT
for requests.
private java.util.Timer replyTimeoutTimer
TIMEOUT
for replies.
private int neededChannelEstablishMessages
ChannelEstablishMessage
s that must be
collected, before putting out the request batch (if at least one
ChannelEstablishMessage
is in the batch).
requestBatch
private int neededForwardChannelMessages
ForwardChannelMessage
s that must be
collected, before putting out the request batch. Will be adjusted
automatically.
requestBatch
private int neededReplyMessages
ReplyMessages
s that must be collected,
before putting out the reply batch. Will be adjusted
automatically.
replyBatch
private boolean isReplyBatchPending
Note: Synchronous batch.
private int batchSize
OutputStrategy
component on this mix' predecessor).
Used for batch synchronization.
BatchSizeMessage
private int numberOfChannelEstablishMessages
ChannelEstablishMessage
s currently in request
batch.
neededChannelEstablishMessages
private int numberOfForwardChannelMessages
ForwardChannelMessage
s currently in request
batch.
neededForwardChannelMessages
private int numberOfChannelReleaseMessages
ChannelReleaseMessage
s currently in request
batch.
Constructor Detail |
---|
public OutputStrategyController()
OutputStrategy
component, which collects
messages until an output criterion is fulfilled (certain number of
messages collected or timeout reached).
Messages are added by component MessageProcessor
. When the
output criterion is fulfilled, the collected messages are bypassed to
the InputOutputHandler
(component), which sends them to
their destination.
Can handle Request
s and Replies
in parallel.
Component can't be used before calling
initialize(InputOutputHandlerController)
.
initialize(InputOutputHandlerController)
Method Detail |
---|
public void initialize(InputOutputHandlerController inputOutputHandler)
inputOutputHandler
- Reference on component
InputOutputHandler
(used to
send messages after output).public void addRequest(Request request)
Request
, that shall be put out
according to the underlying output strategy.
Return immediately (asynchronous behavior), internal output decision is deferred.
addRequest
in interface OutputStrategyInterface
request
- Request
, that shall be put out according
to the underlying output strategy.public void addReply(Reply reply)
Reply
, that shall be put out
according to the underlying output strategy.
Returns immediately (asynchronous behavior), internal output decision is deferred.
addReply
in interface OutputStrategyInterface
reply
- Reply
, that shall be put out according
to the underlying output strategy.public void setBatchSize(int newSize)
OutputStrategy
component on this mix' predecessor).
Used for batch synchronization.
BatchSizeMessage
private boolean isOutputCriterionForRequestBatchFulfilled()
requestBatch
is
fulfilled or not.
requestBatch
is
fulfilled or not.private boolean isOutputCriterionForReplyBatchFulfilled()
replyBatch
is
fulfilled or not.
replyBatch
is
fulfilled or not.private void putOutRequestBatch()
requestBatch
and prepares
variables for next batch.
private void putOutReplyBatch()
replyBatch
.
private static java.lang.String getProperty(java.lang.String key)
internalInformationPort.getProperty(key)
). Returns the
property with the specified key from the property file.
key
- The property key.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |