michaelklishin / quartz-mongodb

A MongoDB-based store for the Quartz scheduler. This fork strives to be as feature complete as possible. Originally by MuleSoft.
Other
249 stars 203 forks source link

Use SLF4j properly #43

Closed lordbuddha closed 10 years ago

lordbuddha commented 10 years ago

Don't do this:-

BasicDBObject query = new BasicDBObject();
query.put(TRIGGER_NEXT_FIRE_TIME, new BasicDBObject("$lte", new Date(noLaterThan)));

if (log.isDebugEnabled()) {
  log.debug("Finding up to " + maxCount + " triggers which have time less than " + new Date(noLaterThan));
}

Do this:-

Date noLaterThanDate = new Date();
BasicDBObject query = new BasicDBObject();
query.put(TRIGGER_NEXT_FIRE_TIME, new BasicDBObject("$lte", noLaterThanDate));

log.debug("Finding up to {} triggers which have time less than {}", maxCount, noLaterThanDate);

i.e. you don't really need those isDebugEnabled calls if you are using the SLF4j eith {} instead of string concatenation.

... And only create the noLaterThanDate once rather than twice as it was prior.

michaelklishin commented 10 years ago

@lordbuddha feel free to submit a pull request.

michaelklishin commented 10 years ago

Should be fixed in a3917a5651aa419b8fc717b07419eb62c14ff5ba.