org.jboss.soa.esb.listeners
Class AbstractManagedListener

java.lang.Object
  extended by java.util.Observable
      extended by org.jboss.soa.esb.listeners.AbstractManagedListener
All Implemented Interfaces:
java.lang.Runnable, java.util.Observer
Direct Known Subclasses:
HttpListener, MessageAwareListener

public abstract class AbstractManagedListener
extends java.util.Observable
implements java.lang.Runnable, java.util.Observer

All ESB 'managed' listeners (gateways and message) should extend this class.

Responsibility as an Observable is to notify Observers when it is ready to run (Boolean.TRUE) and when it's not (Boolean.FALSE)
It must be a Runnable that will be started in a thread forked and controlled by a ListenerManager (the _controller)
It is supposed to manage it's own thread pool of 'actions' (the _execService)

Since:
Version 4.0
Author:
schifest@heuristica.com.ar

Field Summary
protected  boolean _bRegistered
           
protected  ConfigTree _config
           
protected  ListenerManager _controller
           
protected  int _defaultMaxThreads
           
protected  EPR _epr
           
protected  java.lang.String _eprCategoryName
           
protected  java.lang.String _eprName
           
protected  java.util.concurrent.ExecutorService _execService
           
protected  org.apache.log4j.Logger _logger
           
protected  int _maxThreads
           
protected  long _pauseLapseInMillis
           
 
Constructor Summary
protected AbstractManagedListener(ListenerManager controller, ConfigTree config)
          public constructor
 
Method Summary
protected  void checkMyParms()
           
abstract  boolean finalizeRun()
           
 boolean hasActiveTreads()
           
abstract  boolean initializeRun()
           
abstract  boolean isMessageAware()
           
protected  java.lang.String obtainAttribute(java.lang.String p_sAtt, java.lang.String p_sDefault)
           
protected  void registerProcess()
           
protected  void resetThreadCount()
           
 void run()
          Loops until controlling process determines
Invokes appropriate Courier to obtain incoming ESB Messages
When one is received, instantiates an action processing pipeline to process it
protected  void unregisterProcess()
           
 void update(java.util.Observable o, java.lang.Object arg)
           
protected  void updateThreadCount(java.lang.Integer i)
           
abstract  void waitForEventAndProcess(long maxWaitMillis)
           
 void waitUntilReady()
          Wait until the registration process finished, a PickupCourier was obtained , and the pool thread is instantiated
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_config

protected ConfigTree _config

_controller

protected ListenerManager _controller

_bRegistered

protected boolean _bRegistered

_eprCategoryName

protected java.lang.String _eprCategoryName

_eprName

protected java.lang.String _eprName

_epr

protected EPR _epr

_maxThreads

protected int _maxThreads

_defaultMaxThreads

protected int _defaultMaxThreads

_pauseLapseInMillis

protected long _pauseLapseInMillis

_execService

protected java.util.concurrent.ExecutorService _execService

_logger

protected org.apache.log4j.Logger _logger
Constructor Detail

AbstractManagedListener

protected AbstractManagedListener(ListenerManager controller,
                                  ConfigTree config)
                           throws ConfigurationException
public constructor

Parameters:
controller - ListenerManager - the controlling process
config - ConfigTree - Containing 'static' configuration for this instance
Throws:
java.lang.Exception
ConfigurationException
Method Detail

isMessageAware

public abstract boolean isMessageAware()

initializeRun

public abstract boolean initializeRun()

finalizeRun

public abstract boolean finalizeRun()

waitForEventAndProcess

public abstract void waitForEventAndProcess(long maxWaitMillis)

checkMyParms

protected void checkMyParms()
                     throws ConfigurationException
Throws:
ConfigurationException

registerProcess

protected void registerProcess()
                        throws RegistryException
Throws:
RegistryException

unregisterProcess

protected void unregisterProcess()
                          throws RegistryException
Throws:
RegistryException

waitUntilReady

public void waitUntilReady()
Wait until the registration process finished, a PickupCourier was obtained , and the pool thread is instantiated


update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer

hasActiveTreads

public boolean hasActiveTreads()

resetThreadCount

protected void resetThreadCount()

updateThreadCount

protected void updateThreadCount(java.lang.Integer i)

obtainAttribute

protected java.lang.String obtainAttribute(java.lang.String p_sAtt,
                                           java.lang.String p_sDefault)
                                    throws ConfigurationException
Throws:
ConfigurationException

run

public void run()
Loops until controlling process determines
Invokes appropriate Courier to obtain incoming ESB Messages
When one is received, instantiates an action processing pipeline to process it

Specified by:
run in interface java.lang.Runnable