• Post Reply Bookmark Topic Watch Topic
  • New Topic

scheduling

 
akash naidu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i have an application which i would like to stop once 8th at 12:00AM of every month per one hour. if the user try to access my application on 8th 12:00AM then i want to kick off the user forcefully at that time for one hour.

so can anybody help me to solve my issue. my advanced thankx to all.

regards
naidu
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't really a thread issue, I don't think. What sort of application is it -- i.e., what is the component that you want people to be kicked out of? Servlets/JSP, desktop Swing, what?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have the code to "kick the user off" and the issue is how to do it at 8:00 on the 12th, here are a couple things you might look into.

See the API docs for Timer. Timer can run a scheduled task at regular intervals. I don't recall if it has a parameter for when to run the first time that you might be able to set for the 8th of next month, so I'm not sure it will do your job.

If not, you can make a Date object and set it to the time you want the code to run, get the time in millis and subtract the current time. That gives you a really big number of milliseconds between now and then. Make a thread that waits or sleeps (see the API to know which is right for you) for that many milliseconds and then kicks off the task.

Lemme know if that helps!
 
akash naidu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

thanks for the reply. i am trying the way james suggest me.

i am doing Bank application. i want to do the scheduling in Java.

actually i am having the existing bank application. we will update the data in database on every month 8th 12AM. so if the user trying to access my applicatioin then he will not allowed to sign in at that time. so i want to run the schedule on 8th of every month at 12AM and stop my appllication temporarily for one hour.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!