> On Nov. 11, 2014, 7:27 p.m., John Speidel wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java,
> >  line 221
> > <https://reviews.apache.org/r/27700/diff/2/?file=754419#file754419line221>
> >
> >     Should consider using an executor instead of directly creating threads 
> > here.  This will simplify and provide more flexibility if we choose to 
> > change the concurrency strategy for server tasks.  Generally using an 
> > executor is preferred to rolling your own unless you have a really good 
> > reason to do otherwise.
> 
> Robert Levas wrote:
>     I started out using the exsting Executor class(es) but found there was 
> little control over timing out a thread.  In order to timeout a thread, you 
> would need to do more work than the simple roll-my-own mechanism since no 
> apparent built-in mechanism exists.
> 
> John Speidel wrote:
>     It wouldn't really be much different other than the blocking mechanism.  
> Instead of calling join() you would call get(timeout) on the tasks Future 
> which is returned from submit().  Then you could check it's state and if it 
> wasn't completed call interrupt() as you are now.
> 
> Robert Levas wrote:
>     It is still not clear to me why that is better then my current 
> implementation.

Using an executor has 2 primary advantages.  
- don't have to keep creating threads
- easier to change the concurrency model in the future by simply changing the 
execotor implementation

Your implementation is correct and since we are only using a single thread at a 
time it isn't very complicated so I will not persue this issue.


- John


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


On Nov. 12, 2014, 1:43 a.m., Robert Levas wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/27700/
> -----------------------------------------------------------
> 
> (Updated Nov. 12, 2014, 1:43 a.m.)
> 
> 
> Review request for Ambari, dilli dorai, Jonathan Hurley, John Speidel, Nate 
> Cole, Robert Nettleton, and Sid Wagle.
> 
> 
> Bugs: AMBARI-7985
>     https://issues.apache.org/jira/browse/AMBARI-7985
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Ambari currently handles client-/agent-side commands; however there is no 
> ability to handle server-side commands. Server-side commands should be 
> specified as a task in a stage and managed along with the stage.
> 
> 
> Diffs
> -----
> 
>   
> ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java
>  1f99b4a 
>   
> ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
>  5e879cc 
>   
> ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionManager.java
>  e2fad5f 
>   
> ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
>  81fee75 
>   
> ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java 
> bbc5ac3 
>   
> ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
>  d74510a 
>   
> ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
>  6920a9e 
>   
> ambari-server/src/main/java/org/apache/ambari/server/serveraction/AbstractServerAction.java
>  PRE-CREATION 
>   
> ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerAction.java
>  be885b5 
>   
> ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
>  PRE-CREATION 
>   
> ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionManager.java
>  011cf06 
>   
> ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionManagerImpl.java
>  3a16c77 
>   
> ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHostEvent.java
>  78590fc 
>   
> ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHostEventType.java
>  b43ac9c 
>   
> ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostServerActionEvent.java
>  PRE-CREATION 
>   
> ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostUpgradeEvent.java
>  8b375fe 
>   
> ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java
>  36acbc2 
>   
> ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionManager.java
>  5a2c467 
>   
> ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
>  7224924 
>   
> ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
>  6e78b1d 
>   
> ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
>  e1e25e0 
>   
> ambari-server/src/test/java/org/apache/ambari/server/serveraction/MockServerAction.java
>  PRE-CREATION 
>   
> ambari-server/src/test/java/org/apache/ambari/server/serveraction/ServerActionExecutorTest.java
>  PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/27700/diff/
> 
> 
> Testing
> -------
> 
> -------------------------------------------------------------------------------
> Test set: org.apache.ambari.server.serveraction.ServerActionExecutorTest
> -------------------------------------------------------------------------------
> Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 41.822 sec
> 
> 
> Thanks,
> 
> Robert Levas
> 
>

Reply via email to