This content has been marked as final.
Show 5 replies
-
1. Re: How to stop MDB programmatically
sergiu_pienar Mar 30, 2011 7:17 AM (in response to sergiu_pienar)After some suggestions by Jaikiran I found this :
public static void stopAllMDB() throws InterruptedException, MalformedObjectNameException, NullPointerException { String currentVersion = "1.0"; for (String name : Util.MDB_NAMES) { String mbean = "jboss.j2ee:ear=myEar" + currentVersion + ".ear,jar=myJar.jar,name=myMDB,service=EJB3"; ObjectName objName = new ObjectName(mbean); System.out.println("Stop MDB " + name); try { MBeanServer mbeanServer = MBeanServerLocator.locateJBoss(); MessagingDelegateWrapperMBean invoker = (MessagingDelegateWrapperMBean)MBeanProxy.get(MessagingDelegateWrapperMBean.class, objName, mbeanServer); invoker.stopDelivery(); } } catch (Exception e) { }
However this fails at
MessagingDelegateWrapperMBean invoker = (MessagingDelegateWrapperMBean)MBeanProxy.get(MessagingDelegateWrapperMBean.class, objName, mbeanServer);
with IllegalArgumentsException.
Thx.
-
2. How to stop MDB programmatically
genman Mar 30, 2011 3:51 PM (in response to sergiu_pienar)1 of 1 people found this helpfulCheck (print out) the arguments you're passing in. If they make sense, then print out the entire stack trace.
-
3. Re: How to stop MDB programmatically
sergiu_pienar Mar 31, 2011 2:42 AM (in response to genman)I've changed
MessagingDelegateWrapperMBean invoker = (MessagingDelegateWrapperMBean)MBeanProxy.get(MessagingDelegateWrapperMBean.class, objName, mbeanServer);
to
mbeanServer.invoke(objName, "stopDelivery", new Object[] {}, null);
and it does seem to work.
This method returns null ... and I'm a bit confused because the API specifies this :
Returns: any result of the operation
How can I properly check if the MBD's are stopped after the call ?
Thx.
-
4. Re: How to stop MDB programmatically
jaikiran Mar 31, 2011 2:56 AM (in response to sergiu_pienar)I haven't looked at that method, but null is OK I guess.
-
5. How to stop MDB programmatically
sergiu_pienar Mar 31, 2011 2:58 AM (in response to jaikiran)1 of 1 people found this helpfulThx jaikiran.I was just curios if null is good.