net.sf.xbus.technical
Class ReceiverService

java.lang.Object
  extended by net.sf.xbus.technical.ReceiverService

public class ReceiverService
extends java.lang.Object

ReceiverService runs as a background service and waits for incoming messages to process.

At startup, ReceiverService searches for systems, which receiver ends with "Thread". For every found system, a thread is started to process the messages. The used receivers must extend the ReceiverThreadBase.


Constructor Summary
ReceiverService()
          The constructor should be private to implement the Singleton pattern.
 
Method Summary
static ReceiverService getInstance()
          Returns the one and only instance of the ReceiverService, which implements the Singleton pattern.
 boolean isWatchdogRunning()
           
 void start(boolean insideServletEngine)
          Starts all threads to receive messages and for administration.
 void startAllSystems()
          Starts all configured threads to process message for different systems.
 void startInsideServletEngine()
          Starts all threads to receive messages and for administration.
 void startWithoutServletEngine()
          Starts all threads to receive messages and for administration.
 boolean stop()
          Stops all threads, including the administration threads.
 void stopAllSystems()
          Stops all threads after processing their current message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReceiverService

public ReceiverService()
The constructor should be private to implement the Singleton pattern. But the bootstrapping mechanism needs a public constructor.

Method Detail

getInstance

public static ReceiverService getInstance()
Returns the one and only instance of the ReceiverService, which implements the Singleton pattern. If the object doesn't exist, it is created.

Returns:
the one and only instance of the ReceiverService

start

public void start(boolean insideServletEngine)
           throws XException
Starts all threads to receive messages and for administration.

Parameters:
insideServletEngine - if true, the ReceiverService is running inside a servlet engine
Throws:
XException

startInsideServletEngine

public void startInsideServletEngine()
                              throws XException
Starts all threads to receive messages and for administration. The ReceiverService is running inside a servlet engine.

Throws:
XException

startWithoutServletEngine

public void startWithoutServletEngine()
                               throws XException
Starts all threads to receive messages and for administration. The ReceiverService is not running inside a servlet engine.

Throws:
XException

stop

public boolean stop()
             throws XException
Stops all threads, including the administration threads.

Returns:
true if ReceiverService has been stopped
Throws:
XException

startAllSystems

public void startAllSystems()
                     throws XException
Starts all configured threads to process message for different systems.

Throws:
XException

stopAllSystems

public void stopAllSystems()
                    throws XException
Stops all threads after processing their current message.

Throws:
XException

isWatchdogRunning

public boolean isWatchdogRunning()