CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Timer Thread in servlet

    Hi,

    I'm creating a game servlet. The game is supposed to be played only within specific time-limits. Can I have a timer thread inside the servlet which continously keeps track of the time and as soon as the time limit is reached informs the player about the same?

    The problem that i have here is not so much of a time-out issue where i have to check the "last accessed time". the user is very much active ... he is playing the game and i want to stop him in between at a particular scheduled time. so i want a thread to keep running.. which compares the current time with the scheduled time and as soon as scheduled time arrives, i want to give the user a message that the game play time is over.

    If I could get some sample code of threads being spawned from servlets ... that'll be great. Any suggestions on how I could implement this are awaited eagerly.

    Thanx in advance.



  2. #2
    Guest

    Re: Timer Thread in servlet

    hi,

    I guess u r creating a web based Game. There is no problem creating a thread in the servlet. U can just go ahead by adding a thread
    data member in servlet class & Instantiating in the init and do all the tricks. but the real problem is that u can not send a interruption
    or a call back to the client becoz HTTP protocol is a request response paradim. One obscure solution would be to use RMI to make
    a callback to the client. Hope u can take the further directions from here



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured