public class AtomicFileCounter extends Object
| Constructor and Description |
|---|
AtomicFileCounter(String path)
Create an instance of counter.
|
AtomicFileCounter(String path,
int value)
Create an instance of counter and set its initial value.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getValue()
Get value of the counter.
|
void |
setValue(int value)
Set value of the counter.
|
int |
tryDecrement()
If counter is positive then decrement it.
|
public AtomicFileCounter(String path) throws IOException
path - path to the backing fileIOExceptionpublic AtomicFileCounter(String path, int value) throws IOException
path - path to the backing filevalue - initial value of the counterIOExceptionpublic int tryDecrement()
throws IOException
IOExceptionpublic int getValue()
throws IOException
IOExceptionpublic void setValue(int value)
throws IOException
value - value of the counterIOExceptionCopyright © 2012-2015 Red Hat, Inc.. All Rights Reserved.