pkuwm commented on issue #357: [WIP] Add getWorkflows(long timeout) to 
TaskDriver.
URL: https://github.com/apache/helix/pull/357#issuecomment-515564146
 
 
   @i3wangyi I've created a thread pool executor in the class as private. To 
avoid creating the thread pool each time at once when new a TaskDriver, instead 
I create a `startPool()` to create the thread pool: if getWorkflows(long 
timeout) is not going to call, it is not necessary to create the thread pool.
   
   For the pool size, we will let caller to choose a good pool size for the 
needs.
   
   And why I don't use `ScheduledExecutorService` is because 
`ScheduledExecutorService` could also be used to delay to start a task, which 
we don't need. Thanks for the suggestion.
   
   > I'm afraid the underlying the executor is creating a thread pool with one 
worker. If this is the case, there's certainly overhead if each time when the 
method gets invoked, the thread gets created and deleted after the method call. 
I don't think creating a thread every time is cheap, I would suggest making it 
a private field. Also for timeout mechanism, there's better choice for you 
https://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/ScheduledExecutorService.html

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to