1 Reply Latest reply on May 20, 2008 5:36 PM by Elias Ross

    JBoss Scheduler problem

    aodhan hoffman Newbie

      I'm trying to set up an audit to run at a scheduled interval. I've tested the audit and confirmed that it works when run manually. Now I'm trying to use the JBoss timer service to get it to run unattended.

      I've imported the varia Schedulable interface, and I've put an mbean descriptor in the jar's META-INF directory, but as near as I can tell, the class never instantiates or fires off.

      I've tried to make sense of the documentation, but it doesn't give a fully fleshed out example of how it's supposed to be deployed and the *-service.xml example is just a tad vague as to how to define the mbean.

      package com.boeing.nmt.nls.audit;
      
      
      import ...
      
      import org.jboss.logging.Logger;
      
      import org.jboss.varia.scheduler.Schedulable;
      
      public class AuditorBean implements Schedulable
      {
      ...
      
       public AuditorBean(String foo)
       {
       log.debug("AuditorBean instantiated: " + foo);
       ...
      
       log.debug("AuditorBean finished");
       }
      
       public void perform(Date now, long remainingRepetitions)
       {
       log.debug("AuditorBean.perform():\n\tnow: " + now +
       "\n\tremainingRepetitions: " + remainingRepetitions +
       "\n\thost: " + host + "\n\trecipients: " + recipientList);
       audit();
       }
      
       public void audit()
       {
       log.debug("AuditorBean.audit() called");
       ...
       }
      ...
      }


      here's the audit-service.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <server>
       <mbean code="com.boeing.nmt.nls.audit.AuditorBean"
       name="nmt.nls:service=AuditScheduler">
       <attribute name="StartAtStartup">true</attribute>
       <attribute name="SchedulableClass">com.boeing.nmt.nls.audit.AuditorBean</attribute>
       <attribute name="SchedulableArguments">Foo</attribute>
       <attribute name="SchedulableArgumentTypes">java.lang.String</attribute>
       <attribute name="InitialStartDate">NOW</attribute>
       <attribute name="SchedulePeriod">5000</attribute>
       <attribute name="InitialRepetitions">3</attribute>
       <attribute name="FixedRate">true</attribute>
       </mbean>
      
       <depends>
       <mbean code="javax.management.timer.Timer" name="jboss:service=Timer"/>
       </depends>
      </server>
      


      and here's the structure of my jar:
      C:\Documents and Settings\tx714c\My Documents\workspace\EJB3fun\files>jar -tvf ..\gen\AuditorBean.jar
       0 Tue May 20 13:25:02 PDT 2008 META-INF/
       106 Tue May 20 13:25:00 PDT 2008 META-INF/MANIFEST.MF
       0 Tue May 20 09:55:46 PDT 2008 com/
       0 Tue May 20 09:55:46 PDT 2008 com/boeing/
       0 Tue May 20 09:55:46 PDT 2008 com/boeing/nmt/
       0 Tue May 20 09:55:46 PDT 2008 com/boeing/nmt/nls/
       0 Tue May 20 09:55:46 PDT 2008 com/boeing/nmt/nls/audit/
       2030 Tue May 20 13:11:10 PDT 2008 META-INF/audit-service.xml
       131 Mon May 19 08:57:06 PDT 2008 META-INF/mail.properties
       13383 Tue May 20 12:43:14 PDT 2008 com/boeing/nmt/nls/audit/AuditorBean.class
       2030 Tue May 20 13:11:10 PDT 2008 META-INF/audit-service.xml
       131 Mon May 19 08:57:06 PDT 2008 META-INF/mail.properties