Package com.example.server.handler
Interface MessageQueue<T>
- All Known Implementing Classes:
LinkedListMessageQueue
,MessageQueueExecutor
public interface MessageQueue<T>
The MessageQueue interface represents a queue for storing and retrieving messages of type T.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a message to the queue.int
Gets the number of threads currently accessing the message queue.Gets the next message in the queue.void
shutdown()
Shuts down the message queue, stopping any further messages from being added or retrieved.
-
Method Details
-
add
Adds a message to the queue.- Parameters:
message
- the message to be added
-
getNextMessage
T getNextMessage()Gets the next message in the queue.- Returns:
- the next message in the queue
-
shutdown
void shutdown()Shuts down the message queue, stopping any further messages from being added or retrieved. -
getCountThreads
int getCountThreads()Gets the number of threads currently accessing the message queue.- Returns:
- the number of threads accessing the message queue
-