Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Threading model (was Re: Jetty 12 schedule?_



On Thu, 10 Nov 2022 at 12:29, Cantor, Scott <cantor.2@xxxxxxx> wrote:
>    The proper way is to use the request / response objects as passed to
> you, and not hold onto them.

That would imply that one has to immediate extract every possible bit from them and construct a new façade for the data before one's servlet method even calls another object. That's a pretty huge step backward, if true.

Scott, it is typical to handle requests with multi classes, potentially calling deep into a code base.
Often these calls will accept the request and/or response as an argument and that is a reasonable style as it makes it very clear that the call is part of a request/response calling cycle.

Problems start to occur when a request/response is wrapped in another object that abstracts away from the request response paradigm and just looks like some dataful object (which just happens to be backed by data a request).   Such objects can easily be put into persistent data structures that have no lifecycle relationship to the original request.

So the antipattern is to facade a request into a non-request like API.   If your facades do look like requests and their lifecycle is apparent, then that is a reasonable abstraction.

regards





--

Back to the top