You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Terry Steichen <te...@net-frame.com> on 2002/08/18 15:20:22 UTC

A 'Sleep Tool' ?

One of my templates accesses a tool which selectively retrieves web pages from the Internet (and then parses them).  At times, there are a significant number of pages to retrieve from a given site, and I want to slow down the process so I don't interfere with the site's normal operation.  (In this particular application, it is more appropriate/convenient to have the retrieval decision logic in the template rather than in the controller.)

What I'd like to do is develop something that can be called by the template like any tool in a way that introduces a delay in the process of invoking a method on another tool.  But I'm at the edge of my Java knowledge here, and wonder if anyone else has an idea of how to tackle that type of problem?

Regards,

Terry

PS: I tried creating a tool with a method that used Thread.currentThread().sleep(interval), but that didn't work.



RE: A 'Sleep Tool' ?

Posted by Peter Romianowski <me...@gmx.de>.
Hi,

Thread.sleep should work. It pauses the current Thread for the given
amount of time. I did not get your complete idea, but anyways
Thread.sleep
should be what you are looking for.

greetings,
Peter

-----Original Message-----
From: Terry Steichen [mailto:terry@net-frame.com] 
Sent: Sunday, August 18, 2002 3:20 PM
To: velocity-user@jakarta.apache.org
Subject: A 'Sleep Tool' ?


One of my templates accesses a tool which selectively retrieves web
pages from the Internet (and then parses them).  At times, there are a
significant number of pages to retrieve from a given site, and I want to
slow down the process so I don't interfere with the site's normal
operation.  (In this particular application, it is more
appropriate/convenient to have the retrieval decision logic in the
template rather than in the controller.)

What I'd like to do is develop something that can be called by the
template like any tool in a way that introduces a delay in the process
of invoking a method on another tool.  But I'm at the edge of my Java
knowledge here, and wonder if anyone else has an idea of how to tackle
that type of problem?

Regards,

Terry

PS: I tried creating a tool with a method that used
Thread.currentThread().sleep(interval), but that didn't work.




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>