@Override
    public void flush() {
        XLog.i("flush");
        Closer closer = Closer.create();
        synchronized (sync) {
            try {

                Map<String, String> m = new HashMap<>(mStorage);

                FileOutputStream fos = closer.register(mFile.startWrite());
                XmlUtils.writeMapXml(m, fos);
                mFile.finishWrite(fos);

            } catch (Throwable e) {
                XLog.w("Fail flush@IOException: " + mFile + "\n" + Log.getStackTraceString(e));
            } finally {
                IoUtils.closeQuietly(closer);
            }
        }
    }
Flush data too many times, may drain battery.
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/persist/StringMapRepo.java