commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <craig...@gmail.com>
Subject Re: [modeler] Intro: How do I monitor?
Date Fri, 03 Dec 2004 04:32:27 GMT
On Thu, 02 Dec 2004 21:29:59 -0600, Vic <vin@friendvu.com> wrote:
> Thanks.
> So let me see if I understand:
> 
> 1. I have "Registry" create my objects and then my applications gets a
> handle to those objects via the "Registry". Or do I create the objects
> and then register. I think the 2nd.

Actually, both strategies are possible.  Tomcat, for example, has a
bunch of events that are fired when something interesting happens
(say, a new webapp is deployed).  When Tomcat starts up, a
particularly interesting listener class
(org.apache.catalina.mbeans.ServerLifecycleListener) registers itself
on all of the interesting events.  When it sees the event that some
particular new service object got created, it uses the Registry to
create and register a corresponding MBean in the JMX server.  Note
that the service objects themselves don't have to be JMX-aware for
this to work -- only the event listeners need to know about it. 
However, your service objects need to be instrumented with al the
event broadcasting stuff (for example, all the major objects in Tomcat
fire a PropertyChangedEvent when any property value is changed at
runtime) for this to work.

The alternative strategy would be to make each new service object
responsible for creating and registering its own MBean during its
startup processing.  However, this ties the service object
implementation classes to JMX, and is probably not the most desirable
approach.

A third approach, if you're using something like an IoC framework
where you get instances from a factory, would be to make a customized
factory that creates and registers MBeans for each service object that
it hands back to the application.

> 
> 2.THEN I have "traditional" JMX agent register those same MBeans that I
> get from the "Registry" to the "Sun HTML monitor thing"?
> And now I can monitor my    registered objects.
> 

That totally depends on the capabilities and configuration of whatever
JMX server implementation you're using -- and that is where you
rapidly go beyond my current experience (indeed, you've pretty much
exhausted my memory cache of knowledge about JMX with the last couple
of questions :-).

> Do I have that right? It would make sense to me like that.
> 
> Jumping to what I want to try: if my MBeans interfaces are also "CoR"
> Commands, I am  cool. But .... I can't configure my "MBeans Commands"
> using commons-chain XML... I guess I have to live with that. I realy do
> not want to configure my objects using JMX XML, mostly becuase I just
> don't know it (and I did not see much writen up about it so I could follow)

I bet you could create a single MBean that would take "catalog" and
"command" as parameters, and offer an execute method that would run
any possible chain.  No need to register them each as individual
MBeans, unless you needed to examine the results in some way that was
dependent on which chain you executed.

> 
> .V
> 

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message