Understand Manifold's execution model and thread pools
masterManifold separates the logic of what happens from the execution model of when and where it happens. By default, Manifold conforms to the surrounding execution model: messages are processed on the thread they were originally put! on. This means Manifold can be used safely alongside other frameworks.
Under certain conditions, Manifold lazily constructs three specialized thread pools:
- wait-pool: Used for waiting on blocking operations (e.g.,
java.util.BlockingQueue, Clojure seqs,java.util.concurrent.Future, or Clojure promises). - execute-pool: Used to execute bodies within
manifold.deferred/future. - scheduler-pool: Used for delayed tasks, periodic tasks, or timeouts (e.g.,
manifold.time/in,manifold.time/every,manifold.stream/periodically).
Statistics for the wait-pool and execute-pool can be monitored using manifold.executor/register-wait-pool-stats-callback and manifold.executor/register-execute-pool-stats-callback respectively.