• Post Reply Bookmark Topic Watch Topic
  • New Topic

Simple but Vague Error!!!  RSS feed

 
Thiru Thangavelu
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone !!!
I tried to execute the following simple jsp file which will print values from 0 to 9 after 1 sec interval. But it prints 0 to 9 in a flash after 10 sec. Any idea what went wrong here? I am using tomcat 4.0.4.

Appreciate your help !!
[ October 01, 2002: Message edited by: Thiru Thangavelu ]
[ October 01, 2002: Message edited by: Thiru Thangavelu ]
 
Pat Wallwork
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do this all the time when debugging myself, but I just write it like this:
Thread.sleep(1000);
I've never used .currentThread...have you tried it without?
-Pat
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think about it for a minute. The purpose of a JSP (or any other servlet) is to compose a (usually) HTML page on the server to send to the client.
So what is happening is that you are causing the server to needlessly take a longer time to compose the response, which it then sends to the client. (There are buffering issues that take place as well, but that's orthogonal to the primary issue).
So what exactly are you trying to do?
hth,
bear
 
Pat Wallwork
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops, your right Bear. I thought he had System.out.println instead of out.println. I use this method to read from the console what's going on in complicated loops, sometimes.
 
Thiru Thangavelu
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear.. Actually I am trying to print numbers in 1 second interval. I am trying this program to check the thread safety. Later I will open more IEs and check for the thread safety.(Whether it is printing in the order or not). Any idea how can i do this? Is it possible?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!