private void releaseLocks()
{
// need to unlock write before upgrade to block other threads
if (_writeLocks != null) {
for (int i = 0; i < _writeLocks.size(); i++) {
Lock lock = _writeLocks.get(i);
if (_readLocks != null)
_readLocks.remove(lock);
try {
lock.unlockReadAndWrite();
} catch (Throwable e) {
log.log(Level.WARNING, e.toString(), e);
}
}
_writeLocks.clear();
}
if (_readLocks != null) {
for (int i = 0; i < _readLocks.size(); i++) {
Lock lock = _readLocks.get(i);
try {
lock.unlockRead();
} catch (Throwable e) {
log.log(Level.WARNING, e.toString(), e);
}
}