dataFaber 5.0

How to explain thread-safety in another language?

In between a site redesign, learning Python and being swamped with work, I have an issue: some of the people I’m working with configured a couple of instances of ItemLookupDroplet in request scope. The reasoning behind is that each invocation of this droplet will not interfere with others.

As the documentation states, this droplet communicates with a page with input, output and open parameters, there aren’t member variables.
Since each invocation of this droplet pushes a context onto a stack and is stateless, there is no need to instantiate a droplet per request: a droplet in the default global scope would suffice. A droplet in request scope is a very special case, and I don’t remember having seen any.

But the real problem is: my French is still limited, and I’m aware that I can’t explain this concept as well as I’d like. It’s frustrating and not productive, so are there any online resources to which I can refer?

2 Comments

  1. Will Sargent

    There’s never a case where you want a droplet in request scope. Droplets almost never maintain state. There are situations where you want access to a request scoped or session scoped object, but in these cases you can do it from the main service method

    public void service() {
      Profile p = (Profile) pRequest.resolveName("/atg/userprofiling/Profile");
      p.doStuff();
    }
    

    Because the request object is passed in, you never set any state on the component itself… just pass through the request object to anything that can resolve it.

  2. Sebastiano Pilla

    Thanks Will for confirming my thoughts… And sorry for botching the code you posted, a redesign of this site with a better template is long overdue.