- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我的配置 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 实现问题。还有一些人使用 AOP 和 MBean 中的注释方法来存储它们。所有这些帖子都是从 2008 年到 2010 年发布的,所以可能发生了一些变化?
我的 JBoss 配置是默认的 (jboss-service.xml)
最佳答案
我认为你的问题是 JMX 的 JBoss 实现。根据 JSR160,为属性指定 persistPolicy=OnUpdate
应该会导致每次更新属性时都保持不变(来自 JSR160 1.4):
persistPolicy - Defines the default persistence policy for attributes in this MBean that do not define their own persistPolicy. Takes on one of the following values:
[...]
- OnUpdate - The attribute is stored every time the attribute is updated.
这很可能是由 Sun 的 PersistMBean
的 Javadoc 中的这个非常奇怪的文本引起的(正如 @Plínio Pantaleão 所指出的):
Do not store the MBean if 'persistPolicy' field is:
= "never"
= "onUpdate"
= "onTimer" && now < 'lastPersistTime' + 'persistPeriod'
除了向 JBoss 报告此问题(以及向 Sun 报告 Javadoc 问题)之外,您还可以使用 persistPolicy=Always
策略(同样来自 JSR160)来解决它:
- Always - This is a synonym of OnUpdate, which is recognized for compatibility reasons. It is recommended that applications use OnUpdate instead. An implementation of the Descriptor interface, such as DescriptorSupport, can choose to replace a value of “Always” for persistPolicy by a value of “OnUpdate”.
关于java - MBean 持久性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9359483/
我想知道将内存中的树结构存储为用于持久性目的的目录树的实用性。在我的例子中,他的目标文件系统将是 ZFS,一旦创建了结构,它将很少被多个进程访问。 使用目录树作为数据树持久化机制的性能如何? 最佳答案
我已经创建了 docker private registry 并且能够从同一网络中的其他 raspi 推送和拉取(将 registry ip 添加到 insecure-registry 选项) doc
我正在尝试构建我的第一个“真正的”Haskell 应用程序,一个使用 Servant 的 API,我在其中使用 Persistent 作为数据库后端。但是我在尝试使用 Persistent 进行某种类
我已经在 stackoverflow 上看到了 ASP.NET MVC C# 中的持久性 cookie 示例。但我不明白为什么下面的代码不起作用。 首先我写入cookie: HttpCookie co
我是 Java Persistence API 的新手.我刚学会它,现在想在我的 Java 桌面应用程序中使用它。但我有以下问题: Q1。哪个 JPA 实现的大小最小(因为我希望我的应用程序的大小尽可
我正在尝试按照 android 蓝图指南将 MVP 模式实现到我的项目中。目前,我将用户(实体数据)保存在我的 Presenter 中,我真的不喜欢这样做,因为在每次配置更改时,presenter 都
我需要一个类似 map 的数据结构(在 C++ 中)来存储具有以下功能的对 (Key,T): 可以在当前结构中插入新元素(Key,T) 可以在当前结构中根据Key搜索元素 您可以制作当前版本结构的“快
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
我的配置 MBean 的持久性存在问题。我的配置: @ManagedResource(objectName = "pl.mobile
docker 中的 RabbitMQ 在删除没有卷的容器后丢失数据。 我的 Dockerfile: FROM rabbitmq:3-management ENV RABBITMQ_HIPE_COMPI
我正在尝试编写一个类型类,以简化使用持久性、aeson 和 scotty 编写 CRUD 后端 这是我的想法: runDB x = liftIO $ do info CRUD a where
当我尝试使用 持久化对象时遇到问题多线程 . 详情: 假设我有一个对象 PaymentOrder其中有一个列表 PaymentGroup (一对多关系)和 PaymentGroup包含 CreditT
我想使用纯功能数据结构和以下操作来实现环形缓冲区 通过索引进行高效随机访问 添加到前面 从背面移除 使用持久数据结构的原因是因为我有一个写入器线程和多个读取器线程,并且我想避免读取器阻塞写入器。 这可
persistence.xml 中关于 derby 客户端驱动程序的属性声明应该是什么?例如: 当我想从 Java 更新数据库时,我不断收到下面的异常。 实际上我需要客户端驱动程序而不是 Embed
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 9 年前。 Improve this ques
我希望用户即使关闭浏览器也不必登录。我的 cookie 将在一个月后过期。 用户登录成功 $session = CGI::Session->new (undef, undef, {Directory
我正在与 JBOss 作斗争,并且遇到了一个似乎很难解决的问题,但事实证明我不能。当我尝试部署一个简单的 Java Web 应用程序时,遇到异常: org.hibernate.ejb.Hibernat
当使用具有持久性的 Workflow Foundation 时,我们想删除一些(或全部)工作流,这些工作流不再应该被持久化/运行。 我可以使用任何脚本/工具吗? 最佳答案 没有可用于执行此操作的标准
我正在使用 JPA,并且我正在为所有引用实体使用二级缓存。一切正常,我可以从二级缓存中获取实体,因为它们之前已经被选中。 现在,我有两个应用程序,它们都使用相同的数据库(因此它们都使用相同的表、值等)
所以我正在制作一个 spring-boot 应用程序,并且从外部库导入一些数据模型(通过 maven 导入)。我有一些模型,它有一个外部库类型的字段,我希望能够保留它。像这样的东西: package
我是一名优秀的程序员,十分优秀!