Top Description Fields Constructors Methods
net.sf.ehcache.store.disk.ods

public final Class FileAllocationTree

extends RegionSet
Class Inheritance
Imports
java.io.IOException, .RandomAccessFile, org.slf4j.Logger, .LoggerFactory

File allocation tree allows C-like alloc/free operations on a random access file.
Author
Chris Dennis

Field Summary

Modifier and TypeField and Description
private final RandomAccessFile
private long
private static final Logger

Constructor Summary

AccessConstructor and Description
public
FileAllocationTree(long maxSize, RandomAccessFile file)

Create a file allocation tree for the given file, capping it's size at maxSize.

Method Summary

Modifier and TypeMethod and Description
public synchronized Region
alloc(long size)

Allocate a new region of the given size.

private void
private void
public synchronized void
public synchronized void
free(Region r)

Mark this region as free.

public synchronized long
getFileSize()

Return the current occupied size of this file.

private void
grow(long size)

public synchronized void
mark(Region r)

Mark this region as used

private void
shrink(long size)

Inherited from net.sf.ehcache.store.disk.ods.RegionSet:
findfindremoveAndReturn

Field Detail

databack to summary
private final RandomAccessFile data
fileSizeback to summary
private long fileSize
LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

FileAllocationTreeback to summary
public FileAllocationTree(long maxSize, RandomAccessFile file)

Create a file allocation tree for the given file, capping it's size at maxSize.

Method Detail

allocback to summary
public synchronized Region alloc(long size)

Allocate a new region of the given size.

checkGrowback to summary
private void checkGrow(Region alloc)
checkShrinkback to summary
private void checkShrink(Region free)
clearback to summary
public synchronized void clear()

Overrides net.sf.ehcache.store.disk.ods.AATreeSet.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Mark this whole file as free

Annotations
@Override
freeback to summary
public synchronized void free(Region r)

Mark this region as free.

getFileSizeback to summary
public synchronized long getFileSize()

Return the current occupied size of this file.

growback to summary
private void grow(long size)
markback to summary
public synchronized void mark(Region r)

Mark this region as used

shrinkback to summary
private void shrink(long size)