Exemplo n.º 1
0
  /**
   * Given the name of a valid checkpoint subdirectory in the checkpoints directory, create a
   * Checkpoint instance, and insert it into all Checkpointable beans.
   *
   * @param selectedCheckpoint
   */
  public synchronized void setRecoveryCheckpointByName(String selectedCheckpoint) {
    if (isRunning) {
      throw new RuntimeException("may not set recovery Checkpoint after launch");
    }
    Checkpoint recoveryCheckpoint = new Checkpoint();
    recoveryCheckpoint.getCheckpointDir().setBase(getCheckpointsDir());
    recoveryCheckpoint.getCheckpointDir().setPath(selectedCheckpoint);
    recoveryCheckpoint.getCheckpointDir().setConfigurer(appCtx.getBean(ConfigPathConfigurer.class));
    recoveryCheckpoint.afterPropertiesSet();
    setRecoveryCheckpoint(recoveryCheckpoint);
    Map<String, Checkpointable> toSetRecovery = appCtx.getBeansOfType(Checkpointable.class);

    for (Checkpointable c : toSetRecovery.values()) {
      c.setRecoveryCheckpoint(recoveryCheckpoint);
    }
  }
Exemplo n.º 2
0
 @Autowired(required = false)
 public void setRecoveryCheckpoint(Checkpoint checkpoint) {
   this.recoveryCheckpoint = checkpoint;
   checkpoint.getCheckpointDir().setBase(getCheckpointsDir());
 }