How to check for existing Quartz.net schedulers? -
recently upgraded embedded quartz.net scheduler 2.x @ point had give on giving 0 thread schedulers unique names , have problem (very rarely) object trying create instance of zt scheduler throws exception because object has instance of zt scheduler instantiated , since zt schedulers have default 'quartzscheduler' name throws exception...
i tried checking scheduler count using myschedfactory.allschedulers.count
after calling myschedfactory = new stdschedulerfactory(properties)
stdschedulerfactory creates instance of zt scheduler it's instantiated , not when getscheduler()
method called dead end...
i not find other way of checking existing schedulers before instantiating stdschedulerfactory
and, mentioned already, instantiated, creates instance of zt scheduler ended using while loop in catch block horrible solution i'm hoping knows better way of checking existing zt schedulers...
try { //setting properties myschedfactory = new stdschedulerfactory(properties); basescheduler = schedfactory.getscheduler(); } catch (exception ex) { var exmsg = ex.innerexception == null ? ex.message : ex.message + environment.newline + ex.innerexception.message; while (exmsg.contains("scheduler name 'quartzscheduler' exists")) { try { myschedfactory = new stdschedulerfactory(properties); basescheduler = schedfactory.getscheduler(); } catch (exception vex) { exmsg = vex.innerexception == null ? vex.message : vex.message + environment.newline + vex.innerexception.message; } } }
any ideas?
how keeping reference scheduler factory singleton instead of creating new one?
Comments
Post a Comment