You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2021/04/22 15:24:59 UTC
[websocket] proper SPI for encoder/decoder instantiation?
Hi,
Is it possible to reuse/add/have a SPI to create ws coders/decoders?
Currently it is a hardcoded factory doing a "new"
(org.apache.tomcat.websocket.Util#getDecoders for decoders, for encoders it
is a bit worse since there is an instance as a check here
org.apache.tomcat.websocket.server.WsServerContainer#validateEncoders and
the instantiation happens here
org.apache.tomcat.websocket.WsRemoteEndpointImplBase#setEncoders).
Best would likely be to reuse tomcat instance manager since it would make
it working OOTB for integrations/users and also enable to have a proper
lifecycle management (destroyInstance).
Wdyt?
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>
Re: [websocket] proper SPI for encoder/decoder instantiation?
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Here it is https://bz.apache.org/bugzilla/show_bug.cgi?id=65262
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>
Le jeu. 22 avr. 2021 à 20:12, Mark Thomas <ma...@apache.org> a écrit :
> On 22/04/2021 18:44, Romain Manni-Bucau wrote:
> > Le jeu. 22 avr. 2021 à 17:32, Mark Thomas <ma...@apache.org> a écrit :
> >
> >> On 22/04/2021 16:24, Romain Manni-Bucau wrote:
> >>> Hi,
> >>>
> >>> Is it possible to reuse/add/have a SPI to create ws coders/decoders?
> >>>
> >>> Currently it is a hardcoded factory doing a "new"
> >>> (org.apache.tomcat.websocket.Util#getDecoders for decoders, for
> encoders
> >> it
> >>> is a bit worse since there is an instance as a check here
> >>> org.apache.tomcat.websocket.server.WsServerContainer#validateEncoders
> and
> >>> the instantiation happens here
> >>> org.apache.tomcat.websocket.WsRemoteEndpointImplBase#setEncoders).
> >>>
> >>> Best would likely be to reuse tomcat instance manager since it would
> make
> >>> it working OOTB for integrations/users and also enable to have a proper
> >>> lifecycle management (destroyInstance).
> >>>
> >>> Wdyt?
> >>
> >> -> https://github.com/eclipse-ee4j/websocket-api/issues
> >
> >
> > It is already required to cover 7.1.1.
>
> ACK. Tomcat pretty much ignored that section.
>
> > Currently tomee worked around it by dropping default sci and having a
> > custom one override what it can but it is not generally reusable in cdi
> app
> > easily so spi is needed and destroy phase too by spec ;).
>
> Switching to use the InstanceManager looks doable. It is already
> available on the WebSocketContainer.
>
> Worth opening a BZ issue to track it.
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
Re: [websocket] proper SPI for encoder/decoder instantiation?
Posted by Mark Thomas <ma...@apache.org>.
On 22/04/2021 18:44, Romain Manni-Bucau wrote:
> Le jeu. 22 avr. 2021 à 17:32, Mark Thomas <ma...@apache.org> a écrit :
>
>> On 22/04/2021 16:24, Romain Manni-Bucau wrote:
>>> Hi,
>>>
>>> Is it possible to reuse/add/have a SPI to create ws coders/decoders?
>>>
>>> Currently it is a hardcoded factory doing a "new"
>>> (org.apache.tomcat.websocket.Util#getDecoders for decoders, for encoders
>> it
>>> is a bit worse since there is an instance as a check here
>>> org.apache.tomcat.websocket.server.WsServerContainer#validateEncoders and
>>> the instantiation happens here
>>> org.apache.tomcat.websocket.WsRemoteEndpointImplBase#setEncoders).
>>>
>>> Best would likely be to reuse tomcat instance manager since it would make
>>> it working OOTB for integrations/users and also enable to have a proper
>>> lifecycle management (destroyInstance).
>>>
>>> Wdyt?
>>
>> -> https://github.com/eclipse-ee4j/websocket-api/issues
>
>
> It is already required to cover 7.1.1.
ACK. Tomcat pretty much ignored that section.
> Currently tomee worked around it by dropping default sci and having a
> custom one override what it can but it is not generally reusable in cdi app
> easily so spi is needed and destroy phase too by spec ;).
Switching to use the InstanceManager looks doable. It is already
available on the WebSocketContainer.
Worth opening a BZ issue to track it.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: [websocket] proper SPI for encoder/decoder instantiation?
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le jeu. 22 avr. 2021 à 17:32, Mark Thomas <ma...@apache.org> a écrit :
> On 22/04/2021 16:24, Romain Manni-Bucau wrote:
> > Hi,
> >
> > Is it possible to reuse/add/have a SPI to create ws coders/decoders?
> >
> > Currently it is a hardcoded factory doing a "new"
> > (org.apache.tomcat.websocket.Util#getDecoders for decoders, for encoders
> it
> > is a bit worse since there is an instance as a check here
> > org.apache.tomcat.websocket.server.WsServerContainer#validateEncoders and
> > the instantiation happens here
> > org.apache.tomcat.websocket.WsRemoteEndpointImplBase#setEncoders).
> >
> > Best would likely be to reuse tomcat instance manager since it would make
> > it working OOTB for integrations/users and also enable to have a proper
> > lifecycle management (destroyInstance).
> >
> > Wdyt?
>
> -> https://github.com/eclipse-ee4j/websocket-api/issues
It is already required to cover 7.1.1.
Currently tomee worked around it by dropping default sci and having a
custom one override what it can but it is not generally reusable in cdi app
easily so spi is needed and destroy phase too by spec ;).
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
Re: [websocket] proper SPI for encoder/decoder instantiation?
Posted by Mark Thomas <ma...@apache.org>.
On 22/04/2021 16:24, Romain Manni-Bucau wrote:
> Hi,
>
> Is it possible to reuse/add/have a SPI to create ws coders/decoders?
>
> Currently it is a hardcoded factory doing a "new"
> (org.apache.tomcat.websocket.Util#getDecoders for decoders, for encoders it
> is a bit worse since there is an instance as a check here
> org.apache.tomcat.websocket.server.WsServerContainer#validateEncoders and
> the instantiation happens here
> org.apache.tomcat.websocket.WsRemoteEndpointImplBase#setEncoders).
>
> Best would likely be to reuse tomcat instance manager since it would make
> it working OOTB for integrations/users and also enable to have a proper
> lifecycle management (destroyInstance).
>
> Wdyt?
-> https://github.com/eclipse-ee4j/websocket-api/issues
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org