Hi Thiago, thanks for the reply, that is pretty much what I expected...

> For me :), the biggest questions is why would you want to insert a
> delay in ASOs?

I use an ASO as a token when signing users in, I use this small method to 
introduce a time delay (if there are multiple failed attempts, I increase the 
delay):
private void incrementFailedLoginCount() throws InterruptedException {
        failedLoginCount_ += 1;
        if(failedLoginCount_ == 5){
                sleepCount +=1; failedLoginCount_ = 0;
                Thread.sleep(SLEEP_INTERVAL);
                SLEEP_INTERVAL = (SLEEP_INTERVAL * 2);
        }
} 

I haven't tested it much, but it seems to work great, I was just a bit worried 
if it would be thread safe or if I was doing something stupid.

Cheers, 
Peter


----- Original Message -----
From: "Thiago H. de Paula Figueiredo" <thiag...@gmail.com>
To: "Tapestry users" <users@tapestry.apache.org>
Sent: Wednesday, 11 February, 2009 13:04:17 GMT +02:00 Athens, Beirut, 
Bucharest, Istanbul
Subject: Re: IoC question - introducing a time delay in an ASO

On Wed, Feb 11, 2009 at 8:25 AM, Peter Stavrinides
<p.stavrini...@albourne.com> wrote:
> Hi everyone,

Hi!

> What are the effects of using Thread.sleep(myInterval) in an ASO? My 
> understanding is that each user receives a separate instance of the ASO, but 
> not
> necessarily on a separate thread, right?

Each user receives a seperate instance of the ASO. AFAIK, getting or
setting an ASO does not spawn a new thread. Don't forget that every
request is one thread, so it doesn't make much sense to use a new
thread to deal with ASOs, as they're going to be used in the request
processing.
For me :), the biggest questions is why would you want to insert a
delay in ASOs?

> If this is true then what happens after Thread.sleep is active, and the next 
> user asks for his/her ASO? does a new thread spawn? or is there a lag?

A lag.

-- 
Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to