cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: Expose MBeans in CXF
Date Sat, 21 May 2011 15:37:29 GMT
>> Are you saying that you have to use UriInfo and UriBuilder for
>> creating hrefs whenever you need to
>> build an MBean representation ?
>>
>
> After everytime server bounces, I need to at first use this url request:  http://localhost:8080/services/jmx/,
the good thing is, this request only need once,
>

What do you mean it is needed only once ?

> Then my JMXServer will save the UriInfo and also all the href values in MBean are fixed,
no further change until another server's bounce.
>

I don't understand - as I said on IRC JMXServer should expect
endpoints created dynamically

Cheers, Sergey

>> Please have UriInfo injected in one of the JMXServer's fields, remove
>> NPE declaration
>>
> Done.
>
>
> I will do a fewer more rounds of testing, and put up the source code again.
>
>
>
> Thank you.
>
>
> Regards:
> Shenglin Qiu
>
>
>
>> Date: Fri, 20 May 2011 11:39:55 +0100
>> Subject: Re: Expose MBeans in CXF
>> From: sberyozkin@gmail.com
>> To: dabaipang@hotmail.com
>> CC: dev@cxf.apache.org
>>
>> Hi Shenglin
>>
>> I've removed some XML fragments to make it simpler to read...
>>
>> > Here is what I have right now:
>> >
>> > <MBeans>
>> >    <MBean href="http://localhost:8080/services/jmx/mbean/0">
>> >    </MBean>
>> > </MBeans>
>> >
>>
>> OK
>>
>> >
>> > And
>> > Request:
>> > http://localhost:8080/services/jmx/mbean/0
>> > Response:
>> > <MBean href="http://localhost:8080/services/jmx/mbean/0">
>> > </MBean>
>> >
>> > And so on with others.
>>
>> Very good.
>>
>> >
>> > However, I have to make http://localhost:8080/services/jmx/ at every time I
>> > am trying to do anything further, because I need to use this following
>> > function to load up all mbeans along with their /mbean/** unique
>> > identifiers, and I think this may not be what you want. Please correct me on
>> > this.
>> >
>> Are you saying that you have to use UriInfo and UriBuilder for
>> creating hrefs whenever you need to
>> build an MBean representation ?
>>
>
>
>
>> Perhaps, you may want to keep "http://localhost:8080/services/jmx/"
>> parts of hrefs in the map as well, as you suggested on #cxf. This will
>> let you avoid recalculating the base values for those MBeans which
>> have already been retrieved before. These values may not 'survive' the
>> restarts for ex, say a port may've been changed, etc,  but I agree it
>> may be worth optimizing. I'm not sure if injecting  UriInfo via
>> constructor can provide a way to get to the base address at the
>> JMXServer initialization time - may be worth trying later on...
>>
>> Please don't spend much time on it right now, because it's more
>> important at the moment to try to build a more or less complete
>> solution around exposing JMX mbeans over HTTP.
>>
>> Have a look at it a bit further, and then start focusing on making sure
>>
>> "http://localhost:8080/services/jmx/mbean/0", etc, are handled by
>> MBeanResource subresource, we can keep adding methods for dealing with
>> individual MBeans to JMXServer itself, but  having a subresource
>> dealing with such requests may be a bit cleaner...
>>
>>
>> >     @GET
>> >     public CxfMBeanCollection traversMBeans(@Context UriInfo uriInfo) throws
>> > MalformedObjectNameException, NullPointerException{
>> >     ....
>> >    }
>> >
>> >
>>
>> Please have UriInfo injected in one of the JMXServer's fields, remove
>> NPE declaration
>>
>> Cheers, Sergey
>> >
>> > Thank you.
>> >
>> > Regards:
>> > Shenglin Qiu
>> >
>> >
>> >> Date: Thu, 19 May 2011 17:02:36 +0100
>> >> Subject: Re: Expose MBeans in CXF
>> >> From: sberyozkin@gmail.com
>> >> To: dev@cxf.apache.org
>> >>
>> >> Every MBean should have a unique id so that we can work with it later
>> >> on individually.
>> >> 0, 1, 2, 3, n, represents the unique part in the otherwise same URI.
>> >> When working with MBeans (when populating MBeans collections, etc) you
>> >> need to associate some unique number with every MBean. Have some local
>> >> AtomicInteger var, have some map there which will keep pairs like
>> >> id: Mbean ref
>> >>
>> >> and generate 'id' dynamically if none already exists in the map for a
>> >> given MBean
>> >>
>> >> may be it should be
>> >>
>> >> Map<String, Integer>
>> >> where String is a canonical name.
>> >>
>> >> So when later on you process something like
>> >> /mbean/234
>> >>
>> >> you can get 234, use it to find the canonical name (or actual JMX
>> >> MBean reference), and use the latter to init an instance of
>> >> MBeanResource which will deal with the request
>> >>
>> >> Ping me on IRC please if you have any questions
>> >> Cheers, Sergey
>> >>
>> >> On Thu, May 19, 2011 at 4:43 PM, Shenglin Qiu <dabaipang@hotmail.com>
>> >> wrote:
>> >> >
>> >> > Yes, Sergey,
>> >> >
>> >> > Should I manually give/define every mbean an indexer which is
>> >> > accumulated as you mentioned?
>> >> >> > http://localhost:8080/services/jmx/mbean/0
>> >> >> > http://localhost:8080/services/jmx/mbean/1
>> >> >> > http://localhost:8080/services/jmx/mbean/2
>> >> > ...
>> >> >> > http://localhost:8080/services/jmx/mbean/***
>> >> > Thank you.
>> >> >
>> >> > Regards:
>> >> > Shenglin Qiu
>> >> >
>> >> >> Date: Thu, 19 May 2011 15:03:03 +0100
>> >> >> Subject: Re: Expose MBeans in CXF
>> >> >> From: sberyozkin@gmail.com
>> >> >> To: dev@cxf.apache.org
>> >> >>
>> >> >> HI Shenglin
>> >> >>
>> >> >> On Thu, May 19, 2011 at 2:54 PM, Shenglin Qiu <dabaipang@hotmail.com>
>> >> >> wrote:
>> >> >> >
>> >> >> > Yes Sergey, will have these following pattern:
>> >> >> >
>> >> >> > http://localhost:8080/services/jmx/mbean/0  -> CXF Bus
>> >> >> >
>> >> >> > http://localhost:8080/services/jmx/mbean/01   -> UserService
>> >> >> >
>> >> >> > http://localhost:8080/services/jmx/mbean/0123   -> CustomerService
>> >> >> >
>> >> >> > http://localhost:8080/services/jmx/mbean/01234  -> GreeterService
>> >> >> > (Soap)
>> >> >> >
>> >> >> > http://localhost:8080/services/jmx/mbean/012   -> JMXServer
will be
>> >> >> > hidden to user.
>> >> >> >
>> >> >>
>> >> >> That looks better, but do you think it would make sense to avoid
the
>> >> >> concatenation ?
>> >> >> We can get hundreds of CXF MBeans in the production environment,
so
>> >> >> IMHO it would be simpler
>> >> >> to have /mbean/199 identifying a particular MBean,
>> >> >>
>> >> >> Cheers, Sergey
>> >> >>
>> >> >> >
>> >> >> > Regards:
>> >> >> >
>> >> >> > Shenglin Qiu
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Sergey Beryozkin
>> >>
>> >> Application Integration Division of Talend
>> >> http://sberyozkin.blogspot.com
>> >
>>
>>
>>
>> --
>> Sergey Beryozkin
>>
>> Application Integration Division of Talend
>> http://sberyozkin.blogspot.com
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Mime
View raw message