Building an announcement spy in

Hi

To help us understand the behavior of announcements, Thierry Goubier wrote a simple script that monitors key methods of the framework. Really nice and powerful.

 

image.png

| c1 c2 c3 n1 n2 n3 l1 l2 l3 |
c1 := c2 := c3 := 0.
n1 := (Announcer>>#announce:) ast.
n2 := #(subscribe:do: subscribe:send:to: basicSubscribe:) collect: [ :e | (Announcer>>e) ast ].
n3 := #(unsubscribe: removeSubscription:) collect: [ :e | (Announcer>>e) ast ].
l1 := MetaLink new metaObject: [ c1 := c1 + 1 ]; selector: #value.
l2 := MetaLink new metaObject: [ c2 := c2 + 1 ]; selector: #value.
l3 := MetaLink new metaObject: [ c3 := c3 + 1 ]; selector: #value.
[ n1 link: l1. n2 do: [ :e | e link: l2 ]. n3 do: [ :e | e link: l3 ].
(Duration minutes: 1) wait.
n1 removeLink: l1. n2 do: [ :e | e removeLink: l2 ]. n3 do: [ :e | e removeLink: l3 ].
{ 'announce' -> c1. 'subscribe' -> c2.  'unsubscribe' -> c3 } inspect ] forkAt: Processor userBackgroundPriority
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: