I am kind of new to this so I was hoping that you guys could help me out..
I want to flush the cached data of all entity beans in my application when a specific event occures..
I have only been able to get to the following code which only flushes data of one entity bean:
MBeanServer server = MBeanServerLocator.locateJBoss();
ObjectName container = new ObjectName("jboss.j2ee:service=EJB,jndiName=myBean");
server.invoke(container, "flushCache", null, null);
How can I create an ObjectName to flush all data that has to do with my application (all beans in my .ear)? What will the string given to the constructor look like?
When using invoke, the ObjectName needs to be unique, meaning you can't create this: ObjectName("domain:service=*") and expect MBeanServer.invoke to invoke for all those MBeans.
You'll have to figure out how to get the names of all EJB in your ear. Should be someplace.