Inconsistency when cloning JobDetail

3 views
Skip to first unread message

mario

unread,
Aug 25, 2008, 8:04:50 AM8/25/08
to Quartz.NET
Hi, I have earlier partially ported (quartz - back in 2004) and is
joyed to see that a real fully fledged implementation has emerged :).

I use RAMStore for "component" scheduling (driving a workflow engine
with it's own persistence etc) and had earlier (in my own port)
created a JobInstanceDetail of which could bear a transient object of
which never got cloned and therefore could pass an instance of any
kind. I've done the same when adopting to the *real* quartz but it
seems to be inconsistency in regards to joblisteners.

In add, remove only a string is accepted but in remove it is expected
to have a IJobListener instances in the hashset instead of earlier
added strings. Also cloning is kind of clumsy since all fields in
JobDetail is private instead of some to be protected to allow for
subclass access. It would also be nice to have an abstract
InternalClone(JobDetail jd) to allow for just the added
TransientObject property in JobInstanceDetail to be assigned to the
newly created JobInstanceDetail.

Best Regards,
Mario


My current clone method is as follows:
JobDetail copy;
try
{
copy = (JobInstanceDetail)MemberwiseClone();
copy.JobListenerNames = JobListenerNames;

if (JobDataMap != null)
{
copy.JobDataMap = (JobDataMap)JobDataMap.Clone();
}
}
catch (Exception)
{
throw new Exception("Not Cloneable.");
}

return copy;
Reply all
Reply to author
Forward
0 new messages