code: public void store() {
          // TODO : Should we keep reference to Objects rather than recreating
          // everytime?
          try {
              XMLObjectWriter writer = XMLObjectWriter.newInstance(new FileOutputStream(persistFile.toString()));
  
              writer.setBinding(binding);
              writer.setIndentation(TAB_INDENT);
  
              writer.write(this.shortTimer, SHORT_TIMER_VALUE, Integer.class);
              writer.write(this.mediumTimer, MEDIUM_TIMER_VALUE, Integer.class);
              writer.write(this.longTimer, LONG_TIMER_VALUE, Integer.class);
  
              writer.close();
          } catch (Exception e) {
              System.err.println(String.format("Error while persisting the MAP Resource state in file=%s", persistFile.toString()));
              e.printStackTrace();
          }
      }
docs: Persist