org.instrumentmiddleware.cima.plugin.producer.poller
Class AbstractMultiPollerParcelProducer

java.lang.Object
  extended by org.instrumentmiddleware.cima.plugin.impl.AbstractPlugin
      extended by org.instrumentmiddleware.cima.plugin.producer.impl.AbstractProducer
          extended by org.instrumentmiddleware.cima.plugin.producer.poller.AbstractMultiPollerParcelProducer
All Implemented Interfaces:
ICIMAOperationExtension, ICIMAPlugin, IPlugin, IParcelProducer, IProducer
Direct Known Subclasses:
RegularIntervalMultiPollerParcelProducer

public abstract class AbstractMultiPollerParcelProducer
extends AbstractProducer
implements IParcelProducer

A parcel producer that has multiple poller threads Each poller thread is attached to an ISession object. In other words each poller thread asks this producer to produce parcels(probably at different interval) that will be delivered to the subscriber that this producer established the attached session with. Note that current implementations of this class are regular interval producers. It means that each poller thread polls this producer on a regular interval. In particular it means that we assume that producers that produce data when available don't need to have multiple poller threads. (This might change if needed) A new poller thread is started when a SUBSCRIBE parcel is received with an existing dataInterval element. The newly started thread is attached to the session the subscriber belongs to and will poll this producer based on the dataInterval specified within the parcel.

Author:
Romain
See Also:
ISession, RegularIntervalMultiPollerParcelProducer

Field Summary
protected  java.util.Hashtable<ISession,ParcelProducerPoller> sessionPollerMapping
          Table to map a poller threads with Isession objects
 
Fields inherited from class org.instrumentmiddleware.cima.plugin.producer.impl.AbstractProducer
deliveryStrategy, director, log, parcelCreator
 
Fields inherited from class org.instrumentmiddleware.cima.plugin.impl.AbstractPlugin
startOnLoad, stopped, subscriptions
 
Constructor Summary
AbstractMultiPollerParcelProducer(java.lang.String id, IParcelCreator creator, ICIMADirector director)
           
 
Method Summary
protected abstract  ParcelProducerPoller getPollerThread(ISession session, org.instrumentmiddleware.cima.parcel.DataIntervalType dataInterval)
           
 org.instrumentmiddleware.cima.parcel.ResponseType processSubscribeParcel(org.instrumentmiddleware.cima.parcel.BodyType body, java.util.Calendar creationTime, ISession session, org.instrumentmiddleware.cima.parcel.ResponseType response)
          Process a subscribe parcel.
 void stop()
          Stop this plugin.
 
Methods inherited from class org.instrumentmiddleware.cima.plugin.producer.impl.AbstractProducer
getDeliveryStrategy, processGetOperation, processSetOperation, releaseParcel, setDeliveryStrategy, start
 
Methods inherited from class org.instrumentmiddleware.cima.plugin.impl.AbstractPlugin
doSubscribe, doSubscribe, getBodyHandler, getId, getInformation, getSequenceNumber, internalProcessParcel, processParcel, processSubscribeResponse, setStartOnLoad, setSubscriptions, startOnLoad
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.instrumentmiddleware.cima.plugin.producer.IParcelProducer
produceParcels
 
Methods inherited from interface org.instrumentmiddleware.cima.plugin.producer.IProducer
getDeliveryStrategy, releaseParcel, setDeliveryStrategy
 
Methods inherited from interface org.instrumentmiddleware.cima.plugin.IPlugin
doSubscribe, getId, getInformation, getSequenceNumber, processParcel, setStartOnLoad, start, startOnLoad
 

Field Detail

sessionPollerMapping

protected java.util.Hashtable<ISession,ParcelProducerPoller> sessionPollerMapping
Table to map a poller threads with Isession objects

Constructor Detail

AbstractMultiPollerParcelProducer

public AbstractMultiPollerParcelProducer(java.lang.String id,
                                         IParcelCreator creator,
                                         ICIMADirector director)
                                  throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

processSubscribeParcel

public org.instrumentmiddleware.cima.parcel.ResponseType processSubscribeParcel(org.instrumentmiddleware.cima.parcel.BodyType body,
                                                                                java.util.Calendar creationTime,
                                                                                ISession session,
                                                                                org.instrumentmiddleware.cima.parcel.ResponseType response)
                                                                         throws PluginException
Description copied from class: AbstractProducer
Process a subscribe parcel. This method appends the endpoint of the remote entity to the session to allow delivery of parcels produced by this producer. The IDeliveryStrategy needs this information to deliver the parcel.

Overrides:
processSubscribeParcel in class AbstractProducer
Throws:
PluginException
See Also:
org.instrumentmiddleware.cima.plugin.impl.AbstractPlugin.internalProcessParcel(BodyType, ISession, ResponseType)

stop

public void stop()
          throws PluginException
Description copied from interface: IPlugin
Stop this plugin. This allows a plugin to perform some cleanup and is called when CIMA expects no further interaction with this plugin

Specified by:
stop in interface IPlugin
Overrides:
stop in class AbstractProducer
Throws:
PluginException
See Also:
org.instrumentmiddleware.cima.plugin.Plugin#stop()

getPollerThread

protected abstract ParcelProducerPoller getPollerThread(ISession session,
                                                        org.instrumentmiddleware.cima.parcel.DataIntervalType dataInterval)


Copyright © 2008. All Rights Reserved.