logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: ReadWriterLock usage
Date Tue, 24 Jun 2003 12:28:38 GMT
Mark Womack wrote:
> I was looking at the usage of the ReadWriterLock class the Category code 
> as an example for my similar modification to the PluginRegistry.
> Shouldn't all the releaseWriteLock() and releaseReadLock() calls be 
> contained in finally blocks?  Unless we are absolutely sure that an 
> exception cannot be thrown in that code, it seems like a good defensive 
> coding style.  Otherwise the lock counts could get out of whack at some 
> point.


Anything that is a precious resource like database connections, locks,
threads, etc. must be cleaned up in a finally clause.  Otherwise you will
run into all sorts of problems.  You can prove that when you use a database
connection pool and exceptions prevent the releasing of the connection back
to the pool.  You will eventually run out.

That is a MUST.

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

View raw message