How do I schedule a JBoss task? -


i have scheduled task in jboss:

<?xml version="1.0" encoding="utf-8"?>    <server>     <mbean code="org.jboss.varia.scheduler.scheduler" name="acme:service=scheduler">      <attribute name="...">...</attribute>      .....   </mbean>    </server>   

how write task, execute @ 1:00 on first day of every month? thank you!

you'll need create scheduling class. org.jboss.varia.scheduler.scheduler

since want perform monthly , cannot state attribute. you'll need have class handles setting next interval. java monthly timer

have scheduler class call monthly timer next interval , set it. maybe pass values @ initial start.

<mbean code="org.jboss.varia.scheduler.scheduler"        name="jboss.docs:service=scheduler">     <attribute name="startatstartup">true</attribute>     <attribute name="schedulableclass">org.jboss.book.misc.ex2.exschedulable</attribute>     <attribute name="schedulablearguments">01:00</attribute> <!-- 24hr time hh:mm -->     <attribute name="schedulableargumenttypes">java.lang.string</attribute>  </mbean> 

exschedulable (this pseudo-code)

public exschedulable(string time)  {     date tdate = new date();     tdate.settime(time);      monthly monthyobj = monthly(1); //day of month     //gets next interval date specified day of month      date nextinterval = monthyobj .getnextinterval(tdate);   } 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -