org.mobicents.protocols.smpp.event
Class TaskExecutorEventDispatcher

java.lang.Object
  extended by org.mobicents.protocols.smpp.event.AbstractEventDispatcher
      extended by org.mobicents.protocols.smpp.event.TaskExecutorEventDispatcher
All Implemented Interfaces:
EventDispatcher

public class TaskExecutorEventDispatcher
extends AbstractEventDispatcher

Implementation of the EventDispatcher that uses Java's Executor framework to dispatch events. If no other executor is supplied, then a ThreadPoolExecutor will be created at init() time.

The number of threads created in the ThreadPoolExecutor is determined from the threadCount property, which by default is set to 0. If the application does not override this value, then the APIConfig will be consulted for the APIConfig.EVENT_THREAD_POOL_SIZE property. If no value is set there, then a default value of 3 will be used.


Constructor Summary
TaskExecutorEventDispatcher()
           
 
Method Summary
 void destroy()
          Event dispatcher clean up.
 Executor getExecutor()
           
 void init()
          Initialise the event dispatcher.
 void notifyObservers(Session conn, SMPPEvent event)
          Notify all registered observers of an SMPP event.
 void notifyObservers(Session conn, SMPPPacket packet)
          Notify all registered observers of a received SMPP packet.
 void setExecutor(Executor executor)
           
 void setThreadCount(int threadCount)
          Set the number of threads to create in a ThreadPoolExecutor for event dispatching.
 
Methods inherited from class org.mobicents.protocols.smpp.event.AbstractEventDispatcher
addObserver, contains, getObserverList, getObservers, observerIterator, removeObserver, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskExecutorEventDispatcher

public TaskExecutorEventDispatcher()
Method Detail

destroy

public void destroy()
Description copied from interface: EventDispatcher
Event dispatcher clean up. The destroy method will be called by the Connection when it is finished delivering events to it and the receiver daemon thread is exiting. Any initialising done in the init method can be cleaned up here.

The destroy method must not interfere with the delivery of any events notified to the event dispatcher before the call to this method.


init

public void init()
Description copied from interface: EventDispatcher
Initialise the event dispatcher. The init method will be called by the Connection before it makes any attempt to add any observers or deliver any events via the dispatcher.


notifyObservers

public void notifyObservers(Session conn,
                            SMPPEvent event)
Description copied from interface: EventDispatcher
Notify all registered observers of an SMPP event.

event - the SMPP event to notify observers of.

notifyObservers

public void notifyObservers(Session conn,
                            SMPPPacket packet)
Description copied from interface: EventDispatcher
Notify all registered observers of a received SMPP packet.

packet - the SMPP packet to notify observers of.

setThreadCount

public void setThreadCount(int threadCount)
Set the number of threads to create in a ThreadPoolExecutor for event dispatching. This property is ignored if an executor is directly set on this object.

Parameters:
threadCount - The number of threads to create in the thread pool.

getExecutor

public Executor getExecutor()

setExecutor

public void setExecutor(Executor executor)


Copyright © 2011 Mobicents. All Rights Reserved.