Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Is thread the best option?

  1. #1
    Junior Member
    Join Date
    May 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Is thread the best option?

    Hello!

    I am using servlets in Web Server and I need advice on how to do something I need...

    I need to have a calendar in a servlet webpage with time and date and I need to do an action on a data and time specified by the user...

    How can I do this?? After setting the date and time what is the easiest option??

    Get the time at the moment and the future time, make the difference and run a thread till reaches 0 and then call a certain class??

    Get the future time and keep checking the current time on a thread??

    Thanks


  2. #2
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    471
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: Is thread the best option?

    Most servers should provide a scheduling facility for this kind of thing, so the first place to look would be the server API docs. But failing that, you could use a ScheduledExecutiveService such as ScheduledThreadPoolExecutor.

Similar Threads

  1. Thread and connection
    By Param in forum Threads
    Replies: 0
    Last Post: April 26th, 2010, 04:43 AM
  2. Thread Blocked
    By Rakesh_Yadav in forum Threads
    Replies: 1
    Last Post: February 19th, 2010, 11:54 AM
  3. thread sorting
    By thanos_ in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 12th, 2010, 06:23 PM
  4. DateFormat is not thread safe
    By trueacumen in forum Threads
    Replies: 5
    Last Post: August 15th, 2009, 03:16 AM
  5. How to do thread communication in java
    By Koren3 in forum Threads
    Replies: 4
    Last Post: March 29th, 2009, 11:49 AM