Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [servlet-dev] @Priority for ServletContainerInitializer
  • From: Mark Thomas <markt@xxxxxxxxxx>
  • Date: Tue, 9 Jun 2020 10:01:05 +0100
  • Autocrypt: addr=markt@xxxxxxxxxx; prefer-encrypt=mutual; keydata= xsFNBEq0DukBEAD4jovHOPJDxoD+JnO1Go2kiwpgRULasGlrVKuSUdP6wzcaqWmXpqtOJKKw W2MQFQLmg7nQ9RjJwy3QCbKNDJQA/bwbQT1F7WzTCz2S6vxC4zxKck4t6RZBq2dJsYKF0CEh 6ZfY4dmKvhq+3istSoFRdHYoOPGWZpuRDqfZPdGm/m335/6KGH59oysn1NE7a2a+kZzjBSEg v23+l4Z1Rg7+fpz1JcdHSdC2Z+ZRxML25eVatRVz4yvDOZItqDURP24zWOodxgboldV6Y88C 3v/7KRR+1vklzkuA2FqF8Q4r/2f0su7MUVviQcy29y/RlLSDTTYoVlCZ1ni14qFU7Hpw43KJ tgXmcUwq31T1+SlXdYjNJ1aFkUi8BjCHDcSgE/IReKUanjHzm4XSymKDTeqqzidi4k6PDD4j yHb8k8vxi6qT6Udnlcfo5NBkkUT1TauhEy8ktHhbl9k60BvvMBP9l6cURiJg1WS77egI4P/8 2oPbzzFiGFqXyJKULVgxtdQ3JikCpodp3f1fh6PlYZwkW4xCJLJucJ5MiQp07HAkMVW5w+k8 Xvuk4i5quh3N+2kzKHOOiQCDmN0sz0XjOE+7XBvM1lvz3+UarLfgSVmW8aheLd7eaIl5ItBk 8844ZJ60LrQ+JiIqvqJemxyIM6epoZvY5a3ZshZpcLilC5hW8QARAQABzSJNYXJrIEUgRCBU aG9tYXMgPG1hcmt0QGFwYWNoZS5vcmc+wsF3BBMBCgAhBQJKtA7pAhsDBQsJCAcDBRUKCQgL BRYCAwEAAh4BAheAAAoJEBDAHFovYFnn2YgQAKN6FLG/I1Ij3PUlC/XNlhasQxPeE3w2Ovtt weOQPYkblJ9nHtGH5p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N/JWbOGLiwrcN4ukKNyFntFG5jPaFnJdx9rHfyJNeF9cgv9JlZeFxJ6WqIAhl KOuH3K8/py0SPE6ZOFfRo0YUxvh25K/siOcPLm613aOxyY7YfQ8ME2vgn7I0mAtg9am+YFDa bGqj839odwZdzZv2T2mUHnybFTJFBuMWGWKYstYDS6eZEmhupbPvUKkDug/mO+gdo+pSKF9Y S6DM5RtCdTNJq4NZY50ypBb5RSj+INHPocIp2V/DDTbzySsu6wARAQABwsFfBBgBCgAJBQJK tA7pAhsMAAoJEBDAHFovYFnnLe0P/i34oK5cE2LlqUEITEcTO94x1EX0UmtKokRfQ3AYWK8X eFD8cmSty72hMkL+1c0V//4Qc53SUyLIWXk8FKWF7hdL3zyuBqlRb55721CYC35GA/jR90p0 k1vr701gaat2cNTOVC0/6H9cE5yYXT+zMr9TSiKCDwONhhSbmAJZc6X0fgsmCD7I5xUI5Vri hN/Wx0CZBtrXGUyE4hgFaYSGptZmkY5Ln1e+nI185Bda7bpLwcAIGrI9nYtVXgf71ybGKdPP tFfXIoPXuctn99M7NnWBhNuGDms2YWkOC7eeWBTxKkZDWR3vRmRy52B6GxR7USk/KXs7yqGP kfT/c4CZFfOurZUXXuC3PvOme0DQmqwExtJormoG4Fy6suEFPrfhYMigTy7kSbVTCOBMjQLH +U/FFNshvg9+M/ZvaKT+0lpRvBSuG5ngsC0bO0xWsXhb6qfH2h53g4VcwFvCBL5IfqgAeUbC nGGHNcGWpmwdeb7D7ahrNZSHEUUYR7lTbjkYS01/QDOcEwNZOqDRIJUQOOUq35721VeROkdh ZmMZtFlsQeQJsWoqGrQo/kEYicVlMVOgjmOOzOa5fRb/IqlGlBn4a4me3hWthLLtMy+OOEim 6ENjntVTBQiTP/YqrxWDbCkaD7b2e9wY5N3JlRxMIQHfcHaND3PRdQSn7oHYXmJl
  • Delivered-to: servlet-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/servlet-dev>
  • List-help: <mailto:servlet-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/servlet-dev>, <mailto:servlet-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/servlet-dev>, <mailto:servlet-dev-request@eclipse.org?subject=unsubscribe>
  • User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0

Filters is a particularly hard problem. Listeners and SCIs are -
hopefully - easier.

For SCIs can't we say:

1) Container provided SCIs are loaded first.

2) SCIs are then loaded as per the order of the fragments with which
   they are associated.

3) SCIs from the same fragment are loaded in the order they are listed
   in META-INF/services/jakarta.servlet.ServletContainerInitializer

?

You could argue 2) is implied by 8.2.2.d with 1) and 3) natural
extensions of 2).

