public class FileRevision extends Object implements InstanceRevision
Modifier and Type | Field and 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 and Description |
---|
FileRevision(File file,
boolean sync)
Creates a new file based revision counter.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close file revision.
|
long |
get()
Return current counter value.
|
void |
set(long value)
Set current counter value.
|
protected final RandomAccessFile raf
protected final boolean sync
protected long value
protected boolean closed
public FileRevision(File file, boolean sync) throws JournalException
file
- holding global countersync
- whether to sync the file on every writeJournalException
- if some error occurspublic long get() throws JournalException
get
in interface InstanceRevision
JournalException
- if some error occurspublic void set(long value) throws JournalException
set
in interface InstanceRevision
value
- new counter valueJournalException
- if some error occurspublic void close()
close
in interface InstanceRevision
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.