org.neo4j.kernel.impl.nioneo.store
Class PersistenceWindowPool

java.lang.Object
  extended by org.neo4j.kernel.impl.nioneo.store.PersistenceWindowPool

public class PersistenceWindowPool
extends Object

Manages persistence windows for a store. Each store can configure how much memory it has for memory mapped windows. This class tries to make the most efficient use of those windows by allocating them in such a way that the most frequently used records/blocks (be it for read or write operations) are encapsulated by a memory mapped persistence window.


Constructor Summary
PersistenceWindowPool(String storeName, int blockSize, FileChannel fileChannel, long mappedMem, boolean useMemoryMappedBuffers, boolean readOnly)
          Create new pool for a store.
 
Method Summary
 PersistenceWindow acquire(long position, OperationType operationType)
          Acquires a windows for position and operationType locking the window preventing other threads from using it.
 void release(PersistenceWindow window)
          Releases a window used for an operation back to the pool and unlocks it so other threads may use it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistenceWindowPool

public PersistenceWindowPool(String storeName,
                             int blockSize,
                             FileChannel fileChannel,
                             long mappedMem,
                             boolean useMemoryMappedBuffers,
                             boolean readOnly)
Create new pool for a store.

Parameters:
storeName - Name of store that use this pool
blockSize - The size of each record/block in the store
fileChannel - A fileChannel to the store
mappedMem - Number of bytes dedicated to memory mapped windows
Throws:
IOException - If unable to create pool
Method Detail

acquire

public PersistenceWindow acquire(long position,
                                 OperationType operationType)
Acquires a windows for position and operationType locking the window preventing other threads from using it.

Parameters:
position - The position the needs to be encapsulated by the window
operationType - The type of operation (READ or WRITE)
Returns:
A locked window encapsulating the position
Throws:
IOException - If unable to acquire the window

release

public void release(PersistenceWindow window)
Releases a window used for an operation back to the pool and unlocks it so other threads may use it.

Parameters:
window - The window to be released
Throws:
IOException - If unable to release window


Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.