> On okt. 12, 2016, 4:03 du, András Piros wrote:
> > sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/AMRMCallBackHandler.java,
> >  line 41
> > <https://reviews.apache.org/r/52737/diff/1/?file=1530508#file1530508line41>
> >
> >     Why `synchronized`? I don't see we reach out to global state, or shared 
> > resources.

This method is called from a separate thread asynchronously, then we check the 
error from main. Perhaps I should add some comments.


> On okt. 12, 2016, 4:03 du, András Piros wrote:
> > sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/AMRMCallBackHandler.java,
> >  line 59
> > <https://reviews.apache.org/r/52737/diff/1/?file=1530508#file1530508line59>
> >
> >     Why `synchronized`? I don't see we reach out to global state, or shared 
> > resources.

See my comment above.


> On okt. 12, 2016, 4:03 du, András Piros wrote:
> > sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/AMRMCallBackHandler.java,
> >  line 68
> > <https://reviews.apache.org/r/52737/diff/1/?file=1530508#file1530508line68>
> >
> >     Why `synchronized`? I don't see we reach out to global state, or shared 
> > resources.

See my comment above.


> On okt. 12, 2016, 4:03 du, András Piros wrote:
> > sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/HdfsAndLocalFSOperations.java,
> >  line 57
> > <https://reviews.apache.org/r/52737/diff/1/?file=1530511#file1530511line57>
> >
> >     What about using `Files#walkFileTree` instead?
> >     
> >     
> > https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#walkFileTree(java.nio.file.Path,%20java.util.Set,%20int,%20java.nio.file.FileVisitor)

This sounds like a good idea:)


> On okt. 12, 2016, 4:03 du, András Piros wrote:
> > sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherAM.java,
> >  line 470
> > <https://reviews.apache.org/r/52737/diff/1/?file=1530512#file1530512line470>
> >
> >     Why not use `AtomicReference#compareAndSet()` instead?

We have to use some holder object here because we mutate state inside an anon 
class. A simple boolean wouldn't do it. MutableObject<Boolean> probably would 
be better here but it's in commons-lang3 and don't think it's available on the 
classpath.

I'm going to add a comment to clarify this.


> On okt. 12, 2016, 4:03 du, András Piros wrote:
> > sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/PrepareActionsHandler.java,
> >  line 67
> > <https://reviews.apache.org/r/52737/diff/1/?file=1530516#file1530516line67>
> >
> >     Why is `operation` a `String`?

Fair point: this is old code - didn't want to modify it (yet!).


> On okt. 12, 2016, 4:03 du, András Piros wrote:
> > sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/HdfsAndLocalFSOperations.java,
> >  line 38
> > <https://reviews.apache.org/r/52737/diff/1/?file=1530511#file1530511line38>
> >
> >     I'd separate concerns to different classes.

Makes sense - done


> On okt. 12, 2016, 4:03 du, András Piros wrote:
> > sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/PrepareActionsHandler.java,
> >  line 89
> > <https://reviews.apache.org/r/52737/diff/1/?file=1530516#file1530516line89>
> >
> >     `Charsets.UTF_8.toString()`

Done


- Peter


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


On okt. 11, 2016, 1:42 du, Peter Bacsko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/52737/
> -----------------------------------------------------------
> 
> (Updated okt. 11, 2016, 1:42 du)
> 
> 
> Review request for oozie, András Piros, Attila Sasvari, Peter Cseh, and 
> Robert Kanter.
> 
> 
> Repository: oozie-git
> 
> 
> Description
> -------
> 
> This review contains a suggested approach for refactoring LauncherAM on the 
> OYA branch.
> 
> The main idea is to inject all dependencies of the class via the constructor. 
> In some cases, this requires factory objects. Note that this is necessary 
> because in unit tests, because we don't want to create actual resources such 
> as UGI or async ResourceManager callback.
> 
> In the tests, we can instantiate this class with mocks. The testability is 
> greatly enhanced because various checks and verifications can be performed on 
> the mocks. Tests are currently not in this review (see 
> https://issues.apache.org/jira/browse/OOZIE-2685).
> 
> 
> Diffs
> -----
> 
>   core/src/test/java/org/apache/oozie/action/hadoop/TestLauncherAM.java 
> ed29299 
>   
> sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/AMRMCallBackHandler.java
>  PRE-CREATION 
>   
> sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/AMRMClientAsyncFactory.java
>  PRE-CREATION 
>   
> sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/ErrorHolder.java 
> PRE-CREATION 
>   
> sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/HdfsAndLocalFSOperations.java
>  PRE-CREATION 
>   sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherAM.java 
> 85d78c6 
>   
> sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherAMCallbackNotifier.java
>  23648b8 
>   
> sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherAMCallbackNotifierFactory.java
>  PRE-CREATION 
>   
> sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/PrepareActionsDriver.java
>  4a51d48 
>   
> sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/PrepareActionsHandler.java
>  PRE-CREATION 
>   
> sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/SequenceFileWriterFactory.java
>  PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/52737/diff/
> 
> 
> Testing
> -------
> 
> Unit tests are being written right now.
> 
> 
> Thanks,
> 
> Peter Bacsko
> 
>

Reply via email to