Stephen,

I don't know about using 0 to indicate that it's a wait forever situation.
A negative number would be better for that, wouldn't you say?  A 0 would
mean that you don't want to wait at all (of course, why would you use
BlockingBuffer if you're going to supply a 0).

James

-----Original Message-----
From: Stephen Colebourne [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 21, 2005 6:53 PM
To: Jakarta Commons Developers List
Subject: [collections] BlockingBuffer and TimeoutBuffer

Having had a look at the new class TimeoutBuffer, I realised that it 
could just be written as an extra parameter to BlockingBuffer. I think 
this would be cleaner.

BlockingBuffer.decorate(buf);  // no timeout
BlockingBuffer.decorate(buf, timeout);  // timeout

The method implementation will simply check if the stored timeout value 
is zero. If it is it does the get()/remove() as is, otherwise it uses 
get(long)/remove(long).

Note that adding a new field inn this case is OK with serialization as 
the field will default to zero if an old version of the class is 
deserialized using the new jar.

Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to