java - Use Scheduler to execute/access task from Servlet -


what do: if user on web application (tomcat, java) performs action , 1 week passes before performs again, send him email. example, performs "like" on jan 1, 2015 performs "like" on jan 3, 2015, sent email on jan 10, 2015 (provided doesn't perform more "like's" after jan 3, 2015).

how execute: originally, wanted use simple java.util.timer object. however, couldn't find way reference different tasks timer object. every time user performed said action, need check if task exists user, if did, reschedule 1 week current time. said, couldn't reference tasks timer object.

so looked cron4j , quartz. cron4j seems simpler use that. cron4j.scheduler allows referencing tasks. understand, create 1 instance of cron4j.scheduler class entire web application , schedule additional tasks needed 1 instance of scheduler class. correct? if so, how can access instance of scheduler class servlet later? (i thought of maybe setting instance of scheduler attribute of servletcontext. but, need execute servlet once per web application. how done? if so, how specify servlet executed once?)

i welcome answers questions above or suggestions different approaches doing like.

thank you

i'd go other way around. if store likes, , date/timestamp of like, have daily job, queries users having last in more 7 days.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -