我正在尝试以编程方式使用jmx刷新infinispan缓存。 我正在使用jboss eap 6.3和infinispan 5.2。 我可以停止并启动服务器上的缓存实例(登录服务器控制台显示'11:37:41,693 INFO [org.jboss.as.clustering.infinispan](pool-1-thread-4)JBAS010282:已停止ServiceRegistry-来自ServiceRegistryCache容器的缓存缓存 11:38:09,953 INFO [org.infinispan.jmx.CacheJmxRegistration](pool-1-thread-4)ISPN000031:MBean已成功注册到平台MBean服务器。 11:38:09,954 INFO [org.jboss.as.clustering.infinispan](pool-1-thread-4)JBAS010281:从ServiceRegistryCache容器启动ServiceRegistry-cache缓存'),但缓存仍未刷新。我得到了旧的价值观。我的代码如下所示。
String urlString = System.getProperty("jmx.service.url","service:jmx:remoting-jmx://" + host + ":" + port);
JMXDemo demo = new JMXDemo();
System.out.println(demo.testJMX(urlString));
String username = "abc";
String password = "abc#123";
HashMap env = new HashMap();
String[] creds = new String[2];
creds[0] = username;
creds[1] = password;
env.put(JMXConnector.CREDENTIALS, creds);
JMXServiceURL serviceURL = new JMXServiceURL(urlString);
JMXConnector jmxConnector;
jmxConnector = JMXConnectorFactory.connect(serviceURL, env);
MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();
objectName = new ObjectName("jboss.infinispan:type=Cache,name=\"ServiceRegistry-cache(local)\",manager=\"ServiceRegistryCache\",component=Cache");
connection.invoke(objectName, "clear", null, null);
connection.invoke(objectName, "stop", null, null);
connection.invoke(objectName, "start", null, null);
可能是什么原因?