-
1. TimedObject in EJB 2.1 Draft
tlaresch Jul 23, 2002 2:10 PM (in response to fredericagneray)Frederic,
You might be interested in reading "What's New in EJB 2.1" to see what's planned for a new timer service, which allows enterprise beans to register for timed events.
http://www.theserverside.com/resources/article.jsp?l=MonsonHaefel-Column1
Perhaps you might want to structure your efforts to follow the proposed interface?
Good luck with your efforts!
- Tom -
2. Re: Dynamic scheduler....
tlaresch Jul 23, 2002 5:05 PM (in response to fredericagneray)Frederic,
There appears to be a mismatch between the instructions above and the posted code.
Line above reads:
we need to add:
<mbean code="com.lombardrisk.f3.scheduler.TaskStarter" name="DefaultDomain:service=TaskStarter" />
But the code you posted is in a different package:
net.dairdeville.scheduler.TaskStarter
Regards,
- Tom L. -
3. Re: Dynamic scheduler....
fredericagneray Jul 24, 2002 5:29 AM (in response to fredericagneray)Tom,
I did this job for my company and quicly change the name of the package. This is a mistake, the correct name is net.dairdeville.TaskStarter. What it does is simply call an MBean responsable to read the database and start each task mentionned in it.
If you want to run this program you will also have to provide a datasource accessible via JNDI or change the database access. (All is into the Scheduler class).
If I got some time I will change that to be more user friendly.
Thank you for your feedback anyway. -
4. Re: Dynamic scheduler....
tlaresch Jul 24, 2002 4:28 PM (in response to fredericagneray)Frederic,
I appreciate your sharing your efforts. I notice you posted the bean but not the accompanying EJB classes, so I assumed you are using XDoclet.
I decided to bite the bullet and learn how to use the XDoclet tool, but then I found I couldn't even get their samples to compile after spending a lot of time playing around with it.
If you could, would you please post the generated EJB files so I can try to use your code?
Thanks!
- Tom -
5. Re: Dynamic scheduler....
fredericagneray Jul 26, 2002 6:46 AM (in response to fredericagneray)I will have some time to make something that will fit better into JBoss. For the time being you still have to create the database and change the way it access the datasource whithin the code...
I attach the file with the test included -
6. Re: Dynamic scheduler....
schaefera Jul 26, 2002 5:14 PM (in response to fredericagneray)Hi Geeks
You were just a little bit faster than I. I just recently started to create a new Scheduler which uses a ScheduleProvider which is another MBean. This MBean can add any number of schedules to the Scheduler. The provider can also specify the target.
The EJB timer is maybe fine to time EJBs but it will for sure not work fine for MBeans and you need an EJB container to use it but JBoss is more than just an EJB container and many people use it w/o it.
Have fun - Andy -
7. Re: Dynamic scheduler....
junezhong Aug 8, 2002 1:21 AM (in response to fredericagneray)Your dynamic scheduler is great. But some error occur after I change to access the database with EJB.
Parts of message is:
Exception in Scheduler
java.lang.ClassNotFoundException: com.tech1system.spim.entity.scheduletask.Sched
uleTaskHomeInterface (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:521)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:6
37)
at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:309
)
Can it be solved? -
8. Re: Dynamic scheduler....
fredericagneray Aug 12, 2002 9:54 AM (in response to fredericagneray)Forget about this scheduler, Andreas Shaeffer prodided a new one that is dynamic as well.
I asked the jboss forum guys to remove this code but they didn't. (dunno why ?)
Look at org.jboss.varia.scheduler it is a good implementation that fit better with jboss. (much more complicate though...) -
9. Re: Dynamic scheduler....
bruyeron Aug 27, 2002 12:42 PM (in response to fredericagneray)
Andy,
any reason for the comments around line 699 of the ScheduleManager ?
mNotificationID = ( (Integer) getServer().invoke(
mTimer,
"addNotification",
new Object[] {
"Schedule",
"Scheduler Notification",
null, // User Object
lStartDate,
new Long( mPeriod ),
/* why is this commented out ?
infinite loop does not work as is */
// mRemainingRepetitions < 0 ?
// new Long( 0 ) :
new Long( mRemainingRepetitions )
},
new String[] {
String.class.getName(),
String.class.getName(),
Object.class.getName(),
Date.class.getName(),
Long.TYPE.getName(),
Long.TYPE.getName()
}
) ).intValue();
As is, the MBean throws a RuntimeMBeanException if I use the SingleScheduleProvider with -1 because the Timer.addNotification() does not like negative occurences...
- Renaud