Class: Celluloid::Probe
Constant Summary
collapse
- NOTIFICATIONS_TOPIC_BASE =
"celluloid.events.%s"
- EVENTS_BUFFER =
Queue.new
Constants included
from Celluloid
CPUCounter, Links, Logger, Properties, Registry, StackDump, ThreadHandle, UUID
Class Method Summary
collapse
Instance Method Summary
collapse
notifier, publish, #subscribe, #unsubscribe
Methods included from Celluloid
publish
Constructor Details
#initialize ⇒ Probe
Returns a new instance of Probe.
60
61
62
|
# File 'lib/celluloid/probe.rb', line 60
def initialize
async.process_queue
end
|
Class Method Details
.actor_created(actor) ⇒ Object
23
24
25
|
# File 'lib/celluloid/probe.rb', line 23
def actor_created(actor)
trigger_event(:actor_created, actor)
end
|
.actor_died(actor) ⇒ Object
31
32
33
|
# File 'lib/celluloid/probe.rb', line 31
def actor_died(actor)
trigger_event(:actor_died, actor)
end
|
.actor_named(actor) ⇒ Object
27
28
29
|
# File 'lib/celluloid/probe.rb', line 27
def actor_named(actor)
trigger_event(:actor_named, actor)
end
|
.actors_linked(a, b) ⇒ Object
35
36
37
38
39
|
# File 'lib/celluloid/probe.rb', line 35
def actors_linked(a, b)
a = find_actor(a)
b = find_actor(b)
trigger_event(:actors_linked, a, b)
end
|
.run ⇒ Object
14
15
16
17
|
# File 'lib/celluloid/probe.rb', line 14
def run
supervise_as(:probe_actor) unless Actor[:probe_actor] && Actor[:probe_actor].alive?
end
|
.run_without_supervision ⇒ Object
19
20
21
|
# File 'lib/celluloid/probe.rb', line 19
def run_without_supervision
Actor[:probe_actor] = Celluloid::Probe.new
end
|
Instance Method Details
#dispatch_event(cmd, args) ⇒ Object
71
72
73
|
# File 'lib/celluloid/probe.rb', line 71
def dispatch_event(cmd, args)
publish(NOTIFICATIONS_TOPIC_BASE % cmd, args)
end
|
#process_queue ⇒ Object
64
65
66
67
68
69
|
# File 'lib/celluloid/probe.rb', line 64
def process_queue
until EVENTS_BUFFER.empty?
event = EVENTS_BUFFER.pop
dispatch_event(*event)
end
end
|