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 2019/05/15 09:35:53 UTC

Registry instance aligned on Tomcat/Server lifecycle?

Hi guys,

9.0.20 got a disableRegistry method in Registry class (for JMX server
interaction),
I wonder if it is possible to enhance it a bit to make it instance bound to
the server instead of being global.

It would enable to start/stop/restart servers potentially
deactivating/activating JMX without issues if multiple tomcat instances are
started in the same JVM.

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: Registry instance aligned on Tomcat/Server lifecycle?

Posted by Mark Thomas <ma...@apache.org>.
On 15/05/2019 13:48, Romain Manni-Bucau wrote:
> Oki, I can hear it is a lot of work for a small gain, however, at least,
> it is possible to ensure the disable method is re-callable (actually
> setting the registry instance) and that there is an enableRegistry()
> method. It is ok and cheap IMO to have a global reference counting and
> force it to be == 0 to ensure we don't change the setup if a server is
> already running.
> 
> Use case is to be able to have:
> 
> lifecycle()
>   configureJMX();
>   startServer();
>   stopServer();
> 
> can call lifecycle twice with the configuration of configureJMX being
> different.
> 
> High level it looks cheaper and solves my current issue with the disable
> method too.
> 
> Does it sound better?

I'm actually not sure. It is the transition from enabled to disabled
that bothers me and ensuring that everything that should be unregistered
is unregistered. I'm wondering if it isn't just simpler to implement the
one registry per Server idea.

Mark


> 
> 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 mer. 15 mai 2019 à 13:52, Mark Thomas <markt@apache.org
> <ma...@apache.org>> a écrit :
> 
>     On 15/05/2019 10:35, Romain Manni-Bucau wrote:
>     > 9.0.20 got a disableRegistry method in Registry class (for JMX server
>     > interaction),
>     > I wonder if it is possible to enhance it a bit to make it instance
>     bound
>     > to the server instead of being global.
>     >
>     > It would enable to start/stop/restart servers potentially
>     > deactivating/activating JMX without issues if multiple tomcat
>     instances
>     > are started in the same JVM.
>     >
>     > wdyt?
> 
>     Currently all registrations go through a singleton Registry instance.
> 
>     The process to obtain a Registry instance would need to be changed to
>     obtain one per Server. That looks to be doable (there look to be just
>     over 40 instances of calling the getRegistry() method). We might even be
>     able to use the existing key parameter (once we restore the key related
>     plumbing we only just removed).
> 
>     How much user demand has there been for making this more granular? So
>     far, the only requests I have seen have been from users wanting to
>     disable JMX registration completely for Tomcat objects.
> 
>     Mark
> 
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>     <ma...@tomcat.apache.org>
>     For additional commands, e-mail: dev-help@tomcat.apache.org
>     <ma...@tomcat.apache.org>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Registry instance aligned on Tomcat/Server lifecycle?

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Oki, I can hear it is a lot of work for a small gain, however, at least, it
is possible to ensure the disable method is re-callable (actually setting
the registry instance) and that there is an enableRegistry() method. It is
ok and cheap IMO to have a global reference counting and force it to be ==
0 to ensure we don't change the setup if a server is already running.

Use case is to be able to have:

lifecycle()
  configureJMX();
  startServer();
  stopServer();

can call lifecycle twice with the configuration of configureJMX being
different.

High level it looks cheaper and solves my current issue with the disable
method too.

Does it sound better?

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 mer. 15 mai 2019 à 13:52, Mark Thomas <ma...@apache.org> a écrit :

> On 15/05/2019 10:35, Romain Manni-Bucau wrote:
> > 9.0.20 got a disableRegistry method in Registry class (for JMX server
> > interaction),
> > I wonder if it is possible to enhance it a bit to make it instance bound
> > to the server instead of being global.
> >
> > It would enable to start/stop/restart servers potentially
> > deactivating/activating JMX without issues if multiple tomcat instances
> > are started in the same JVM.
> >
> > wdyt?
>
> Currently all registrations go through a singleton Registry instance.
>
> The process to obtain a Registry instance would need to be changed to
> obtain one per Server. That looks to be doable (there look to be just
> over 40 instances of calling the getRegistry() method). We might even be
> able to use the existing key parameter (once we restore the key related
> plumbing we only just removed).
>
> How much user demand has there been for making this more granular? So
> far, the only requests I have seen have been from users wanting to
> disable JMX registration completely for Tomcat objects.
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

Re: Registry instance aligned on Tomcat/Server lifecycle?

Posted by Mark Thomas <ma...@apache.org>.
On 15/05/2019 10:35, Romain Manni-Bucau wrote:
> 9.0.20 got a disableRegistry method in Registry class (for JMX server
> interaction),
> I wonder if it is possible to enhance it a bit to make it instance bound
> to the server instead of being global.
> 
> It would enable to start/stop/restart servers potentially
> deactivating/activating JMX without issues if multiple tomcat instances
> are started in the same JVM.
> 
> wdyt?

Currently all registrations go through a singleton Registry instance.

The process to obtain a Registry instance would need to be changed to
obtain one per Server. That looks to be doable (there look to be just
over 40 instances of calling the getRegistry() method). We might even be
able to use the existing key parameter (once we restore the key related
plumbing we only just removed).

How much user demand has there been for making this more granular? So
far, the only requests I have seen have been from users wanting to
disable JMX registration completely for Tomcat objects.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org