|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.xbus.technical.ReceiverThreadBase
public abstract class ReceiverThreadBase
Classes implementing the ReceiverThreadBase
are running as
background threads to process messages when they arrive. These classes are
executed by the ReceiverService
.
Field Summary | |
---|---|
protected static int |
DEFAULT_ERROR_TIMEOUT
Default for the time to wait after an error has occured. |
protected static int |
DEFAULT_TIMEOUT
Default for the time to wait after the successful processing of a message. |
Constructor Summary | |
---|---|
ReceiverThreadBase(XBUSSystem source)
Stores the interface name |
Method Summary | |
---|---|
protected boolean |
checkProceed()
Returns a boolean value that indicates whether the thread shall continue to process messages. |
protected abstract java.lang.String |
getAddress()
Returns the address of a received message, used for example in the tracing. |
protected long |
getErrorTimeout()
Returns the time to wait after an error has occured. |
protected abstract java.lang.String |
getReceiverClassName()
Returns the name of the receiver class, used for example to determine values in the configuration. |
protected XBUSSystem |
getSource()
Returns the source of the messages. |
protected long |
getTimeout()
Returns the time to wait after the successful processing of a message. |
protected void |
incrementErrorCounter()
Increments the error counter. |
protected void |
initializeErrorCounter()
Initializes the error counter to 0. |
protected abstract void |
initializeThread()
Initialization of the the thread, called in the beginning, before the loop for processing messages starts. |
void |
interruptThread()
interruptThread shall interrupt the loop of receiving and
processing messages and cause the thread to stop. |
protected abstract java.lang.Object |
receive()
Receives one message. |
protected abstract void |
registerResources(TAManager taManager)
Because the thread clears the list of transactional resources each time after processing a message, this method is called before reading the next message to register a receiver resource in the transaction manager. |
void |
run()
Receives and processes messages for one system. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.xbus.technical.Receiver |
---|
getType |
Field Detail |
---|
protected static final int DEFAULT_ERROR_TIMEOUT
protected static final int DEFAULT_TIMEOUT
Constructor Detail |
---|
public ReceiverThreadBase(XBUSSystem source)
source
- name of the interface definitionMethod Detail |
---|
public void run()
run
in interface java.lang.Runnable
protected abstract void initializeThread() throws XException
XException
- if something goes wrongprotected abstract void registerResources(TAManager taManager) throws XException
taManager
- the transaction manager in which the resources shall be
registered
XException
- if something goes wrongprotected abstract java.lang.Object receive() throws XException
null
when no message has
been available
XException
- if something goes wrongprotected abstract java.lang.String getReceiverClassName()
protected abstract java.lang.String getAddress()
public void interruptThread()
interruptThread
shall interrupt the loop of receiving and
processing messages and cause the thread to stop. It is invoked by the
ReceiverService
on shutdown or restart.
protected boolean checkProceed()
protected void incrementErrorCounter()
protected void initializeErrorCounter()
protected XBUSSystem getSource()
protected long getErrorTimeout()
protected long getTimeout()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |