The javadoc for the java.util.concurrent.atomic package says the following:
A small toolkit of classes that support lock-free thread-safe programm
Is volatile needed when I use AtomicInteger?
Not necessarily. Considering your example:
i is a local variable, ori is a final attribute, ori variable have synchronized after that event,then it makes no difference if you declare i as volatile or not.