Announcement Announcement Module
No announcement yet.
Exposing Methods Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exposing Methods

    In the springframework.scheduling.quartz.CronTriggerBean there are get/setCronExpression which takes a String. I would like to expose these via JMX so that the cron expression can be changed at runtime.

    However, there is a setCronExpression in the org.quartz.CronTrigger that takes an object of org.quartz.CronExpression. When I use the MethodNameBasedMBeanInfoAssembler class to manage which methods to expose it exposes both the string and object version of setCronExpression.

    How do I stop the object version of setCronExpression being exposed.

      <bean id="triggerJobDetailCleaner"
        <property name="jobDetail" ref="jobDetailJobDetailCleaner" />
        <!--  Cron Expression. -->
        <property name="cronExpression" value="0/5 * * * * ?" />
      <bean id="scheduler"
        <property name="triggers">
            <ref local="triggerJobDetailCleaner" />
      <bean id="exporter"
        <property name="beans">
              key=" Up"
              value-ref="triggerJobDetailCleaner" />
        <property name="assembler">
            <property name="managedMethods">

  • #2
    I doubt that you can use the MethodNameBasedMBeanInfoAssembler to filter out one setCronExpression method without filtering both out. In other words, I don't think there is any mechanism to specify parameters passed to these methods to differentiate and distinguish them from one another when associating method names with the MethodNameBasedMBeanInfoAssembler.

    I recommend instead using the InterfaceBasedMBeanInfoAssembler. You could write a very simple interface that includes only the setCronExpression method with an exact signature match to the one you desire to manage (as well as other methods you wish to expose as JMX operations such as getPreviousFireTime). Then, you can apply this interface via the InterfaceBasedMBeanInfoAssembler in your Spring XML configuration file. You don't even need the class that will be made into an MBean to actually declare its implementation of this interface. In other words, if you like, you only need use this interface in your Spring configuration.

    An example of the difference between the Method Name approach and the Interface approach for narrowing down which methods are exposed as operations is available at


    • #3
      Hi, dpfarr:
      spring_dm's right. You can use InterfaceBasedMBeanInfoAssembler instead to expose your method more flexible. By the way, did you invoked these methods you listed successfully?
      I configured the same spring XML file as you, and I tried use MC4J to monitor and manage the schedule MBean. It showed all MBean attributes and methods I exposed, but the schedule didn't change after I edit the "CronExpression" & "NextFireTime" even I invoked their getter/setter.
      For a instance, I set CronExpression value from "0/5 * * * * *" to "0/10 * * * * *" and set NextFireTime a value of later, but the schedule still fire per 5 seconds, not 10.
      Last edited by charles-xie; Mar 15th, 2009, 08:24 AM.