Remove AtomicBoolean

This commit is contained in:
Manfred Karrer 2017-05-30 19:52:06 +02:00
parent bddeb381a6
commit 4b88465b47

View File

@ -40,7 +40,6 @@ import javax.annotation.Nullable;
import javax.inject.Inject;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkNotNull;
@ -60,7 +59,7 @@ public final class User implements PersistedDataHost {
private ObjectProperty<PaymentAccount> currentPaymentAccountProperty;
private UserPayload userPayload = new UserPayload();
private AtomicBoolean initialReadDone = new AtomicBoolean(false);
private boolean initialReadDone = false;
@Inject
public User(Storage<UserPayload> storage, KeyRing keyRing) throws NoSuchAlgorithmException {
@ -102,13 +101,13 @@ public final class User implements PersistedDataHost {
persist();
});
initialReadDone.set(true);
initialReadDone = true;
}
private void persist() {
// TODO if we persist we get a blank screen (exception in view class contrs. or circ. dependency?)
if (initialReadDone.get())
storage.queueUpForSave(userPayload);
if (initialReadDone)
storage.queueUpForSave(userPayload);
}