David E Jones wrote:
> On Jan 15, 2010, at 2:12 PM, Adam Heath wrote:
> 
>> Adrian Crum wrote:
>>> Adam Heath wrote:
>>>> Adam Heath wrote:
>>>>> T result = Controller.runWith(data, new Callable<T>() {
>>>>>    public T call() throws Exception {
>>>>>        // code
>>>>>        return null;
>>>>>    }
>>>>> });
>>>> I've actually attempted this, and while I think the implementation of
>>>> this pattern is simple, actually *using* it in higher-level code ends
>>>> up making things rather verbose.
>>> I just added your idea to the branch, and it *is* simple. Let's say we
>>> want to make incoming requests a security-aware artifact:
>>>
>>> org.ofbiz.webapp.control.ControlServlet
>>>
>>> public void doGet(HttpServletRequest request, HttpServletResponse
>>> response) throws ServletException, IOException {
>>>    try {
>>>        ThreadContext.runExecutionArtifact(new RequestArtifact(request,
>>> response));
>>>    } catch (Throwable t) {
>>>        // Do something with t
>>>    }
>>> }
>> If you were *really* hot stuff, you'd use APT, annotations, and
>> directly modify the code at compile time.
>>
>> @ThreadContext(RequestArtifact.class)
>> public void doGet(HttpServletRequest request, HttpServletResponse
>> response) {
>>    if (request.getAttribute()) {
>>        // ...
>>    }
>> }
> 
> Yes, please... let's make this as obfuscated and impossible to maintain as 
> possible.
> 
> This may be a community driven project, but job security should still be our 
> #1 priority. On the other hand, I think it was Adam who said that after a 
> couple of years he couldn't even follow his own code in parts of the Entity 
> Engine (yes, stuff I've been tempted to rewrite since it's so tedious to 
> trace through, though I think the ShoppingCart and related objects are still 
> worse!).

Yeah, that was me, and it is the caching stuff.  I agree about the
shopping cart and order read header too.

In all honesty, I would use dynamic ecas to do the caching stuff now.

Reply via email to