Class FileRevision
- java.lang.Object
-
- org.apache.jackrabbit.core.journal.FileRevision
-
- All Implemented Interfaces:
InstanceRevision
public class FileRevision extends Object implements InstanceRevision
Maintains a file-based revision counter with locking, assuring uniqueness.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanclosedFlag indicating whether this revision file is closed.protected RandomAccessFilerafUnderlying random access file.protected booleansyncFlag indicating whether to sync the file on every write.protected longvalueCached value.
-
Constructor Summary
Constructors Constructor Description FileRevision(File file, boolean sync)Creates a new file based revision counter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close file revision.longget()Return current counter value.voidset(long value)Set current counter value.
-
-
-
Field Detail
-
raf
protected final RandomAccessFile raf
Underlying random access file.
-
sync
protected final boolean sync
Flag indicating whether to sync the file on every write.
-
value
protected long value
Cached value.
-
closed
protected boolean closed
Flag indicating whether this revision file is closed.
-
-
Constructor Detail
-
FileRevision
public FileRevision(File file, boolean sync) throws JournalException
Creates a new file based revision counter.- Parameters:
file- holding global countersync- whether to sync the file on every write- Throws:
JournalException- if some error occurs
-
-
Method Detail
-
get
public long get() throws JournalExceptionReturn current counter value.- Specified by:
getin interfaceInstanceRevision- Returns:
- counter value
- Throws:
JournalException- if some error occurs
-
set
public void set(long value) throws JournalExceptionSet current counter value.- Specified by:
setin interfaceInstanceRevision- Parameters:
value- new counter value- Throws:
JournalException- if some error occurs
-
close
public void close()
Close file revision. Closes underlying random access file.- Specified by:
closein interfaceInstanceRevision
-
-