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 boolean
closed
Flag indicating whether this revision file is closed.protected RandomAccessFile
raf
Underlying random access file.protected boolean
sync
Flag indicating whether to sync the file on every write.protected long
value
Cached 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 void
close()
Close file revision.long
get()
Return current counter value.void
set(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 JournalException
Return current counter value.- Specified by:
get
in interfaceInstanceRevision
- Returns:
- counter value
- Throws:
JournalException
- if some error occurs
-
set
public void set(long value) throws JournalException
Set current counter value.- Specified by:
set
in 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:
close
in interfaceInstanceRevision
-
-