Hi Angelo,
It looks like I forgot one piece of info...each descendent of HENJob
should be registered as a service in AppModule, just like your other
services:
// Jobs that are scheduled by Quartz
binder.bind( SendMailJob.class, SendMailJobImpl.class );
It is actually the Tapestry IoC framework that instantiates these
services, so Tapestry needs to know about them.
Andy
On Sat, 2008-10-11 at 23:41 -0700, Angelo Chen wrote:
> Hi Andy,
>
> Thanks for the code, the HenJob does not have a default constructor, will it
> have this error:
>
> [ERROR] ErrorLogger An error occured instantiating job to be executed. job=
> 'group1.job1'
> org.quartz.SchedulerException: Problem instantiating class
> 'org.sample.myjob'
>
> ?
>
>
> And here's the parent of the above class...all of my quartz jobs are
> descendants of this class:
>
> public abstract class HENJob implements Job {
>
> private final Logger _logger;
> private final Session _sn;
> private final PerthreadManager _perThrdMngr;
> private final HibernateSessionManager _hbrntSnMngr;
>
> private JobDataMap _jobDataMap = null;
>
> public HENJob( Logger prmLogger, Session prmSn,
> PerthreadManager prmThrdMngr, HibernateSessionManager
> prmHbrntSnMngr ) {
> _logger = prmLogger;
> _sn = prmSn;
> _userDAO = prmUserDAO;
> _systmPrmtrSrvc = prmSystmPrmtrSrvc;
> _perThrdMngr = prmThrdMngr;
> _hbrntSnMngr = prmHbrntSnMngr;
> }
>
> public void execute(JobExecutionContext arg0) throws
> JobExecutionException {
> try {
> _jobDataMap = arg0.getMergedJobDataMap();
>
> run();
>
> _hbrntSnMngr.commit();
> } finally {
> _perThrdMngr.cleanup();
> }
> }
>
> protected abstract String getSystmPrmtrPrfx();
>
> protected abstract void run();
>
> public JobDataMap getJobDataMap() {
> return _jobDataMap;
> }
>
> public Logger getLogger() {
> return _logger;
> }
>
> public Session getSn() {
> return _sn;
> }
>
> }
>
> Good luck!
>
> Andy
>
> On Sat, 2008-10-11 at 02:40 -0700, Angelo Chen wrote:
> > Hi Andy,
> >
> > Any sample code for this? Thanks.
> >
> > Angelo
> >
> >
> > Andy Huhn wrote:
> > >
> > > Thanks, Howard...ServiceResources did the trick!
> > >
> > > On Sat, 2007-12-15 at 06:53 -0800, Howard Lewis Ship wrote:
> > >> The Registry is not exposed, a service may be passed its
> > >> ServiceResources via a constructor parameter. This is an extension of
> > >> ServiceLocator, which includes all the key methods of Registry,
> > >> allowing services to be obtained by type or by service id.
> > >>
> > >> In addition, starting in 5.0.7., service proxies are serializable,
> > >> which helps when integrating with Quartz. You can store a reference
> > >> to a service in a non-transient field of your Job. I did some Quartz
> > >> integration for a project using the 5.0.5 code, and it required
> > >> jumping through some serious hoops.
> > >>
> > >> In fact, that code code was an example of why I think you are going
> > >> down the wrong path. I had a JobRunner service that tooks mapped
> > >> contribution of ScheduledJobs; the ScheduledJob was a wrapper around
> > >> some scheduling information and a Runnable object. Dependencies were
> > >> injected into the contribute method(s) and packaged up as Runnable's
> > >> that are part of the configuration. The JobRunner was @EagerLoad.
> > >>
> > >> On Dec 14, 2007 9:22 PM, Andy Huhn <[EMAIL PROTECTED]> wrote:
> > >> > All,
> > >> >
> > >> > I'd like to use Quartz with tapestry. As such, I'd like to get a
> > >> > reference to the Registry and pass it into a Tapestry service (so
> > that
> > >> I
> > >> > can use it in my Quartz jobs to instantiate all of my DAOs and
> > >> Hibernate
> > >> > Sessions).
> > >> >
> > >> > I saw some discussion here on the list a few days ago about the
> > >> > Registry...it sounds like it's not exposed to services at all. Is
> > this
> > >> > true? Does anyone have any ideas how I can get a reference to it?
> > >> >
> > >> > I have also thought about building a completely new registry inside
> > >> this
> > >> > service for all of the quartz jobs to use, but my guess is that there
> > >> > would be quite an impact on the machine's resources. Does anyone
> > have
> > >> a
> > >> > good feel for how much memory I can expect to give up if I
> > instantiate
> > >> a
> > >> > second instance of the Registry?
> > >> >
> > >> > Thanks,
> > >> > Andy
> > >> >
> > >> > ---------------------------------------------------------------------
> > >> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >> > For additional commands, e-mail: [EMAIL PROTECTED]
> > >> >
> > >> >
> > >>
> > >>
> > >>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]