|
From: Rob H. <ro...@ca...> - 2005-01-25 14:18:09
|
Mark,
Just committed a fix to this. I guess I made the mistake of testing
against the reference implementation when MX4J is actually a more
accurate implementation ;). The problem was the default cache was set to
never stale and so MX4J will always use its cached value which is
unfortunately null. I set the default cached value to be -1 which is
always stale (no caching). You can change this with the
currencyTimeLimit property of the ManagedOperation attribute.
Regarding parameter information - that is a really good idea. The only
problem I foresee is that configuration will unwieldy and index-based
since it is impossible to get parameter names at runtime using reflection.
Rob
Rob Harrop wrote:
> Actually ignore that - I have managed to reproduce this in a test -
> I'll look into it a bit more.
>
> Rob
>
> Rob Harrop wrote:
>
>> Mark,
>>
>> I guess this is a stupid question, but you did compile the Commons
>> Attributes stuff? I ran all the tests against MX4J and they seems to
>> run fine - including the method invocation ones.
>>
>> Rob
>>
>> Rob Harrop wrote:
>>
>>> Mark,
>>>
>>> It seems that you are using a fairly old version of JMX - a lot of
>>> the class names are now different, but I don't think that is the
>>> problem. I've put some time aside next week to really polish up JMX
>>> support and perform a lot of testing on different platforms. I'll
>>> get you an answer on this during the week.
>>>
>>> Rob
>>>
>>> Mark Pollack wrote:
>>>
>>>> Hi,
>>>>
>>>> I was playing around with the JMX sandbox - very useful - and have
>>>> a few questions Wasn't sure if I should post on the forum...but
>>>> anyway...
>>>>
>>>> I couldn't get the MetadataModelMBeanInfoAssembler to work, when I
>>>> tried to execute a managed operation I got "no result" shown in the
>>>> MX4J http console, although only the methods I chose to expose were
>>>> displayed. If I remove the usage of the metadata and rely on the
>>>> reflection support - it all works fine but I'd like to only expose
>>>> some of the methods in my class.
>>>>
>>>> Here is a code snip since I was doing this inside a helper class I
>>>> already had for MX4J. Commenting out the metadata config code
>>>> results in a happy app... :)
>>>> JmxMBeanAdapter adapter = new JmxMBeanAdapter();
>>>> adapter.setBeanFactory(beanFactory_);
>>>> adapter.setServer(mBeanServer_);
>>>> adapter.setBeans(beans_);
>>>> //metadata config start
>>>>
>>>> JmxAttributeSource attributesImpl = new
>>>> CommonsAttributesJmxAttributeSource();
>>>> MetadataModelMBeanInfoAssembler ass = new
>>>> MetadataModelMBeanInfoAssembler();
>>>> ass.setAttributeSource(attributesImpl);
>>>> MetadataNamingStrategy naming = new MetadataNamingStrategy();
>>>> naming.setAttributeSource(attributesImpl);
>>>> adapter.setAssembler(ass);
>>>> adapter.setNamingStrategy(naming);
>>>>
>>>> //metadata config end
>>>> LOG.info("Registering mbeans....");
>>>> adapter.afterPropertiesSet();
>>>> LOG.info("Done registering mbeans.");
>>>>
>>>> and I have added attributes such as
>>>>
>>>> /**
>>>> *
>>>> @@org.springframework.jmx.metadata.support.ManagedResource(objectName="TeamWork:Name=UserService",
>>>> description="User Management")
>>>> * */
>>>> public class HibernateUserService extends HibernateDaoSupport
>>>> implements
>>>> UserService
>>>>
>>>>
>>>> /**
>>>> * *
>>>> @@org.springframework.jmx.metadata.support.ManagedOperation(description="Create
>>>> a user with a unique id")
>>>> */
>>>> public User create(String uniqueName)
>>>>
>>>>
>>>> and the beans_ map contains an entry <entry
>>>> key="TeamWork:Name=UserService"><ref bean="UserService"/></entry>
>>>>
>>>> with a log like this....
>>>>
>>>> INFO [main] 2005-01-21 17:26:01,359
>>>> [com.codestreet.application.jmx.DefaultAdapterFactoryBean] -
>>>> Registering mbeans....
>>>>
>>>> DEBUG [main] 2005-01-21 17:26:01,671
>>>> [org.springframework.jmx.JmxMBeanAdapter] - Bean Name: UserService
>>>> has been autodetected for JMXification. Instantiating Now.
>>>>
>>>> DEBUG [main] 2005-01-21 17:26:01,671
>>>> [org.springframework.jmx.JmxMBeanAdapter] - Bean with name:
>>>> UserService is already registered for JMXification.
>>>>
>>>> DEBUG [main] 2005-01-21 17:26:01,906
>>>> [org.springframework.jmx.JmxMBeanAdapter] - Located bean under key
>>>> [TeamWork:Name=UserService] registering with JMX server.
>>>>
>>>> DEBUG [main] 2005-01-21 17:26:01,906
>>>> [org.springframework.jmx.JmxMBeanAdapter] - Registering and
>>>> Assembling MBean: TeamWork:Name=UserService
>>>>
>>>> INFO [main] 2005-01-21 17:26:01,937
>>>> [org.springframework.jmx.JmxMBeanAdapter] - Registered MBean:
>>>> TeamWork:Name=UserService
>>>>
>>>> INFO [main] 2005-01-21 17:26:01,937
>>>> [com.codestreet.application.jmx.DefaultAdapterFactoryBean] - Done
>>>> registering mbeans.
>>>>
>>>>
>>>>
>>>> Another issue was that for some reason the commons-attributes
>>>> compiler was changing the string TeamWork:Name=UserService to
>>>> TeamWork.Name=UserService, replacing the colon with a period. Have
>>>> you seen that?
>>>>
>>>> By way of extention has it been considered to add support for
>>>> decribing method parameters in the operation attribute and relaying
>>>> that info to the modelmbean?
>>>>
>>>> Thanks any help...
>>>>
>>>> Cheers,
>>>> Mark
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> -------------------------------------------------------
>>>> This SF.Net email is sponsored by: IntelliVIEW -- Interactive
>>>> Reporting
>>>> Tool for open source databases. Create drag-&-drop reports. Save time
>>>> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
>>>> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
>>>> _______________________________________________
>>>> Springframework-developer mailing list
>>>> Spr...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> -------------------------------------------------------
>>> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
>>> Tool for open source databases. Create drag-&-drop reports. Save time
>>> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
>>> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
>>> _______________________________________________
>>> Springframework-developer mailing list
>>> Spr...@li...
>>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>>
>>>
>>
>>
>> -------------------------------------------------------
>> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
>> Tool for open source databases. Create drag-&-drop reports. Save time
>> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
>> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
>> _______________________________________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>
>>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
|