public class cMsgCallbackThread extends java.lang.Thread implements cMsgSubscriptionHandle
Modifier and Type | Class and Description |
---|---|
(package private) class |
cMsgCallbackThread.WorkerThread
Class defining threads (which can be run in parallel) that
will run the callback.
|
Modifier and Type | Field and Description |
---|---|
(package private) cMsgCallbackInterface |
callback
Callback to be run.
|
(package private) java.lang.String |
domain
Subscription's domain.
|
(package private) cMsgMessageFull |
message
Place to temporarily store the returned message from a get.
|
(package private) long |
msgCount
Number of messages passed to the callback.
|
(package private) java.lang.String |
subject
Subscription's subject.
|
(package private) java.lang.String |
type
Subscription's type.
|
Constructor and Description |
---|
cMsgCallbackThread(cMsgCallbackInterface callback,
java.lang.Object arg,
java.lang.String domain,
java.lang.String subject,
java.lang.String type)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clearQueue()
Clears the queue of all messages.
|
void |
dieNow(boolean callInterrupt)
This method kills this thread as soon as possible.
|
cMsgCallbackInterface |
getCallback()
Gets the callback object.
|
int |
getCount()
Gets the number of identical subscriptions.
|
java.lang.String |
getDomain()
Gets the domain in which this subscription lives.
|
long |
getMsgCount()
Gets the number of messages passed to the callback.
|
int |
getQueueSize()
Gets the number of messages in the queue.
|
java.lang.String |
getSubject()
Gets the subject of this subscription.
|
java.lang.String |
getType()
Gets the type of this subscription.
|
java.lang.Object |
getUserObject()
Gets the subscription's user object argument.
|
boolean |
isQueueFull()
Returns true if queue is full.
|
void |
pause()
This method stops any further calling of the callback.
|
void |
restart()
This method (re)starts any calling of the callback delayed by the
pause method. |
void |
run()
This method is executed as a thread which starts up the right number of worker threads
|
void |
sendMessage(cMsgMessageFull message)
Put message on a queue of messages waiting to be taken by the callback.
|
void |
setCount(int count)
Sets the number of identical subscriptions.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
java.lang.String domain
java.lang.String subject
java.lang.String type
cMsgCallbackInterface callback
cMsgMessageFull message
long msgCount
public cMsgCallbackThread(cMsgCallbackInterface callback, java.lang.Object arg, java.lang.String domain, java.lang.String subject, java.lang.String type)
callback
- callback to be run when message arrivesarg
- user-supplied argument for callbackdomain
- subscription's domainsubject
- subscription's subjecttype
- subscription's tyoepublic void dieNow(boolean callInterrupt)
callInterrupt
- if true interrupt is called on callback thread,
else interrupt is not called.public void pause()
pause
in interface cMsgSubscriptionHandle
public void restart()
pause
method.
Would like to call this method "resume", but that name is taken by the "Thread" class.restart
in interface cMsgSubscriptionHandle
public long getMsgCount()
getMsgCount
in interface cMsgSubscriptionHandle
public java.lang.String getDomain()
getDomain
in interface cMsgSubscriptionHandle
public java.lang.String getSubject()
getSubject
in interface cMsgSubscriptionHandle
public java.lang.String getType()
getType
in interface cMsgSubscriptionHandle
public int getQueueSize()
getQueueSize
in interface cMsgSubscriptionHandle
public boolean isQueueFull()
isQueueFull
in interface cMsgSubscriptionHandle
public void clearQueue()
clearQueue
in interface cMsgSubscriptionHandle
public cMsgCallbackInterface getCallback()
getCallback
in interface cMsgSubscriptionHandle
public java.lang.Object getUserObject()
getUserObject
in interface cMsgSubscriptionHandle
public int getCount()
public void setCount(int count)
count
- the number of identical subscriptionspublic void sendMessage(cMsgMessageFull message)
message
- message to be passed to callbackpublic void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread