Hi,
I am trying to implement a Timer-service which invokes an EJB workflow. This MBean has
to be independent from the running container. So I dont want to use the Jboss
packeges, only the JMX. I am able to deploy and install the MBean, but I get no
notification. Also the available examples from web are not running. Has someone an
idea? I am using jboss 3.2.1
Thank you,
Juraj
This is the MBean interface, which I want to use:
public interface DPESAPSynchServiceMBean extends TimerMBean {
public String getDesc();
public void setPeriod(Integer period);
public Integer getPeriod();
public void start();
public void stop();
// public Integer addNotification(String type, String message, Object userData,
Date date);
}
And this is the implementing bean:
public class DPESAPSynchService extends Timer implements DPESAPSynchServiceMBean,
NotificationListener{
private MBeanServer lserver;
public DPESAPSynchService(){
super();
System.out.println("starting Constructor");
lserver = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0);
System.out.println("mbeanserver: "+lserver);
}
.....
public synchronized void start(){
System.out.println("starting DPESAPSynchService");
try{
Set lBeans = lserver.queryMBeans(new
ObjectName("IKServices","service","DPESAPSynchService"),null);
if(lBeans.isEmpty()){
System.out.println("lbeans are empty: "+lBeans);
}else{
System.out.println("lbeans are not empty: "+lBeans.size());
ObjectInstance lTimer = (ObjectInstance) lBeans.iterator().next();
System.out.println("objectinstance timer: "+lTimer);
lserver.addNotificationListener(
lTimer.getObjectName(),
//new DPESAPSynchNotificationListener(),
this,
null,
null
);
System.out.println("listener registered");
System.out.println("object: "+lTimer.getObjectName());
System.out.println("object: "+lTimer.getClass());
Date lNext = new Date(new Date().getTime() + Timer.ONE_MINUTE);
System.out.println("will call listener at "+lNext);
Integer lOneMinuteTimer = (Integer) lserver.invoke(
lTimer.getObjectName(),
"addNotification",
new Object[]{
"IDoNotKnowWhatTypeIs",
"I call you with this timer",
null,
lNext,
},
new String[]{
"".getClass().getName(),
"".getClass().getName(),
"java.lang.Object",
Date.class.getName(),
}
);
System.out.println("return from add: "+lOneMinuteTimer);
}
}catch(MalformedObjectNameException e){
System.out.println("Error: "+e);
}catch(InstanceNotFoundException e){
System.out.println("Error: "+e);
}catch(ReflectionException e){
System.out.println("Error: "+e);
}catch(MBeanException e){
System.out.println("Error: "+e);
}
}
public Integer addNotification(String type, String message, Object userData, Date
date) {
Integer i = super.addNotification(type, message, userData, date);
System.out.println("running addNotification in service");
System.out.println(type);
System.out.println(message);
System.out.println(userData);
System.out.println(date);
return i;
}
}
This is my configuration entry in my SAR file:
<mbean code="com.tsystems.ik.ejb.wf.invest.DPESAPSynchService"
name="IKServices:service=DPESAPSynchService" >
</mbean>
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user