net.sf.xbus.technical
Class ReceiverThreadManager

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

public class ReceiverThreadManager
extends java.lang.Object

Manages the state of all receivers running in the background. This class implements the Singleton design pattern.


Field Summary
protected static int DEFAULT_STOP_AFTER_ERRORS
          Default for the amount of errors, after them a receiver will be stopped.
 
Method Summary
 void clearStoppedHTTPReceivers()
          Clears the list of all stopped HTTPReceivers.
 void demandStopReceiverThread(java.lang.String system)
          Demands the stop of the ReceiverThread for the given system.
 java.util.Set getAllReceiverThreads()
          Returns a set with the names of all ReceiverThreads found in the Configuration.
 java.util.Set getAllSystems()
          Returns a set with the names of all background receivers (ReceiverThreads and HTTPReceivers) found in the Configuration.
static ReceiverThreadManager getInstance()
          Returns the one and only object of class ReceiverThreadManager.
protected  java.util.Set getRunningHTTPReceivers()
          Returns a set with the names of all running HTTPReceivers.
 java.util.Set getRunningReceiverThreads()
          Returns a set with the names of all running ReceiverThreads.
 java.util.Set getRunningSystems()
          Returns a set with the names of all running background receivers (ReceiverThreads and HTTPReceivers).
static int getStopAfterErrors(java.lang.String system, java.lang.String receiverClassName)
          Returns the amount of errors, after them a receiver will be stopped The value is read out of the configuration, either a default for the receiver class or a value specific for the current source.
 java.util.Set getStoppedSystems()
          Returns a set with the names of all stopped background receivers (ReceiverThreads and HTTPReceivers).
 boolean isHTTPReceiverStopped(java.lang.String system)
          Indicates whether a HTTPReceiver is stopped
protected  void setIsServletEngine(boolean isServletEngine)
          Indicates whether the ReceiverService is started inside a servlet engine.
 void startReceiverThread(java.lang.String system)
          Starts a ReceiverThread for the given system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_STOP_AFTER_ERRORS

protected static final int DEFAULT_STOP_AFTER_ERRORS
Default for the amount of errors, after them a receiver will be stopped.

See Also:
Constant Field Values
Method Detail

getInstance

public static ReceiverThreadManager getInstance()
Returns the one and only object of class ReceiverThreadManager.

Returns:
the one and only object of class ReceiverThreadManager

startReceiverThread

public void startReceiverThread(java.lang.String system)
                         throws XException
Starts a ReceiverThread for the given system.

Parameters:
system - the name of the system to start the receiver for
Throws:
XException - if something goes wrong

demandStopReceiverThread

public void demandStopReceiverThread(java.lang.String system)
                              throws XException
Demands the stop of the ReceiverThread for the given system.

Parameters:
system - the name of the system to stop the receiver for
Throws:
XException - if something goes wrong

getAllReceiverThreads

public java.util.Set getAllReceiverThreads()
Returns a set with the names of all ReceiverThreads found in the Configuration.

Returns:
the names of all ReceiverThreads found in the Configuration

getAllSystems

public java.util.Set getAllSystems()
                            throws XException
Returns a set with the names of all background receivers (ReceiverThreads and HTTPReceivers) found in the Configuration.

Returns:
the names of all background receivers found in the Configuration
Throws:
XException - if something goes wrong

getRunningSystems

public java.util.Set getRunningSystems()
                                throws XException
Returns a set with the names of all running background receivers (ReceiverThreads and HTTPReceivers).

Returns:
the names of all running background receivers
Throws:
XException - if something goes wrong

getRunningReceiverThreads

public java.util.Set getRunningReceiverThreads()
Returns a set with the names of all running ReceiverThreads.

Returns:
the names of all running ReceiverThreads

getRunningHTTPReceivers

protected java.util.Set getRunningHTTPReceivers()
                                         throws XException
Returns a set with the names of all running HTTPReceivers.

Returns:
the names of all running HTTPReceivers
Throws:
XException - if something goes wrong

getStoppedSystems

public java.util.Set getStoppedSystems()
Returns a set with the names of all stopped background receivers (ReceiverThreads and HTTPReceivers).

Returns:
the names of all stopped background receivers

setIsServletEngine

protected void setIsServletEngine(boolean isServletEngine)
Indicates whether the ReceiverService is started inside a servlet engine.

Parameters:
isServletEngine - true if the ReceiverService is running in a servlet engine

clearStoppedHTTPReceivers

public void clearStoppedHTTPReceivers()
Clears the list of all stopped HTTPReceivers.


isHTTPReceiverStopped

public boolean isHTTPReceiverStopped(java.lang.String system)
Indicates whether a HTTPReceiver is stopped

Parameters:
system - the name of the system
Returns:
true if the HTTPReceiver is stopped, false otherwise

getStopAfterErrors

public static int getStopAfterErrors(java.lang.String system,
                                     java.lang.String receiverClassName)
Returns the amount of errors, after them a receiver will be stopped The value is read out of the configuration, either a default for the receiver class or a value specific for the current source. If no value is specified in the configuration, a hard coded default is used.

Parameters:
system - the name of the system
receiverClassName - the name of the receiver class
Returns:
the amount of errors, after them a receiver will be stopped