Package com.example.server.handler
Class LinkedListMessageQueue<T>
java.lang.Object
com.example.server.handler.LinkedListMessageQueue<T>
- All Implemented Interfaces:
MessageQueue<T>
Queue for message processing
-
Constructor Summary
ConstructorsConstructorDescriptionLinkedListMessageQueue
(int minThreads, int maxThreads, MessageHandler<T> messageHandler) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add new message - request in processingint
Get number of threads in poolGet the request from queuevoid
shutdown()
Stop the queue processing
-
Constructor Details
-
LinkedListMessageQueue
-
-
Method Details
-
add
Add new message - request in processing- Specified by:
add
in interfaceMessageQueue<T>
- Parameters:
message
- the message to be added
-
getNextMessage
Get the request from queue- Specified by:
getNextMessage
in interfaceMessageQueue<T>
- Returns:
- the next message in the queue
-
shutdown
public void shutdown()Stop the queue processing- Specified by:
shutdown
in interfaceMessageQueue<T>
-
getCountThreads
public int getCountThreads()Get number of threads in pool- Specified by:
getCountThreads
in interfaceMessageQueue<T>
- Returns:
- the number of threads accessing the message queue
-