• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Simple but Vague Error!!!

 
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic