@Override
    public synchronized boolean load() {
        Either<Void, T> oldData = data;
        long oldModified = modified;
        String oldKey = versionedKey;
        try {
            if (isOutOfDate() || needsData()) {
                String newVersionedKey = reader.getAsString(key)
                                               .orElse(null);
                val loaded = nonAtomicload(newVersionedKey);
                data = Either.right((T) loaded._2());
                modified = loaded._1();
                versionedKey = newVersionedKey;
            } else {
                return false;
            }
        } catch (Throwable e) {
            data = oldData;
            versionedKey = oldKey;
            modified = oldModified;
            logger.info(e.getMessage(), e);
            throw ExceptionSoftener.throwSoftenedException(e);
        }
        return true;
    }
@ Override public synchronized boolean load ( ) { Either < Void , T > oldData = data ; long oldModified = modified ; String oldKey = versionedKey ; try { if ( isOutOfDate ( ) || needsData ( ) ) { String newVersionedKey = reader . getAsString ( key ) . orElse ( null ) ; val loaded = nonAtomicload ( newVersionedKey ) ; data = Either . right ( ( T ) loaded . _2 ( ) ) ; modified = loaded . _1 ( ) ; versionedKey = newVersionedKey ; } else { return false ; } } catch ( Throwable e ) { data = oldData ; versionedKey = oldKey ; modified = oldModified ; logger . info ( e . getMessage ( ) , e ) ; throw ExceptionSoftener . throwSoftenedException ( e ) ; } return true ; }
Load data from remote store if stale