You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/04/04 07:40:58 UTC
DO NOT REPLY [Bug 49045] New: JMX Enhancement- Provision of
MBeanFactory createStandardService
https://issues.apache.org/bugzilla/show_bug.cgi?id=49045
Summary: JMX Enhancement- Provision of MBeanFactory
createStandardService
Product: Tomcat 6
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
AssignedTo: dev@tomcat.apache.org
ReportedBy: chamibuddhika@gmail.com
Currently MBeanFactory doesn't have a method for creating a new StandardService
MBean. This would become an issue for future enhancements of JMX support in
Tomcat. As per discussions with Mark, this enhancement is suggested as a
starting point for possible future enhancements in JMX support.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
DO NOT REPLY [Bug 49045] JMX Enhancement- Provision of MBeanFactory
createStandardService
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49045
chamith buddhika <ch...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #25228|0 |1
is obsolete| |
--- Comment #7 from chamith buddhika <ch...@gmail.com> 2010-04-13 07:32:51 EDT ---
Created an attachment (id=25277)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=25277)
Adding createStandardService method to MBeanFactory
Sorry for the delay. I was busy summing up some other work. I have been looking
more in to the issue of MBeanFactory.The issue was caused by the fact that
MBeanFactory itself being a BaseModelBean unlike other normal classes such as
StandardService etc. Although it extends BaseModelBean it doesn't utilise any
of its inherited methods and it being a BaseModelBean is not leveraged in any
other point in the sources. So I suggest removing 'is a' relationship between
MBeanFactory and BaseModelBean and make MBeanFactory a normal class which can
be managed using a BaseModelBean object. It solves the issue that both managed
resource and the mbean being instances of the same class, a situation which is
unique to MBeanFactory.
In this patch I have reversed the changes made to the modeler code in order to
overcome the earlier issue. And additionally separate create method has been
added to create an Engine component.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
DO NOT REPLY [Bug 49045] JMX Enhancement- Provision of MBeanFactory
createStandardService
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49045
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #8 from Mark Thomas <ma...@apache.org> 2010-04-14 08:07:06 EDT ---
Thanks for the analysis and updated patch.
As I reviewed the patch I realised that a lot of the complexity was caused by
trying to add Service and Engine separately. When considered along side the
long term aim to merge Service and Engine and the short term goal to extend
Lifecycle to cover MBean registration I now think you original idea to add the
two togetehr is the right way to go.
I have applied a patch based you your patches that does this and also cleans up
some old methods from the descriptors.
In terms of what to do next, I'd suggest posting your ideas for the next steps
to the dev list.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
DO NOT REPLY [Bug 49045] JMX Enhancement- Provision of MBeanFactory
createStandardService
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49045
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|Catalina |Catalina
Version|unspecified |trunk
Product|Tomcat 6 |Tomcat 7
Target Milestone|default |---
--- Comment #4 from Mark Thomas <ma...@apache.org> 2010-04-07 19:20:00 UTC ---
(In reply to comment #3)
> I will raise a bug for Tomcat 7 as well.
That wasn't quite what I meant. I meant that this bug should be against Tomcat
7, not Tomcat 6. I'll move it.
> Here what I was thinking was since technically a Server can contain more than
> one service that it would be possible to add another service to the server
> associated with the current service component in the MBeanFactory. I will
> change it to throw an exception.
There are cases where there is a service with no server. Hence the exception is
the better option.
> Please correct me if I am wrong here. Since one service is always mapped only
> to one Engine component it would be not possible to use an existing registered
> Engine component with the newly created service without any side effects. Hence
> the creation of a brand new engine within the new service. I saw this has been
> done in the removed codes using ServerFactory as well. Another option would be
> that user can seperately create an Engine component prior to Service creation
> and register it and then use it to create the new Service. I will add a
> separate method to create an Engine component in that case.
You are correct that there is a 1 to 1 mapping between service and engine. For
simplicity, I'd still keep them separate.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
DO NOT REPLY [Bug 49045] JMX Enhancement- Provision of MBeanFactory
createStandardService
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49045
--- Comment #5 from Mark Thomas <ma...@apache.org> 2010-04-07 19:20:19 UTC ---
*** Bug 49062 has been marked as a duplicate of this bug. ***
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
DO NOT REPLY [Bug 49045] JMX Enhancement- Provision of MBeanFactory
createStandardService
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49045
--- Comment #1 from chamith buddhika <ch...@gmail.com> 2010-04-04 06:24:32 UTC ---
Created an attachment (id=25228)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=25228)
Adding createStandardService method to MBeanFactory
This initial version of the patch adds createStandarService method. However I
am having some issues with the usage of the MBean with respect to MBeanFactory.
In the case of MBeanFactory both the managed resource and the associated MBean
are MBeanFactory instances. But only resource MBeanFactory object is properly
populated with a reference to the Server in its container field. The associated
MBean instance which gets registered in the MBean Server (created by JMX
infrastructure) doesn't get populated with this field since it is being created
using reflection in createMBean() method in ManagedBean class.
Now when the MBean createStandardService method is invoked using JMX (which
depends on container field being properly set - in this case the reference to
the single Server instance) the MBean and not the managed resource is invoked
causing a null pointer exception. The below code snippet in BaseModelBean
causes the above behaviour.
// Invoke the selected method on the appropriate object
Object result = null;
try {
if( method.getDeclaringClass().isAssignableFrom( this.getClass()) ) {
result = method.invoke(this, params );
} else {
result = method.invoke(resource, params);
}
}
Here as can be seen the precedence is given to the MBean object instead of the
associated resource object. Can somebody comment on the reason for the above
logic?
To get the resource MBeanFactory instance invoked I have included a check as
follows in the above condition which I think is not the way to go.
if( method.getDeclaringClass().isAssignableFrom( this.getClass())
&& !method.getDeclaringClass().equals(this.getClass()) ) {
Any ideas on this issue?
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
DO NOT REPLY [Bug 49045] JMX Enhancement- Provision of MBeanFactory
createStandardService
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49045
--- Comment #3 from chamith buddhika <ch...@gmail.com> 2010-04-07 11:45:01 UTC ---
(In reply to comment #2)
Hi Mark,
> You should be targeting your patches at Tomcat 7 aka trunk. Please raise bugs
> against Tomcat 7 too.
I will raise a bug for Tomcat 7 as well.
> The Factory can be associated with a Server or a Service. If it is associated
> with a Service it isn't valid to try adding another Service. That should
> probably throw an Exception.
Here what I was thinking was since technically a Server can contain more than
one service that it would be possible to add another service to the server
associated with the current service component in the MBeanFactory. I will
change it to throw an exception.
> Why are you creating an Engine too? Only a Service should be created. Creating
> an Engine should be a separate method.
Please correct me if I am wrong here. Since one service is always mapped only
to one Engine component it would be not possible to use an existing registered
Engine component with the newly created service without any side effects. Hence
the creation of a brand new engine within the new service. I saw this has been
done in the removed codes using ServerFactory as well. Another option would be
that user can seperately create an Engine component prior to Service creation
and register it and then use it to create the new Service. I will add a
separate method to create an Engine component in that case.
> I haven't looked at this in much detail but I'd be surprised if modifying the
> modeler code is necessary. I'd find a method on a bean that does work (eg the
> addAlias() method on a host) and see if anything is different about the way it
> is set up compared to the MBeanFactory.
I will look in to this further.
Thanks
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
DO NOT REPLY [Bug 49045] JMX Enhancement- Provision of MBeanFactory
createStandardService
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49045
--- Comment #6 from Mark Thomas <ma...@apache.org> 2010-04-12 17:58:00 EDT ---
Ping. When do you expect to have an updated patch?
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
DO NOT REPLY [Bug 49045] JMX Enhancement- Provision of MBeanFactory
createStandardService
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49045
--- Comment #2 from Mark Thomas <ma...@apache.org> 2010-04-06 21:32:20 UTC ---
A couple of comments.
You should be targeting your patches at Tomcat 7 aka trunk. Please raise bugs
against Tomcat 7 too.
The Factory can be associated with a Server or a Service. If it is associated
with a Service it isn't valid to try adding another Service. That should
probably throw an Exception.
If the Factory is associated with a Server then casting container to Server
should work.
Why are you creating an Engine too? Only a Service should be created. Creating
an Engine should be a separate method.
I haven't looked at this in much detail but I'd be surprised if modifying the
modeler code is necessary. I'd find a method on a bean that does work (eg the
addAlias() method on a host) and see if anything is different about the way it
is set up compared to the MBeanFactory.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org