public class QueueProcessingThreadSender extends QueueProcessingThread<String> implements MessageSendingQueue
MessageSendingQueue using QueueProcessingThread.Thread.State, Thread.UncaughtExceptionHandlerMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
QueueProcessingThreadSender(@NonNull Client client,
@NonNull String name)
Constructs the sending queue.
|
| Modifier and Type | Method and Description |
|---|---|
void |
beginSending(@NonNull Consumer<String> consumer)
Starts sending messages to the given consumer.
|
protected boolean |
checkReady(@NonNull String message)
Checks if the message can be sent yet, or at all.
|
protected void |
cleanup(@NonNull Queue<String> remainingQueue)
This method is called after the thread has been interrupted.
|
protected @NonNull Client |
getClient()
Gets the client.
|
@NonNull Optional<Consumer<String>> |
getConsumer()
Gets the queue's currently set consumer.
|
void |
pause()
Pauses message sending.
|
protected void |
processElement(@NonNull String message)
Processes an element from the queue.
|
@NonNull Queue<String> |
shutdown()
Closes down shop, interrupts all threads.
|
contains, getQueue, queue, runactiveCount, 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, yieldequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontains, queueprotected void processElement(@NonNull String message)
QueueProcessingThreadprocessElement in class QueueProcessingThread<String>message - next element from the queueprotected boolean checkReady(@NonNull String message)
message - the message to be sentprotected final void cleanup(@NonNull Queue<String> remainingQueue)
QueueProcessingThreadcleanup in class QueueProcessingThread<String>remainingQueue - the queueprotected @NonNull Client getClient()
public void beginSending(@NonNull Consumer<String> consumer)
MessageSendingQueuebeginSending in interface MessageSendingQueueconsumer - the consumer to consumepublic @NonNull Optional<Consumer<String>> getConsumer()
MessageSendingQueuegetConsumer in interface MessageSendingQueuepublic void pause()
MessageSendingQueuepause in interface MessageSendingQueuepublic @NonNull Queue<String> shutdown()
MessageSendingQueueshutdown in interface MessageSendingQueueCopyright © 2013–2021 Kitteh. All rights reserved.