private boolean assertEnvIsLocked() {
   if (!closed.get() && locks != null) {
     for (Lock lock : locks) {
       try {
         assert lock.isLocked() : "Lock: " + lock + "is not locked";
       } catch (IOException e) {
         logger.warn("lock assertion failed", e);
         return false;
       }
     }
   }
   return true;
 }
 @Override
 public void close() {
   if (closed.compareAndSet(false, true) && locks != null) {
     for (Lock lock : locks) {
       try {
         logger.trace("releasing lock [{}]", lock);
         lock.close();
       } catch (IOException e) {
         logger.trace("failed to release lock [{}]", e, lock);
       }
     }
   }
 }