org.mule.model.seda
Class SedaService

java.lang.Object
  extended by org.mule.service.AbstractService
      extended by org.mule.model.seda.SedaService
All Implemented Interfaces:
Serializable, Runnable, EventListener, javax.resource.spi.work.Work, javax.resource.spi.work.WorkListener, MuleContextAware, Disposable, Initialisable, Lifecycle, Startable, Stoppable, NamedObject, Service

public class SedaService
extends AbstractService
implements javax.resource.spi.work.Work, javax.resource.spi.work.WorkListener

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

See Also:
Serialized Form

Field Summary
protected  Queue queue
           
protected  QueueProfile queueProfile
          The queue profile to use for this service.
protected  Integer queueTimeout
          The time out used for taking from the Seda Queue.
protected  ThreadingProfile threadingProfile
          The threading profile to use for this service.
protected  WorkManager workManager
           
 
Fields inherited from class org.mule.service.AbstractService
component, exceptionListener, inboundRouter, INITIAL_STATE_PAUSED, INITIAL_STATE_STARTED, INITIAL_STATE_STOPPED, initialised, initialState, logger, model, muleContext, name, outboundRouter, paused, responseRouter, stats, stopped, stopping
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
SedaService()
          For Spring only
 
Method Summary
protected  ServiceStatistics createStatistics()
           
protected  MuleEvent dequeue()
           
protected  void dispatchToOutboundRouter(MuleEvent event, MuleMessage result)
           
protected  void doDispatch(MuleEvent event)
           
protected  void doDispose()
           
protected  void doForceStop()
           
protected  void doInitialise()
          Initialise the service.
protected  MuleMessage doSend(MuleEvent event)
           
protected  void doStart()
           
protected  void doStop()
           
protected  void enqueue(MuleEvent event)
           
 Object getInstance()
           
 QueueProfile getQueueProfile()
           
 int getQueueSize()
           
 Integer getQueueTimeout()
           
 ThreadingProfile getThreadingProfile()
           
 WorkManager getWorkManager()
           
protected  void handleWorkException(javax.resource.spi.work.WorkEvent event, String type)
           
 void release()
           
 void run()
          While the service isn't stopped this runs a continuous loop checking for new events in the queue.
 void setQueueProfile(QueueProfile queueProfile)
           
 void setQueueTimeout(Integer queueTimeout)
           
 void setThreadingProfile(ThreadingProfile threadingProfile)
           
 void setWorkManager(WorkManager workManager)
           
 void workAccepted(javax.resource.spi.work.WorkEvent event)
           
 void workCompleted(javax.resource.spi.work.WorkEvent event)
           
 void workRejected(javax.resource.spi.work.WorkEvent event)
           
 void workStarted(javax.resource.spi.work.WorkEvent event)
           
 
Methods inherited from class org.mule.service.AbstractService
connectListeners, disconnectListeners, dispatchEvent, dispose, doPause, doResume, fireServiceNotification, forceStop, getComponent, getExceptionListener, getInboundRouter, getIncomingEndpoints, getInitialState, getModel, getMuleContext, getName, getOutboundRouter, getReplyToHandler, getResponseRouter, getStatistics, handleException, initialise, invokeComponent, isPaused, isStarted, isStopped, isStopping, pause, processAsyncReplyRouter, processReplyTo, registerListeners, resume, sendEvent, sendToOutboundRouter, setComponent, setExceptionListener, setInboundRouter, setInitialState, setModel, setMuleContext, setName, setOutboundRouter, setResponseRouter, 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

workManager

protected WorkManager workManager

queueTimeout

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


threadingProfile

protected ThreadingProfile threadingProfile
The threading profile to use for this service. If this is not set a default will be provided by the server


queueProfile

protected QueueProfile queueProfile
The queue profile to use for this service. If this is not set a default will be provided by the server


queue

protected Queue queue
Constructor Detail

SedaService

public SedaService()
For Spring only

Method Detail

doInitialise

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

Overrides:
doInitialise in class AbstractService
Throws:
InitialisationException - if the service fails to initialise

doForceStop

protected void doForceStop()
                    throws MuleException
Overrides:
doForceStop in class AbstractService
Throws:
MuleException

doStop

protected void doStop()
               throws MuleException
Overrides:
doStop in class AbstractService
Throws:
MuleException

doStart

protected void doStart()
                throws MuleException
Overrides:
doStart in class AbstractService
Throws:
MuleException

doDispose

protected void doDispose()
Overrides:
doDispose in class AbstractService

doDispatch

protected void doDispatch(MuleEvent event)
                   throws MuleException
Specified by:
doDispatch in class AbstractService
Throws:
MuleException

doSend

protected MuleMessage doSend(MuleEvent event)
                      throws MuleException
Specified by:
doSend in class AbstractService
Throws:
MuleException

getQueueSize

public int getQueueSize()

run

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

Specified by:
run in interface Runnable

release

public void release()
Specified by:
release in interface javax.resource.spi.work.Work

enqueue

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

dequeue

protected MuleEvent dequeue()
                     throws Exception
Throws:
Exception

workAccepted

public void workAccepted(javax.resource.spi.work.WorkEvent event)
Specified by:
workAccepted in interface javax.resource.spi.work.WorkListener

workRejected

public void workRejected(javax.resource.spi.work.WorkEvent event)
Specified by:
workRejected in interface javax.resource.spi.work.WorkListener

workStarted

public void workStarted(javax.resource.spi.work.WorkEvent event)
Specified by:
workStarted in interface javax.resource.spi.work.WorkListener

workCompleted

public void workCompleted(javax.resource.spi.work.WorkEvent event)
Specified by:
workCompleted in interface javax.resource.spi.work.WorkListener

handleWorkException

protected void handleWorkException(javax.resource.spi.work.WorkEvent event,
                                   String type)

createStatistics

protected ServiceStatistics createStatistics()
Overrides:
createStatistics in class AbstractService

getInstance

public Object getInstance()
                   throws MuleException
Throws:
MuleException

getQueueProfile

public QueueProfile getQueueProfile()

setQueueProfile

public void setQueueProfile(QueueProfile queueProfile)

getQueueTimeout

public Integer getQueueTimeout()

setQueueTimeout

public void setQueueTimeout(Integer queueTimeout)

getThreadingProfile

public ThreadingProfile getThreadingProfile()

setThreadingProfile

public void setThreadingProfile(ThreadingProfile threadingProfile)

getWorkManager

public WorkManager getWorkManager()

setWorkManager

public void setWorkManager(WorkManager workManager)

dispatchToOutboundRouter

protected void dispatchToOutboundRouter(MuleEvent event,
                                        MuleMessage result)
                                 throws MessagingException
Overrides:
dispatchToOutboundRouter in class AbstractService
Throws:
MessagingException


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.