Hi,

this is our Schedulable implementation:

  | package de.mobilcom.messenger.scheduler;
  | 
  | public class TimedObjectSchedulableRemote implements Schedulable {
  |     private String sRemoteHomeName;
  |     private our.company.framework.timer.TimedObjectRemote rTimedObject;
  | 
  |     // will be invoked by jboss with configured arg "ejb/MySchedulerTimer"
  |     public TimedObjectSchedulableRemote(String sRemoteHomeName) {
  |             this.sRemoteHomeName = sRemoteHomeName;
  |     }
  | 
  |     public void perform(Date rDate, long nValue) {
  |             try {
  |                     if (rTimedObject == null) {
  |                             // get MySchedulerTimer SLSB's home
  |                             Context rInitialContext = new InitialContext();
  |                             Object rHome = 
rInitialContext.lookup(sRemoteHomeName);
  | 
  |                             // call rHome.create() via refection to obtain 
remote SLSB instance
  |                             Method rMethod = 
rHome.getClass().getDeclaredMethod("create", new Class[0]);
  |                             rTimedObject = 
(our.company.framework.timer.TimedObjectRemote)
  |                                     rMethod.invoke(rHome, new Object[0]);
  |                     }
  | 
  |                     // call SLSB business method
  |                     rTimedObject.onTimeout();
  |             }
  |             catch (Exception eEx) {
  |                     ... // logging
  |                     rTimedObject = null; // reset invalid timed object 
reference
  |             }
  |     }
  | }
  | 

Every SLSB intended for invocation via Scheduler implements interface 
our.company.framework.timer.TimedObjectRemote whose only method is void 
onTimeout() throws RemoteException.

HTH,
Christoph

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4000869#4000869

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4000869
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to