commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: [pool] close(). Closeable, and AutoCloseable
Date Tue, 31 Oct 2017 09:42:50 GMT
On 31/10/2017 00:49, Gary Gregory wrote:
> Hi All:
> 
> Several [pool] interfaces implement close() but do not extend Closeable.
> Should they?

I'm tempted. close() is part of the ObjectPool interface so it isn't as
if we are adding new functionality.

My only concern is that the Javadoc for Closeable is written as if
Closeable is for I/O streams rather than the more general resource case.
Looking at the Javadoc further, URLClassLoader implements Closeable so
if it is good enough for the JRE...

+1 to having all the Pool implementations implement Closeable in 2.4.x
onwards.

> Now that we are on Java 7, AutoCloseable is also available.
> 
> Thoughts? Pros, Cons?

If we implement Closeable then we get AutoCloseable for free.

Mark


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


Mime
View raw message