Module: Julewire::Core::RuntimeRegistry
- Defined in:
- lib/julewire/core/runtime_registry.rb
Class Method Summary collapse
- .clear! ⇒ Object
- .fetch(name, current: RuntimeLocator.current) ⇒ Object
- .reset_after_fork(primary:) ⇒ Object
Class Method Details
.clear! ⇒ Object
24 25 26 27 |
# File 'lib/julewire/core/runtime_registry.rb', line 24 def clear! @mutex.synchronize { @runtimes.clear } nil end |
.fetch(name, current: RuntimeLocator.current) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/julewire/core/runtime_registry.rb', line 13 def fetch(name, current: RuntimeLocator.current) name = Core.normalize_name(name, name: "runtime name") return current if name == DEFAULT_NAME unless current.is_a?(Runtime) raise Error, "named Julewire runtimes are not available from the current runtime" end @mutex.synchronize { @runtimes[name] ||= Runtime.new } end |
.reset_after_fork(primary:) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/julewire/core/runtime_registry.rb', line 29 def reset_after_fork(primary:) # Post-fork execution is single-threaded; do not touch inherited locks # before rebuilding them. runtimes = ([primary] + @runtimes.values).uniq @mutex = Mutex.new LocalStorage.after_fork! ContextStore.reset_current! Scheduling::SharedScheduler.after_fork! Diagnostics::ProcessIntegrationHealth.after_fork! Integration::ForkHooks.after_fork! Diagnostics::InvalidSeverityReporter.reset_after_fork! runtimes.each(&:reset_after_fork_runtime!) Integration::ForkHooks.run nil end |