@Override
 public void close() {
   commitLock.writeLock().lock();
   try {
     super.close();
   } finally {
     commitLock.writeLock().unlock();
   }
 }
 @Override
 public void rollback() {
   commitLock.writeLock().lock();
   try {
     cleanTxQueue();
     super.rollback();
     uncommitedData = false;
   } finally {
     commitLock.writeLock().unlock();
   }
 }
  protected Long preallocRecidTake() {
    assert (commitLock.isWriteLockedByCurrentThread());
    Long recid = preallocRecids.poll();
    if (recid != null) return recid;

    if (uncommitedData) throw new IllegalAccessError("uncommited data");

    for (int i = 0; i < PREALLOC_RECID_SIZE; i++) {
      preallocRecids.add(super.preallocate());
    }
    recid = super.preallocate();
    super.commit();
    uncommitedData = false;
    return recid;
  }
 @Override
 public <A> void delete(long recid, Serializer<A> serializer) {
   commitLock.readLock().lock();
   try {
     uncommitedData = true;
     Lock lock = locks[Store.lockPos(recid)].writeLock();
     lock.lock();
     try {
       Object old = get(recid, serializer);
       for (Reference<Tx> txr : txs) {
         Tx tx = txr.get();
         if (tx == null) continue;
         tx.old.putIfAbsent(recid, old);
       }
       super.delete(recid, serializer);
     } finally {
       lock.unlock();
     }
   } finally {
     commitLock.readLock().unlock();
   }
 }
 @Override
 public void preallocate(long[] recids) {
   commitLock.writeLock().lock();
   try {
     uncommitedData = true;
     super.preallocate(recids);
     for (long recid : recids) {
       Lock lock = locks[Store.lockPos(recid)].writeLock();
       lock.lock();
       try {
         for (Reference<Tx> txr : txs) {
           Tx tx = txr.get();
           if (tx == null) continue;
           tx.old.putIfAbsent(recid, TOMBSTONE);
         }
       } finally {
         lock.unlock();
       }
     }
   } finally {
     commitLock.writeLock().unlock();
   }
 }
 protected <A> void superDelete(long recid, Serializer<A> serializer) {
   assert (commitLock.isWriteLockedByCurrentThread());
   super.delete(recid, serializer);
 }
 protected <A> void superUpdate(long recid, A value, Serializer<A> serializer) {
   assert (commitLock.isWriteLockedByCurrentThread());
   super.update(recid, value, serializer);
 }
 protected void superCommit() {
   assert (commitLock.isWriteLockedByCurrentThread());
   super.commit();
 }