@Override
  public void setPersister(
      BrooklynMementoPersister val, PersistenceExceptionHandler exceptionHandler) {
    if (persistenceStoreAccess != null && persistenceStoreAccess != val) {
      throw new IllegalStateException(
          "Dynamically changing persister is not supported: old="
              + persistenceStoreAccess
              + "; new="
              + val);
    }
    if (persistenceRealChangeListener != null) {
      // TODO should probably throw here, but previously we have not -- so let's log for now to be
      // sure it's not happening
      LOG.warn(
          "Persister reset after listeners have been set",
          new Throwable("Source of persister reset"));
    }

    this.persistenceStoreAccess = checkNotNull(val, "persister");

    this.persistenceRealChangeListener =
        new PeriodicDeltaChangeListener(
            managementContext.getServerExecutionContext(),
            persistenceStoreAccess,
            exceptionHandler,
            persistMetrics,
            periodicPersistPeriod);
    this.persistencePublicChangeListener = new SafeChangeListener(persistenceRealChangeListener);

    if (persistenceRunning) {
      persistenceRealChangeListener.start();
    }
  }
 @Override
 public void startPersistence() {
   if (readOnlyRunning) {
     throw new IllegalStateException(
         "Cannot start read-only when already running with persistence");
   }
   LOG.debug(
       "Starting persistence (" + this + "), mgmt " + managementContext.getManagementNodeId());
   if (!persistenceRunning) {
     if (managementContext
         .getBrooklynProperties()
         .getConfig(BrooklynServerConfig.PERSISTENCE_BACKUPS_REQUIRED_ON_PROMOTION)) {
       BrooklynPersistenceUtils.createBackup(
           managementContext, CreateBackupMode.PROMOTION, MementoCopyMode.REMOTE);
     }
   }
   persistenceRunning = true;
   readOnlyRebindCount.set(Integer.MIN_VALUE);
   persistenceStoreAccess.enableWriteAccess();
   if (persistenceRealChangeListener != null) persistenceRealChangeListener.start();
 }