[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] Invalidating session cache programmatically?
|
On Wed, Nov 30, 2011 at 4:23 PM, Laird Nelson
<ljnelson@xxxxxxxxx> wrote:
OK; thanks. I've had a look at the MBean source code, and it seems to call through to an IdentityMapAccessor. Is there a particular reason I shouldn't look this MBean up and invoke its invalidateAllIdentiytMaps() operation?
For completeness, here's what I'm doing at the moment (from within a JUnit test):
final ArrayList<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null);
assertNotNull(servers);
assertEquals(1, servers.size());
final MBeanServer server = servers.get(0);
assertNotNull(server);
assertSame(server, ManagementFactory.getPlatformMBeanServer());
final Set<ObjectName> names = server.queryNames(new ObjectName("TopLink:Name=Session*,*"), null);
assertNotNull(names);
assertEquals(1, names.size());
final ObjectName name = names.iterator().next();
assertNotNull(name);
server.invoke(name, "invalidateAllIdentityMaps", null, null);
Best,
Laird
--
http://about.me/lairdnelson