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

Aniket Mokashi commented on PIG-3844:
-------------------------------------

Wouldn't InheritableThreadLocal copy the reference too? So all the 
non-primitive reference variables will be shared across the threads, correct?

In fact, do we need these (ScriptState, PigStats) data structures to be 
ThreadLocal? It seems these data structures are for saving a state which should 
be readable across threads. For example, PPNL can run in a separate thread 
trying to read JobStats from jobGraph, features, aliases for script state.

cc: [~daijy]

> Make ScriptState InheritableThreadLocal for threads that need it
> ----------------------------------------------------------------
>
>                 Key: PIG-3844
>                 URL: https://issues.apache.org/jira/browse/PIG-3844
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Akihiro Matsukawa
>            Assignee: Akihiro Matsukawa
>             Fix For: 0.13.0
>
>         Attachments: PIG-3844.patch
>
>
> I have a PPNL that is forked off the main thread so that its operations does 
> not block pig from continuing to run. This PPNL needs the ScriptState, but is 
> not able to get it in pig13 because the ScriptState is ThreadLocal.
> In pig12, this worked because there was logic to start a new ScriptState on 
> ScriptState.get() which was removed in PIG-3525 
> (https://reviews.apache.org/r/15634).
> My proposal is to change ScriptState to be InheritableThreadLocal, so that 
> any new child threads that are spawned will have a copy of it. I have a 
> pretty limited understanding of pig, but I do not see anything that this 
> proposed change would break.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to