/** Reads into the block. */ public void read() throws IOException { if (_state.get().isValid()) { return; } synchronized (this) { if (_state.get().isValid()) { } else if (_state.get().isDestroyed()) { throw new IllegalStateException(toString()); } else if (_store.getBlockManager().copyDirtyBlock(this)) { // clearDirty(); // toValid(); } else { if (log.isLoggable(Level.ALL)) log.log(Level.ALL, "read db-block " + this); _isLoad = true; BlockReadWrite readWrite = _store.getReadWrite(); clearDirty(); readWrite.readBlock( _blockId & BlockStore.BLOCK_MASK, getBuffer(), 0, BlockStore.BLOCK_SIZE); toValid(); } } }
/** Write the dirty block. */ private void writeImpl(int offset, int length, boolean isPriority) throws IOException { BlockReadWrite readWrite = _store.getReadWrite(); readWrite.writeBlock( (_blockId & BlockStore.BLOCK_MASK) + offset, getBuffer(), offset, length, isPriority); }