MentionProvider losing event handlers

3 views
Skip to first unread message

harmanjd

unread,
Nov 17, 2009, 1:31:55 PM11/17/09
to TalkingPuffin
I am seeing a problem in using the DataProvider class.

I have registered a listener (Reactor) to my MentionsProvider as
follows:

listenTo(mentionsProvider);

reactions += {
case evt: NewTwitterDataEvent => {
val newTweets = evt.data.asInstanceOf[List[TwitterStatus]]
log.info("Tweets Arrived: " + newTweets.length)
processStatuses(newTweets)
}
}


This works sometimes just fine. However, sometimes after a couple of
NewTwitterDataEvents are sent this reaction is lost on the
DataProvider and doesn't get called anymore.

Has anybody seen similar problems with the DataProvider or with the
Publisher/Reactor usage in scala ?

Thanks,
James

Dave Briccetti

unread,
Nov 17, 2009, 1:43:33 PM11/17/09
to TalkingPuffin
Hi James. Are you keeping a reference to the Reactor? The listenTo
references can get garbage collected. They are soft or weak (I forget
which). See DataProvidersDialog, look for “val reactors = ... map ...
new Reactor” for how I dealt with this.

harmanjd

unread,
Nov 17, 2009, 3:10:18 PM11/17/09
to TalkingPuffin
Perfect thanks. I was starting to wonder about the WeakReference
stuff I found in Publisher and how to force it to make it a
StrongReference.
Reply all
Reply to author
Forward
0 new messages