You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@click.apache.org by "Henry Saputra (JIRA)" <ji...@apache.org> on 2010/03/12 18:48:27 UTC
[jira] Created: (CLK-642) Fix the logic to manage Context with
ThreadLocal
Fix the logic to manage Context with ThreadLocal
------------------------------------------------
Key: CLK-642
URL: https://issues.apache.org/jira/browse/CLK-642
Project: Click
Issue Type: Bug
Components: core
Affects Versions: 2.2.0
Reporter: Henry Saputra
Priority: Minor
Attachments: context_change.patch
Currently, the Context class maintains a ThreadLocal<ContextStack> instance to store all contexts created for each Click request. However since Clck is using servlet mechanism, each request will be processed in a separate thread so there should be just a single Context in a thread execution lifetime.
Within a thread scope, we could just use ThreadLocal<Context> to manage a single context since ThreadLocal guarantee a unique instance per thread.
I dont think we need to manage the Context instances in ContextStack because there should be only one Context instance per request, which supported by execution in a separate thread for each request and ThreadLocal.
I created repository for Click in codereview.appspot.com to help with code review and created an entry for this JIRA:
http://codereview.appspot.com/471041/show
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CLK-642) Fix the logic to manage Context with
ThreadLocal
Posted by "Henry Saputra (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CLK-642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12844739#action_12844739 ]
Henry Saputra commented on CLK-642:
-----------------------------------
So when a page forwards to another page, a new context is created for that page and push inside the ContextStack?
In this case then previous context is no longer valid I suppose and can be replaced by new Context.
> Fix the logic to manage Context with ThreadLocal
> ------------------------------------------------
>
> Key: CLK-642
> URL: https://issues.apache.org/jira/browse/CLK-642
> Project: Click
> Issue Type: Bug
> Components: core
> Affects Versions: 2.2.0
> Reporter: Henry Saputra
> Priority: Minor
> Attachments: context_change.patch
>
>
> Currently, the Context class maintains a ThreadLocal<ContextStack> instance to store all contexts created for each Click request. However since Clck is using servlet mechanism, each request will be processed in a separate thread so there should be just a single Context in a thread execution lifetime.
> Within a thread scope, we could just use ThreadLocal<Context> to manage a single context since ThreadLocal guarantee a unique instance per thread.
> I dont think we need to manage the Context instances in ContextStack because there should be only one Context instance per request, which supported by execution in a separate thread for each request and ThreadLocal.
> I created repository for Click in codereview.appspot.com to help with code review and created an entry for this JIRA:
> http://codereview.appspot.com/471041/show
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CLK-642) Fix the logic to manage Context with
ThreadLocal
Posted by "Malcolm Edgar (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CLK-642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12844734#action_12844734 ]
Malcolm Edgar commented on CLK-642:
-----------------------------------
The context stack is used to deal with the issue of pages being able to forward to another page. In this scenario, the request is still being handled by the same thread in the ServletContainer.
> Fix the logic to manage Context with ThreadLocal
> ------------------------------------------------
>
> Key: CLK-642
> URL: https://issues.apache.org/jira/browse/CLK-642
> Project: Click
> Issue Type: Bug
> Components: core
> Affects Versions: 2.2.0
> Reporter: Henry Saputra
> Priority: Minor
> Attachments: context_change.patch
>
>
> Currently, the Context class maintains a ThreadLocal<ContextStack> instance to store all contexts created for each Click request. However since Clck is using servlet mechanism, each request will be processed in a separate thread so there should be just a single Context in a thread execution lifetime.
> Within a thread scope, we could just use ThreadLocal<Context> to manage a single context since ThreadLocal guarantee a unique instance per thread.
> I dont think we need to manage the Context instances in ContextStack because there should be only one Context instance per request, which supported by execution in a separate thread for each request and ThreadLocal.
> I created repository for Click in codereview.appspot.com to help with code review and created an entry for this JIRA:
> http://codereview.appspot.com/471041/show
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CLK-642) Fix the logic to manage Context with
ThreadLocal
Posted by "Henry Saputra (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CLK-642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12844816#action_12844816 ]
Henry Saputra commented on CLK-642:
-----------------------------------
Thanks Bob, Malcolm. I will close this as not bug.
> Fix the logic to manage Context with ThreadLocal
> ------------------------------------------------
>
> Key: CLK-642
> URL: https://issues.apache.org/jira/browse/CLK-642
> Project: Click
> Issue Type: Bug
> Components: core
> Affects Versions: 2.2.0
> Reporter: Henry Saputra
> Priority: Minor
> Attachments: context_change.patch
>
>
> Currently, the Context class maintains a ThreadLocal<ContextStack> instance to store all contexts created for each Click request. However since Clck is using servlet mechanism, each request will be processed in a separate thread so there should be just a single Context in a thread execution lifetime.
> Within a thread scope, we could just use ThreadLocal<Context> to manage a single context since ThreadLocal guarantee a unique instance per thread.
> I dont think we need to manage the Context instances in ContextStack because there should be only one Context instance per request, which supported by execution in a separate thread for each request and ThreadLocal.
> I created repository for Click in codereview.appspot.com to help with code review and created an entry for this JIRA:
> http://codereview.appspot.com/471041/show
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (CLK-642) Fix the logic to manage Context with
ThreadLocal
Posted by "Henry Saputra (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CLK-642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henry Saputra closed CLK-642.
-----------------------------
Resolution: Not A Problem
By design to resolve maintaining context during page forwarding
> Fix the logic to manage Context with ThreadLocal
> ------------------------------------------------
>
> Key: CLK-642
> URL: https://issues.apache.org/jira/browse/CLK-642
> Project: Click
> Issue Type: Bug
> Components: core
> Affects Versions: 2.2.0
> Reporter: Henry Saputra
> Priority: Minor
> Attachments: context_change.patch
>
>
> Currently, the Context class maintains a ThreadLocal<ContextStack> instance to store all contexts created for each Click request. However since Clck is using servlet mechanism, each request will be processed in a separate thread so there should be just a single Context in a thread execution lifetime.
> Within a thread scope, we could just use ThreadLocal<Context> to manage a single context since ThreadLocal guarantee a unique instance per thread.
> I dont think we need to manage the Context instances in ContextStack because there should be only one Context instance per request, which supported by execution in a separate thread for each request and ThreadLocal.
> I created repository for Click in codereview.appspot.com to help with code review and created an entry for this JIRA:
> http://codereview.appspot.com/471041/show
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CLK-642) Fix the logic to manage Context with
ThreadLocal
Posted by "Henry Saputra (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CLK-642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henry Saputra updated CLK-642:
------------------------------
Attachment: context_change.patch
> Fix the logic to manage Context with ThreadLocal
> ------------------------------------------------
>
> Key: CLK-642
> URL: https://issues.apache.org/jira/browse/CLK-642
> Project: Click
> Issue Type: Bug
> Components: core
> Affects Versions: 2.2.0
> Reporter: Henry Saputra
> Priority: Minor
> Attachments: context_change.patch
>
>
> Currently, the Context class maintains a ThreadLocal<ContextStack> instance to store all contexts created for each Click request. However since Clck is using servlet mechanism, each request will be processed in a separate thread so there should be just a single Context in a thread execution lifetime.
> Within a thread scope, we could just use ThreadLocal<Context> to manage a single context since ThreadLocal guarantee a unique instance per thread.
> I dont think we need to manage the Context instances in ContextStack because there should be only one Context instance per request, which supported by execution in a separate thread for each request and ThreadLocal.
> I created repository for Click in codereview.appspot.com to help with code review and created an entry for this JIRA:
> http://codereview.appspot.com/471041/show
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CLK-642) Fix the logic to manage Context with
ThreadLocal
Posted by "Bob Schellink (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CLK-642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12844801#action_12844801 ]
Bob Schellink commented on CLK-642:
-----------------------------------
Hi Henry,
Forwards are processed immediately by the container and execution returns to the original Page after the forward is done. Thus the previous Context object is needed to continue processing of the first page eg: onDestroy event handling.
Here is the JIRA which lead to the stack approach: https://issues.apache.org/jira/browse/CLK-314
kind regards
bob
> Fix the logic to manage Context with ThreadLocal
> ------------------------------------------------
>
> Key: CLK-642
> URL: https://issues.apache.org/jira/browse/CLK-642
> Project: Click
> Issue Type: Bug
> Components: core
> Affects Versions: 2.2.0
> Reporter: Henry Saputra
> Priority: Minor
> Attachments: context_change.patch
>
>
> Currently, the Context class maintains a ThreadLocal<ContextStack> instance to store all contexts created for each Click request. However since Clck is using servlet mechanism, each request will be processed in a separate thread so there should be just a single Context in a thread execution lifetime.
> Within a thread scope, we could just use ThreadLocal<Context> to manage a single context since ThreadLocal guarantee a unique instance per thread.
> I dont think we need to manage the Context instances in ContextStack because there should be only one Context instance per request, which supported by execution in a separate thread for each request and ThreadLocal.
> I created repository for Click in codereview.appspot.com to help with code review and created an entry for this JIRA:
> http://codereview.appspot.com/471041/show
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.