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 fileIOException
public AtomicFileCounter(String path, int value) throws IOException
path
- path to the backing filevalue
- initial value of the counterIOException
public int tryDecrement() throws IOException
IOException
public int getValue() throws IOException
IOException
public void setValue(int value) throws IOException
value
- value of the counterIOException
Copyright © 2012-2013 Red Hat, Inc.. All Rights Reserved.