org.codehaus.activemq.work
Class SpringWorkManager

java.lang.Object
  extended byorg.codehaus.activemq.work.SpringWorkManager
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, WorkManager

public class SpringWorkManager
extends Object
implements WorkManager, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean

WorkManager implementation which uses under the cover three WorkExecutorPool - one for each synchronization policy - in order to dispatch the submitted Work instances.

A WorkManager is a component of the JCA specifications, which allows a Resource Adapter to submit tasks to an Application Server for execution.

This code is based on the Geronimo WorkManager implementation but copied here to avoid dependencies on Geronimo and GBeans etc.

Version:
$Revision: 1.1 $ $Date: 2004/10/26 16:12:08 $

Field Summary
 
Fields inherited from interface javax.resource.spi.work.WorkManager
IMMEDIATE, INDEFINITE, UNKNOWN
 
Constructor Summary
SpringWorkManager()
          Create a WorkManager.
SpringWorkManager(int syncSize, int startSize, int schedSize, XAWork xaServices)
           
SpringWorkManager(int size, XAWork xaServices)
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
 void doWork(Work work)
           
 void doWork(Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener)
           
 int getScheduledMaximumPoolSize()
           
 int getScheduledThreadCount()
           
 int getStartMaximumPoolSize()
           
 int getStartThreadCount()
           
 int getSyncMaximumPoolSize()
           
 int getSyncThreadCount()
           
 XATerminator getXATerminator()
           
 void scheduleWork(Work work)
           
 void scheduleWork(Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener)
           
 void setScheduledMaximumPoolSize(int maxSize)
           
 void setStartMaximumPoolSize(int maxSize)
           
 void setSyncMaximumPoolSize(int maxSize)
           
 long startWork(Work work)
           
 long startWork(Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringWorkManager

public SpringWorkManager()
Create a WorkManager.


SpringWorkManager

public SpringWorkManager(int size,
                         XAWork xaServices)

SpringWorkManager

public SpringWorkManager(int syncSize,
                         int startSize,
                         int schedSize,
                         XAWork xaServices)
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
Exception

getXATerminator

public XATerminator getXATerminator()

getSyncThreadCount

public int getSyncThreadCount()

getSyncMaximumPoolSize

public int getSyncMaximumPoolSize()

setSyncMaximumPoolSize

public void setSyncMaximumPoolSize(int maxSize)

getStartThreadCount

public int getStartThreadCount()

getStartMaximumPoolSize

public int getStartMaximumPoolSize()

setStartMaximumPoolSize

public void setStartMaximumPoolSize(int maxSize)

getScheduledThreadCount

public int getScheduledThreadCount()

getScheduledMaximumPoolSize

public int getScheduledMaximumPoolSize()

setScheduledMaximumPoolSize

public void setScheduledMaximumPoolSize(int maxSize)

doWork

public void doWork(Work work)
            throws WorkException
Specified by:
doWork in interface WorkManager
Throws:
WorkException

doWork

public void doWork(Work work,
                   long startTimeout,
                   ExecutionContext execContext,
                   WorkListener workListener)
            throws WorkException
Specified by:
doWork in interface WorkManager
Throws:
WorkException

startWork

public long startWork(Work work)
               throws WorkException
Specified by:
startWork in interface WorkManager
Throws:
WorkException

startWork

public long startWork(Work work,
                      long startTimeout,
                      ExecutionContext execContext,
                      WorkListener workListener)
               throws WorkException
Specified by:
startWork in interface WorkManager
Throws:
WorkException

scheduleWork

public void scheduleWork(Work work)
                  throws WorkException
Specified by:
scheduleWork in interface WorkManager
Throws:
WorkException

scheduleWork

public void scheduleWork(Work work,
                         long startTimeout,
                         ExecutionContext execContext,
                         WorkListener workListener)
                  throws WorkException
Specified by:
scheduleWork in interface WorkManager
Throws:
WorkException


Copyright © 2004-2005 Protique, Ltd.. All Rights Reserved.