Class RequestResponseController
java.lang.Object
modelarium.multithreading.requestresponse.RequestResponseController
Central controller for managing the request and response queues used in
synchronised, multithreaded agent-based simulations.
This class acts as a message broker between worker threads and the coordinator thread,
ensuring safe, concurrent access to both queues via BlockingQueue.
Each thread can obtain a thread-safe RequestResponseInterface instance
tied to its name for interacting with the controller.
-
Constructor Summary
ConstructorsConstructorDescriptionRequestResponseController(ModelSettings settings) Constructs a new request-response controller for coordinating simulation threads. -
Method Summary
Modifier and TypeMethodDescriptiongetInterface(String name) Creates and returns aRequestResponseInterfacefor a given thread name.Returns the shared request queue.Returns the shared response queue.
-
Constructor Details
-
RequestResponseController
Constructs a new request-response controller for coordinating simulation threads.- Parameters:
settings- the shared model settings used across threads
-
-
Method Details
-
getRequestQueue
Returns the shared request queue.- Returns:
- the request queue
-
getResponseQueue
Returns the shared response queue.- Returns:
- the response queue
-
getInterface
Creates and returns aRequestResponseInterfacefor a given thread name. This interface wraps queue operations and helps manage request lifecycles.- Parameters:
name- the name of the requesting thread- Returns:
- a new
RequestResponseInterfaceinstance for the caller
-