> On 2012-02-28 03:48:16, Santhosh Srinivasan wrote:
> > http://svn.apache.org/repos/asf/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/XCommand.java,
> >  line 234
> > <https://reviews.apache.org/r/4035/diff/3/?file=86114#file86114line234>
> >
> >     Same comment as Mohammad - can you check how to optimize this?
> >     
> >     Ref:
> >     http://www.cs.wustl.edu/~schmidt/PDF/DC-Locking.pdf
> >     http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

interesting read and it is very common to use in the singelton pattern in which 
we write once and read a lot. In this case,it will be great to optimize on the 
reads. mainly to avoid the synchronization in the common case which is reading. 
The main goal here is to avoid a needless thread contention in case of reads.

In our case it is bit different, as our common case is to set the used flag 
[write] which happen for all the commands. Assuming the same command may be 
called from different threads, we should synchronize around the write [avoiding 
two threads set the used flag at the same time and hence continue the execution 
path which may cause a problem]. 

So, if the command is called only once which is our common case, it is 
unavoidable to have this one call go outside the synchronization block.


- Mohamed


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/4035/#review5381
-----------------------------------------------------------


On 2012-02-27 23:05:10, Mohamed Battisha wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/4035/
> -----------------------------------------------------------
> 
> (Updated 2012-02-27 23:05:10)
> 
> 
> Review request for oozie.
> 
> 
> Summary
> -------
> 
> While executing an interrupt driven commands it may be executed from the map 
> on one thread and executed from the queue at a different thread 
> This will cause the following exception to be thrown: 
> java.lang.IllegalStateException: CoordChangeXCommand already used. 
> 
> - Avoiding throwing exception in case of interrupts and synchronizing the 
> changes in [used] 
> - Avoiding executing interrupt in case of commands that doesn't need locks
> - Changing the debug message for execute interrupt to explicitly mentioning 
> it is an interrupt command
> 
> 
> This addresses bug OOZIE-684.
>     https://issues.apache.org/jira/browse/OOZIE-684
> 
> 
> Diffs
> -----
> 
>   
> http://svn.apache.org/repos/asf/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/XCommand.java
>  1293381 
> 
> Diff: https://reviews.apache.org/r/4035/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Mohamed
> 
>

Reply via email to