Details
-
Bug
-
Status: Resolved
-
Resolution: Done
-
unspecified
-
None
-
None
-
Operating System: All
Platform: All
-
1729
Description
Just like queue in PipelineOrchestratorImpl, events in EventDispatcherImpl should be volatile since it is expected to be modified by different threads.
===
Ref gerrit in which Madhu fixes a similar issue in PipelineOrchestratorImpl:
https://git.opendaylight.org/gerrit/#/c/10843/
===
[07:32:22] <flaviof> Madhu: don't u need to make queue volatile ?
[07:32:43] <@Madhu> flaviof: why ?
[07:32:47] <flaviof> bc there are 2 threads using it in your case
[07:33:03] <@Madhu> well... yes it is preferred ![]()
[07:33:13] <@Madhu> flaviof: but not mandatory i hope
[07:33:20] <@Madhu> in that case.... EventDispatcherImpl is in trouble too ![]()
[07:33:42] <dave_tucker> Madhu well there could be a case where the queue has been updated but it's not visible to the other thread
[07:33:53] <dave_tucker> hence volatile would make perfect sense here
[07:33:56] <@Madhu> dave_tucker: what case is that ?
[07:34:06] <@Madhu> dave_tucker: yep agreed. volatile make sense
[07:34:13] dave_tucker looks to code for answers
[07:34:26] <@Madhu> but am still trying to understand why EventDispatcherImpl works
[07:34:54] <@Madhu> dave_tucker: flaviof could it be because am using a "String" Object ?
[07:35:01] <dave_tucker> Madhu i was thinking that
[07:35:02] Madhu remembers String Objects are special in java ![]()
[07:35:12] <flaviof> Madhu: you are right, i dnot know how/why eventDispatcher does not suffer from the same disease
[07:35:45] <@Madhu> flaviof: dave_tucker but i agree having volatile is good to have.