use of org.apache.jena.dboe.base.block.Block in project jena by apache.
the class BlockAccessDirect method read.
@Override
public Block read(long id) {
check(id);
checkIfClosed();
ByteBuffer bb = ByteBuffer.allocate(blockSize);
readByteBuffer(id, bb);
bb.rewind();
Block block = new Block(id, bb);
return block;
}
use of org.apache.jena.dboe.base.block.Block in project jena by apache.
the class PageBlockMgr method promoteDuplicate.
/**
* Promote a page - return 'true' if the block changed (.reset()) will have been called
*/
public boolean promoteDuplicate(Page page) {
Block block = page.getBackingBlock();
block.getByteBuffer().rewind();
Block block2 = blockMgr.allocate(-1);
block2.getByteBuffer().put(block.getByteBuffer());
block2.getByteBuffer().rewind();
block2.setReadOnly(false);
if (block2 == block)
return false;
// Change - reset Block in page.
page.reset(block2);
return true;
}
use of org.apache.jena.dboe.base.block.Block in project jena by apache.
the class PageBlockMgr method getRead$.
// ---- The read and write worker operations.
protected final T getRead$(int id) {
Block block = blockMgr.getRead(id);
// Blocks from the BlockMgrCache may be write-dirty so this test
// is wrong in that situation. It is better to use the block as-is
// otherwise we'd have two blocks of a given id with different flags
// that confuse the block caching.
// if ( block.isModified() ) {
// System.err.println("getRead - isModified - "+blockMgr.getLabel()+"["+id+"]");
// // block = new Block(block.getId(), block.getByteBuffer());
// // block.setModified(false);
// // Debug.
// //blockMgr.getRead(id);
// }
T page = pageFactory.fromBlock(block);
return page;
}
use of org.apache.jena.dboe.base.block.Block in project jena by apache.
the class BlockTracker method allocate.
@Override
public Block allocate(int blockSize) {
Block block;
synchronized (this) {
checkUpdate(Alloc);
block = blockMgr.allocate(blockSize);
Long id = block.getId();
activeWriteBlocks.add(id);
add(Alloc, id);
}
return block;
}
Aggregations