org.mule.impl.model.seda
Class SedaComponent

java.lang.Object
  extended byorg.mule.impl.model.AbstractComponent
      extended byorg.mule.impl.model.seda.SedaComponent
All Implemented Interfaces:
Disposable, Initialisable, Lifecycle, Serializable, Startable, Stoppable, UMOComponent
Direct Known Subclasses:
OptimisedSedaComponent

public class SedaComponent
extends AbstractComponent

A Seda component runs inside a Seda Model and is responsible for managing a Seda Queue and thread pool for a Mule sevice component. In Seda terms this is equivilent to a stage.

Version:
$Revision: 3798 $
Author:
Ross Mason
See Also:
Serialized Form

Field Summary
protected  boolean componentPerRequest
          If this is set to true a new component will be created for every request
protected  MuleProxy componentProxy
          Is created only if component pooling is turned off on the SEDAModel.
protected  String descriptorQueueName
           
protected  boolean enablePooling
          Whether component objects should be pooled or a single instance should be used
protected  ObjectPool proxyPool
          A pool of available Mule Proxies.
protected  int queueTimeout
          The time out used for taking from the Seda Queue
protected  UMOWorkManager workManager
           
 
Fields inherited from class org.mule.impl.model.AbstractComponent
descriptor, exceptionListener, initialised, logger, model, paused, poolInitialised, stats, stopped, stopping
 
Constructor Summary
SedaComponent(MuleDescriptor descriptor, SedaModel model)
          Creates a new SEDA component
 
Method Summary
protected  MuleProxy createComponentProxy()
           
protected  UMOEvent dequeue()
           
protected  void doDispatch(UMOEvent event)
           
protected  void doDispose()
           
 void doForceStop()
           
 void doInitialise()
          Initialise the component.
 UMOMessage doSend(UMOEvent event)
           
 void doStart()
           
 void doStop()
           
protected  void enqueue(UMOEvent event)
           
 int getQueueSize()
           
protected  void handleWorkException(WorkEvent event, String type)
           
protected  void initialisePool()
           
 void release()
           
 void run()
          While the component isn't stopped this runs a continuous loop checking for new events in the queue
 void workAccepted(WorkEvent event)
           
 void workCompleted(WorkEvent event)
           
 void workRejected(WorkEvent event)
           
 void workStarted(WorkEvent event)
           
 
Methods inherited from class org.mule.impl.model.AbstractComponent
connectListeners, disconnectListeners, dispatchEvent, dispose, doPause, doResume, fireComponentNotification, forceStop, getDescriptor, getIncomingEndpoints, getInstance, getName, getStatistics, handleException, initialise, isPaused, isStarted, isStopped, isStopping, lookupComponent, pause, registerListeners, resume, sendEvent, start, start, startListeners, stop, stopListeners, toString, unregisterListeners, waitIfPaused
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

proxyPool

protected ObjectPool proxyPool
A pool of available Mule Proxies. Component pooling has been disabled on the SEDAModel, this pool will be null anf the 'componentProxy' will be used.


componentProxy

protected MuleProxy componentProxy
Is created only if component pooling is turned off on the SEDAModel. in this scenario all requests are serviced by this component, unless 'componentPerRequest' flag is set on the model


workManager

protected UMOWorkManager workManager

descriptorQueueName

protected String descriptorQueueName

queueTimeout

protected int queueTimeout
The time out used for taking from the Seda Queue


enablePooling

protected boolean enablePooling
Whether component objects should be pooled or a single instance should be used


componentPerRequest

protected boolean componentPerRequest
If this is set to true a new component will be created for every request

Constructor Detail

SedaComponent

public SedaComponent(MuleDescriptor descriptor,
                     SedaModel model)
Creates a new SEDA component

Parameters:
descriptor - The descriptor of the component to creat
model - the model in which the component is registered
Method Detail

doInitialise

public void doInitialise()
                  throws InitialisationException
Initialise the component. The component will first create a Mule UMO from the UMODescriptor and then initialise a pool based on the attributes in the UMODescriptor.

Overrides:
doInitialise in class AbstractComponent
Throws:
InitialisationException - if the component fails to initialise
See Also:
UMODescriptor

initialisePool

protected void initialisePool()
                       throws InitialisationException
Throws:
InitialisationException

createComponentProxy

protected MuleProxy createComponentProxy()
                                  throws InitialisationException
Throws:
InitialisationException

doForceStop

public void doForceStop()
                 throws UMOException
Overrides:
doForceStop in class AbstractComponent
Throws:
UMOException

doStop

public void doStop()
            throws UMOException
Overrides:
doStop in class AbstractComponent
Throws:
UMOException

doStart

public void doStart()
             throws UMOException
Overrides:
doStart in class AbstractComponent
Throws:
UMOException

doDispose

protected void doDispose()
Overrides:
doDispose in class AbstractComponent

doDispatch

protected void doDispatch(UMOEvent event)
                   throws UMOException
Specified by:
doDispatch in class AbstractComponent
Throws:
UMOException

doSend

public UMOMessage doSend(UMOEvent event)
                  throws UMOException
Specified by:
doSend in class AbstractComponent
Throws:
UMOException

getQueueSize

public int getQueueSize()

run

public void run()
While the component isn't stopped this runs a continuous loop checking for new events in the queue


release

public void release()

enqueue

protected void enqueue(UMOEvent event)
                throws Exception
Throws:
Exception

dequeue

protected UMOEvent dequeue()
                    throws Exception
Throws:
Exception

workAccepted

public void workAccepted(WorkEvent event)

workRejected

public void workRejected(WorkEvent event)

workStarted

public void workStarted(WorkEvent event)

workCompleted

public void workCompleted(WorkEvent event)

handleWorkException

protected void handleWorkException(WorkEvent event,
                                   String type)


Copyright © 2003-2006 MuleSource Inc.. All Rights Reserved.