# File lib/celluloid/actor_system.rb, line 99 def assert_inactive @internal_pool.assert_inactive end
# File lib/celluloid/actor_system.rb, line 46 def clear_registry @registry.clear end
# File lib/celluloid/actor_system.rb, line 29 def get_thread @internal_pool.get do Thread.current[:celluloid_actor_system] = self yield end end
# File lib/celluloid/actor_system.rb, line 42 def registered @registry.names end
# File lib/celluloid/actor_system.rb, line 50 def running actors = [] @internal_pool.each do |t| next unless t.role == :actor actors << t.actor.behavior_proxy if t.actor && t.actor.respond_to?(:behavior_proxy) end actors end
# File lib/celluloid/actor_system.rb, line 59 def running? @internal_pool.running? end
Shut down all running actors
# File lib/celluloid/actor_system.rb, line 64 def shutdown actors = running Timeout.timeout(shutdown_timeout) do Logger.debug "Terminating #{actors.size} #{(actors.size > 1) ? 'actors' : 'actor'}..." if actors.size > 0 # Actors cannot self-terminate, you must do it for them actors.each do |actor| begin actor.terminate! rescue DeadActorError end end actors.each do |actor| begin Actor.join(actor) rescue DeadActorError end end @internal_pool.shutdown end rescue Timeout::Error Logger.error("Couldn't cleanly terminate all actors in #{shutdown_timeout} seconds!") actors.each do |actor| begin Actor.kill(actor) rescue DeadActorError, MailboxDead end end ensure @internal_pool.kill clear_registry end
# File lib/celluloid/actor_system.rb, line 103 def shutdown_timeout Celluloid.shutdown_timeout end
# File lib/celluloid/actor_system.rb, line 36 def stack_dump Celluloid::StackDump.new(@internal_pool) end
Launch default services FIXME: We should set up the supervision hierarchy here
# File lib/celluloid/actor_system.rb, line 13 def start within do Celluloid::Notifications::Fanout.supervise_as :notifications_fanout Celluloid::IncidentReporter.supervise_as :default_incident_reporter, STDERR end true end
Generated with the Darkfish Rdoc Generator 2.