[ 
https://issues.apache.org/jira/browse/PIO-182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16656329#comment-16656329
 ] 

ASF GitHub Bot commented on PIO-182:
------------------------------------

Wei-1 commented on a change in pull request #482: [PIO-182] Add async methods 
to LEventStore
URL: https://github.com/apache/predictionio/pull/482#discussion_r226542882
 
 

 ##########
 File path: 
data/src/main/scala/org/apache/predictionio/data/store/LEventStore.scala
 ##########
 @@ -72,9 +84,61 @@ object LEventStore {
     latest: Boolean = true,
     timeout: Duration = defaultTimeout): Iterator[Event] = {
 
+    import scala.concurrent.ExecutionContext.Implicits.global
 
 Review comment:
   Sorry to ask, but I will like to clarify.
   The reason why we import this line in the object instead of putting it on 
top is because of:
   [importing global will introduce a lazy ExecutionContext 
class](https://github.com/scala/scala/blob/ba9701059216c629410f4f23a2175d20ad62484b/src/library/scala/concurrent/ExecutionContext.scala#L153)
   Since it will only be created when it is called, we import it in each thread 
separately so we won't be using one single ExecutionContext.
   Is my interpretation correct?

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


> Add asynchronous (non-blocking) methods to LEventStore
> ------------------------------------------------------
>
>                 Key: PIO-182
>                 URL: https://issues.apache.org/jira/browse/PIO-182
>             Project: PredictionIO
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 0.13.0
>            Reporter: Naoki Takezoe
>            Assignee: Naoki Takezoe
>            Priority: Major
>
> The current implementation of {{LEventStore}} has only synchronous (blocking) 
> methods. Since they use {{ExecutionContext.Implicit.global}}, its parallelism 
> is limited up to the number of processors. This means engine server's 
> parallelism is also limited if we use these methods in prediction logic.
> To solve this problem, {{Future}} version of these methods should be added to 
> {{LEventStore}} and also current blocking methods should be modified to take 
> {{ExecutionContext}} (as an implicit parameter).
> See also: 
> https://lists.apache.org/thread.html/f14e4f8f29410e4585b3d8e9f646b88293a605f4716d3c4d60771854@%3Cuser.predictionio.apache.org%3E



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to