Class CoordinatorThread

java.lang.Object
modelarium.multithreading.CoordinatorThread
All Implemented Interfaces:
Runnable

public class CoordinatorThread extends Object implements Runnable
Coordinator thread responsible for managing synchronised access to shared simulation state between multiple worker threads in a parallel simulation.

This class listens to the request queue and uses CoordinatorRequestHandler to respond to agent/environment-related queries or updates.

  • Constructor Details

    • CoordinatorThread

      public CoordinatorThread(String name, ModelSettings settings, Environment environment, RequestResponseController requestResponseController)
      Constructs the coordinator thread with required references.
      Parameters:
      name - the thread name or ID
      settings - global model settings
      environment - the shared simulation environment
      requestResponseController - the controller managing request/response queues
    • CoordinatorThread

      public CoordinatorThread(String name, ModelSettings settings, Environment environment, RequestResponseController requestResponseController, AgentSet globalAgentSet)
      Constructs the coordinator thread with required references.
      Parameters:
      name - the thread name or ID
      settings - global model settings
      environment - the shared simulation environment
      requestResponseController - the controller managing request/response queues
      globalAgentSet - the global agent set for the whole model
  • Method Details

    • shutdown

      public void shutdown()
      Signals the coordinator thread to stop processing and terminate.
    • run

      public void run()
      Main execution loop for the coordinator thread.

      Continuously listens for requests from worker threads and processes them.

      Specified by:
      run in interface Runnable