commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman" <ja...@carmanconsulting.com>
Subject RE: [collections] BlockingBuffer and TimeoutBuffer
Date Tue, 22 Nov 2005 15:09:37 GMT
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:scolebourne@btopenworld.com] 
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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message