A simple Java project simulating communication between two players (INITIATOR
and RECEIVER
) using threads and blocking queues.
This project demonstrates a clean and dynamic design for inter-thread communication where:
- Messages are sent from an initiator to a receiver.
- Responses are concatenated and logged by the initiator.
- The simulation terminates gracefully after a predefined number of exchanges.
- Two dynamically named players (
INITIATOR
andRECEIVER
). - Inter-thread communication using
BlockingQueue
. - Concatenated message exchange logged for the initiator.
- Graceful termination using a special "TERMINATE" signal.
- Minimal dependencies: Pure Java with no external libraries.
- The initiator sends messages to the receiver.
- The receiver processes each message and sends a response back to the initiator.
- Each response is appended to a concatenated message log maintained by the initiator.
- After 10 message exchanges, the initiator sends a termination signal to stop the receiver.
- Both threads terminate gracefully.
- Clone the repository:
git clone https://github.com/yourusername/MessageExchangeSimulation.git cd MessageExchangeSimulation