Container provided SCIs are loaded first as applications may be
depending on a service provided by the container (we see this in Tomcat
with WebSocket)

Ordering of container provided SCIs is via container specific configuration.

The one scenario this doesn't cover is if JAR A has service A1 and A2
and  JAR B has service B1 and the desired order is A1, B1, A2. One
possible solution is say, in that instance, that JAR A needs to be split
into 2 JARs.

Mark


On 09/06/2020 09:03, Greg Wilkins wrote:
> All,
> 
> ordering is really a vexed problem in servlets, with already many poorly
> defined areas resulting from how we handle descriptor fragments and
> their ordering.   We can't even clearly define filter ordering
> <https://github.com/eclipse-ee4j/servlet-api/issues/318>, let alone
> Listeners or SCIs.
> 
> So I definitely think we need to do more to support precise ordering of
> lots of components, but I'm not sure that an annotation is really the
> best way to go:
> 
>   * We already have some ordering mechanisms, albeit with some
>     problems.  Layering a new ordering mechanism on top without fixing
>     underlying issues is just going to create more corner cases and
>     contradictions.
>   * Annotations are baked into the class, which is not flexible enough
>     when combining listeners and SCIs that never knew they would be
>     combined.  There is no universal ordering scale that can be baked in.
>   * Also because there is no universal ordering scale, it can be hard
>     for developers to come up with a linear representation of order that
>     is robust for future inclusions (see David's point about integers). 
>     A universal ordering implies universal knowledge of all components,
>     when often a component deployer will just know the before/after
>     relationships required by a subset of components.
> 
> We already have names for filters, servlets, fragments, so I think
> extending that so we can name listeners and SCI (with their classname
> being the default name if not specified otherwise), then before/after
> clauses in descriptors (or annotations if really necessary) can be used
> to establish an ordering without every component needing to know about
> every other component.
> 
> tl;dr; We need to do something, but I don't thing @Priority is the
> silver bullet 
> 
> cheers
> 
> 
> 
> 
> 
> 
> 
> 
> On Tue, 19 May 2020 at 17:16, arjan tijms <arjan.tijms@xxxxxxxxx
> <mailto:arjan.tijms@xxxxxxxxx>> wrote:
> 
>     Hi,
> 
>     On Tue, May 19, 2020 at 3:21 AM David Blevins
>     <dblevins@xxxxxxxxxxxxx <mailto:dblevins@xxxxxxxxxxxxx>> wrote:
> 
>         With our int based approach if someone picks 100 and someone
>         later comes and takes 101, there's no getting between them.
> 
>         I would support @Priority for really all listener-type APIs we
>         have across all specs, but I think we should push for a change
>         from int likely to double (the only safe cast from int).
> 
> 
>     That, or Stuart's suggestion sounds like a good idea.
> 
>     Two additional things to consider here:
> 
>     1. Have a platform coordination or maybe sub-spec (like managed
>     beans) that says something about inner-spec ordering of
>     events during startup and shutdown. Something to make what was
>     discussed here a little bit more
>     predictable: http://javaeesquad.blogspot.com/2015/03/getting-notified-when-java-ee.html
> 
>     2. In Jakarta Security we have IdentityStores which can be called in
>     a given order (set by a priority as well). However, by registering a
>     single class (fully optional), the user is in full control of this
>     order programmatically, meaning they can effectively veto any store,
>     or have them called in any order.
> 
>     Perhaps this approach can be considered to be adopted universally,
>     or at least in this case here by Servlet.
> 
>     Kind regards,
>     Arjan Tijms
> 
> 
> 
>      
> 
>>         - Joakim
>>
>>         On Mon, May 18, 2020 at 10:20 AM arjan tijms
>>         <arjan.tijms@xxxxxxxxx <mailto:arjan.tijms@xxxxxxxxx>> wrote:
>>
>>             Hi,
>>
>>             Just wondering, what about supporting the @Priority
>>             annotation on a ServletContainerInitializer class to
>>             help ordering the execution order of these?
>>
>>             Thoughts?
>>
>>             Kind regards,
>>             Arjan Tijms
>>             _______________________________________________
>>             servlet-dev mailing list
>>             servlet-dev@xxxxxxxxxxx <mailto:servlet-dev@xxxxxxxxxxx>
>>             To unsubscribe from this list, visit
>>             https://www.eclipse.org/mailman/listinfo/servlet-dev
>>
>>         _______________________________________________
>>         servlet-dev mailing list
>>         servlet-dev@xxxxxxxxxxx <mailto:servlet-dev@xxxxxxxxxxx>
>>         To unsubscribe from this list, visit
>>         https://www.eclipse.org/mailman/listinfo/servlet-dev
> 
>         _______________________________________________
>         servlet-dev mailing list
>         servlet-dev@xxxxxxxxxxx <mailto:servlet-dev@xxxxxxxxxxx>
>         To unsubscribe from this list, visit
>         https://www.eclipse.org/mailman/listinfo/servlet-dev
> 
>     _______________________________________________
>     servlet-dev mailing list
>     servlet-dev@xxxxxxxxxxx <mailto:servlet-dev@xxxxxxxxxxx>
>     To unsubscribe from this list, visit
>     https://www.eclipse.org/mailman/listinfo/servlet-dev
> 
> 
> 
> -- 
> Greg Wilkins <gregw@xxxxxxxxxxx <mailto:gregw@xxxxxxxxxxx>> CTO
> http://webtide.com
> 
> _______________________________________________
> servlet-dev mailing list
> servlet-dev@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/servlet-dev
> 



Back to the top