@Override
  public void startIt() {
    if (semaphore.tryAcquire()) {
      try {
        executorService.execute(this::doDatabaseMigration);
      } catch (RuntimeException e) {
        semaphore.release();
        throw e;
      }
    } else {
      LOGGER.trace("{}: lock is already taken or process is already running", Thread.currentThread().getName());
    }
  }
@Test
  public void status_is_FAILED_and_failure_stores_the_exception_when_trigger_throws_an_exception() {
    mockMigrationThrowsError();

    underTest.startIt();

    assertThat(migrationState.getStatus()).isEqualTo(DatabaseMigrationState.Status.FAILED);
    assertThat(migrationState.getError()).get().isSameAs(AN_ERROR);
    assertThat(migrationState.getStartedAt()).isNotNull();
  }