how to implement countdown trigger in server side using java? -
bidding sites quibids , ebay has countdown showing how time left auction. know can taken care on fe , should easy. want know how on server side? sending email people participate didn't win , updating database when times up. i've thought 2 approaches this.
- keep timer on client side , updates when first request hit
- open new thread , make sleep x amount of time wake updates.
both approaches don't sound right me , lead issues think. user not getting updates on time, or server have lots of sleeping beauty waiting.
what want know how on server side? sending email people participate didn't win , updating database when times up.
the best way may vary depending of technology stack of server side.
you if running servlet container (e.g.: tomcat, jboss...), want similar this: background timer task in jsp/servlet web application
if running spring application (e.g.: spring boot or spring mvc), recommend @scheduled
or other task execution , scheduling
for advanced scenarios may want go quartz
something else, should try hooking java timer task
Comments
Post a Comment