org.instrumentmiddleware.cima.plugin.producer.poller
Class ParcelProducerPoller
java.lang.Object
org.instrumentmiddleware.cima.plugin.producer.poller.ParcelProducerPoller
- All Implemented Interfaces:
- java.lang.Runnable
public class ParcelProducerPoller
- extends java.lang.Object
- implements java.lang.Runnable
A parcel producer poller.
A poller asks a parcel producer to produce parcels.
This can be done on a regular interval or when the data is available.
In the specific case where the producer produces parcel only when data is available, it is the
reponsability of the producer's developper to make this poller waits until the data arrives.
- Author:
- Romain
|
Constructor Summary |
ParcelProducerPoller(IParcelProducer plugin,
ISession session,
org.instrumentmiddleware.cima.parcel.DataIntervalType dataInterval,
java.lang.String releaseMode)
Instantiates a new ParcelProducerPoller. |
|
Method Summary |
protected int |
getCoefficient()
|
org.instrumentmiddleware.cima.parcel.DataIntervalType |
getDataInterval()
Returns the dataInterval or null if no such dataInterval |
boolean |
isStarted()
|
void |
run()
|
void |
setDataInterval(org.instrumentmiddleware.cima.parcel.DataIntervalType dataInterval)
Set the dataInterval for this poller |
void |
terminate()
Stops this thread |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static org.apache.log4j.Logger log
MULTI
public static final java.lang.String MULTI
- See Also:
- Constant Field Values
SINGLE
public static final java.lang.String SINGLE
- See Also:
- Constant Field Values
plugin
protected IParcelProducer plugin
dataInterval
protected org.instrumentmiddleware.cima.parcel.DataIntervalType dataInterval
stop
protected boolean stop
delay
protected long delay
session
protected ISession session
executor
protected java.util.concurrent.ExecutorService executor
ParcelProducerPoller
public ParcelProducerPoller(IParcelProducer plugin,
ISession session,
org.instrumentmiddleware.cima.parcel.DataIntervalType dataInterval,
java.lang.String releaseMode)
- Instantiates a new ParcelProducerPoller.
The session and dataInterval can be null. Data interval should be set to null if the
IParcelProducer produces parcels only when data is available. It is not null if the IParcelProducer
is supposed to produce parcels on a regular basis.
Session is not null if this thread is attached to a subscriber. In other words, when the parcels are produced
they are sent to exatcly one subscriber(the one attached to the session). Session is null if when the parcels
are produced, they are sent to all subscribers.
- Parameters:
plugin - the producer this thread will poll the parcel fromsession - the session this thread is attached to or null if no such sessiondataInterval - the polling period or null if the IMultiParcelProducer produces parcels
only when data is avaliablereleaseMode - if set to "multi", this poller will use a thread pool to send the parcels got from the
IParcelProducer. In other words each parcel will be released by a different thread. If null, set to "single(default value)
or set to any other value except "multi", then this poller will use a single thread to release all the parcels got
from the IParcelProducer. In other words each parcel will be released by the same thread sequentially.
run
public void run()
- Specified by:
run in interface java.lang.Runnable
terminate
public void terminate()
- Stops this thread
isStarted
public boolean isStarted()
getDataInterval
public org.instrumentmiddleware.cima.parcel.DataIntervalType getDataInterval()
- Returns the dataInterval or null if no such dataInterval
- Returns:
- the dataInterval or null if no such dataInterval
setDataInterval
public void setDataInterval(org.instrumentmiddleware.cima.parcel.DataIntervalType dataInterval)
- Set the dataInterval for this poller
- Parameters:
dataInterval -
getCoefficient
protected int getCoefficient()
Copyright © 2008. All Rights Reserved.