[jboss-user] [Management, JMX/JBoss] - Persistence not quite working

bossy do-not-reply at jboss.com
Tue Jan 30 12:31:09 EST 2007


Hello,
I have two XMBeans which attributes I'd like to persist. My problem is that while the first MBean persists its attributes, the second doesn't. After couple of hours I found out that the difference between the two XMBeans is that the attributes for the first one( which is a configuration bean)  are ?read-write? and when I press ?Apply Changes? button from the JMX console, the values are saved as per the ?xmbean.xml file. The attributes of the second one are ?read-only?, as I update them using a different mechanism. This results in the attribute values not being saved. I added a setter to one of the attributes( just to prove that this is indeed the reason) and once I updated this attribute by clicking on the ?Apply changes? button, the value was saved and the next time I re-started the server I was able to see the correct value.
My question is ? is this a bug and is there a way to work around this problem?

To illustrate the problem I added extracts from my code

stats-xmbean.xml

<!DOCTYPE mbean PUBLIC
  |    "-//JBoss//DTD JBOSS XMBEAN 1.0//EN"
  |    "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_0.dtd">
  | 
  | <mbean>
  |    <description></description>
  | 
  |    <descriptors>
  |       <persistence persistPolicy="OnUpdate"
  |          persistPeriod="10"
  |          persistLocation="${jboss.server.data.dir}"
  |          persistName="StatsJNDIMap.ser"/>
  |       <currencyTimeLimit value="10"/>
  |       <state-action-on-update value="keep-running"/>
  |       <persistence-manager value="org.jboss.mx.persistence.ObjectStreamPersistenceManager" />
  |    </descriptors>
  | 
  |    <class>org.jboss.test.jmx.xmbean.JNDIMap</class>
  | 
  |    <constructor>
  |       <description>The default constructor</description>
  |       <name>JNDIMap</name>
  |    </constructor>
  | 
  | 
  |    <!-- Attributes -->
  | 
  |    <attribute access="read-write" getMethod="getStartDate" setMethod="setStartDate">
  |       <description>Start Date</description>
  |       <name>Start Date</name>
  |       <type>java.lang.String</type>
  |    </attribute>
  | 
  | 
  |    <attribute access="read-only" getMethod="getInBoxReqCount" >
  |       <description>Number of requests</description>
  |       <name>Get Message Requests</name>
  |       <type>java.lang.String</type>
  | 
  |    </attribute>
  | 
  |   ... more
  | 

StatsXMBean.java

public class StatsXMBean extends ServiceMBeanSupport
  | {
  | ... more
  | }
  

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4008416#4008416

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4008416



More information about the jboss-user mailing list