[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mylyn-dev] Notifying of notifications isn't thread safe, and should be doc'ed as such

(or fix it in the framework…)

 

Just wanted to share my experience using Notifications.getService.notify(List<AbstractNotification>). We found that if you call that from multiple threads concurrently, there’s a loss of notification due to an exception that occurs (in a pretty silly way frankly) in PopupNotificationSink:

 

“notify” always calls “setSystem” on the Job. Eclipse throws an exception when that method is called while a Job is in any state other than NONE (so if the job is running…)

 

Now, you could avoid this exception by simply not calling setSystem each time – call it at Job construction time (the runSystem is a final boolean…)

 

Or, if you don’t want to promise thread-safety, doc it. But I think a notification thing like this should definitely, in its framework, be thread safe.

 

-          Eddie