A proxy which controls the Actor lifecycle
# File lib/celluloid/proxy/actor.rb, line 5 def initialize(mailbox, thread) @mailbox = mailbox @thread = thread end
# File lib/celluloid/proxy/actor.rb, line 17 def alive? @mailbox.alive? end
# File lib/celluloid/proxy/actor.rb, line 21 def dead? !alive? end
# File lib/celluloid/proxy/actor.rb, line 10 def inspect # TODO: use a system event to fetch actor state: tasks? "#<Celluloid::Proxy::Actor(#{@mailbox.address}) alive>" rescue DeadActorError "#<Celluloid::Proxy::Actor(#{@mailbox.address}) dead>" end
Terminate the associated actor
# File lib/celluloid/proxy/actor.rb, line 26 def terminate terminate! ::Celluloid::Actor.join(self) nil end
Terminate the associated actor asynchronously
# File lib/celluloid/proxy/actor.rb, line 33 def terminate! ::Kernel.raise ::Celluloid::DeadActorError, "actor already terminated" unless alive? @mailbox << ::Celluloid::TerminationRequest.new end