@Override
public void importData(String filePath) {
transactionExecutor.executeInTransaction(() -> {
// delete data
// validate import data
// import all data
});
}
class Counter {
private int value = 0;
public synchronized int getValue() {
return value++;
}
public int getSameValue() {
synchronized(this) {
return value++;
}
}
}
synchronized?
static method declarationclass Counter {
private AtomicInteger value = new AtomicInteger(0);
public int getValue() {
return value.getAndIncrement();
}
}
Future<T>Future<T> class when used