구성 MBean의 지속성에 문제가 있습니다. 내 구성 :MBean 지속성
<bean id="adminMBean" class="pl.mobileexperts.catchme.mbeans.AdminSettingsMBean"></bean>
<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="assembler" ref="assembler" />
<property name="autodetect" value="true" />
<property name="namingStrategy" ref="namingStrategy"/>
</bean>
<bean id="attributeSource" class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource" />
<bean id="namingStrategy" class="org.springframework.jmx.export.naming.MetadataNamingStrategy">
<property name="attributeSource" ref="attributeSource" />
</bean>
<bean id="assembler" class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler">
<property name="attributeSource" ref="attributeSource" />
</bean>
@ManagedResource(objectName = "pl.mobileexperts.catchme:name=adminMBean",
description ="admin settings",
persistPolicy = "OnUpdate",
persistLocation = "c:/", persistName = "adminSettings.jmx")
public class AdminSettingsMBean {
private boolean moderatorModeEnabled;
public AdminSettingsMBean() {
}
@ManagedAttribute(persistPolicy = "OnUpdate")
public boolean isModeratorModeEnabled() {
return moderatorModeEnabled;
}
@ManagedAttribute(persistPolicy = "OnUpdate")
public void setModeratorModeEnabled(boolean moderatorModeEnabled) {
this.moderatorModeEnabled = moderatorModeEnabled;
}
}
내 목표는 (- dB로하지 파일 또는 메타 데이터에 저장) 속성 변경 후 상태를 저장하는 것입니다. JBoss가 재시작 된 후, 나의 MBean은 표준 값으로 초기화됩니다. PersistPolicy가 작동하지 않는 것 같습니다 ... PersistentMBean을 구현하려했지만 store() 및 load()가 호출되지 않았습니다. JBoss JMX 구현 문제 일 수 있습니다. 또한 어떤 사람들은 MBean에 AOP와 annotated 메소드를 사용하여이를 저장했습니다. 이 모든 게시물은 2008-2010 년 이었기 때문에 무언가가 변경되었을 수 있습니까?
내 보스의 설정은 내가 당신의 문제가 JMX의 제이 보스 구현 생각 (JBoss의-service.xml)
사용중인 JBoss 버전은 무엇입니까? 'persistPolicy'를 지원합니까? –
jboss-5.1.0.GA https://community.jboss.org/thread/175100?tstart = 0 계속 검색하고 있습니다 –
잘 모르는 몇 가지 이유 때문에이 페이지는 https://docs.oracle.com/javase/7/docs/api/javax/management/PersistentMBean.html에서 onUpdate가됩니다. 실제로 store()를 호출하지 않습니다. 항상 변경하여 도움이되는지 확인하십시오. (나도 trully 충격을 받는다) –