Class EngineLock

java.lang.Object
net.simplace.sim.wrapper.EngineLock

public final class EngineLock extends Object
Process-wide lock for all calls into the engine by servers that use SimplaceWrapper from several threads (REST wrapper net.simplace.sim.wrapper.rest, web client net.simplace.sim.wrapper.web).

FWSimEngine is a classic singleton (static fields, process-wide directories): ProjectControler, ResourceManager and OutputManager are implicitly connected through it, even though each session has its own FWSimSession. Every server holds this lock while it prepares, runs, steps, reads results or shuts a session down, so two requests never work in the engine at the same time - also when REST and web client run in one JVM (e.g. in the unit tests). It lives here, next to SimplaceWrapper, and not in one of the servers, because it belongs to the engine and not to a server. Plain JDK class: simplace_core stays free of the server libraries (lib/rest).

Author:
Andreas Enders, Claude (Anthropic), co-author
  • Field Details

    • LOCK

      public static final ReentrantLock LOCK
      The lock; hold it around every call into the engine (lock/unlock in try/finally).