Hi Marco,

I am new to JMX but I assume a pure JMX implementation should be portable to other 
servers. I have developed a MBean which can be started. If this MBean is started, the 
configuration will be loaded and the Listener added. Thats all I want to do. 

I would be interested in your code.

Juraj

-----Urspr�ngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 18. August 2003 14:37
An: [EMAIL PROTECTED]
Betreff: RE: [JBoss-user] JMX Timer


Hi,
        i have implemented a similar case using Timer service and 
a MessageDriven bean, but in jboss. will it help? i guess how i am retrieving
the Timer service is independent from the JMX implementation anyway
can u tell me how your application is working?
i can attach (via private email) the sourcecode of my sample if u want...

regards
        marco

> -----Original Message-----
> From: ext [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: 18 August, 2003 15:16
> To: [EMAIL PROTECTED]
> Subject: [JBoss-user] JMX Timer
> 
> 
> 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


-------------------------------------------------------
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


-------------------------------------------------------
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

Reply via email to