class BeforeCompletion {

  public synchronized void doOp(TXState txState) {
    try {
      txState.doBeforeCompletion();
    } catch (SynchronizationCommitConflictException exception) {
      this.exception = exception;
    } catch (CacheClosedException exception) {
      this.exception = new TransactionDataNodeHasDepartedException(exception);
    } catch (RuntimeException exception) {
      this.exception = new TransactionException(exception);
    } finally {
      logger.debug("beforeCompletion notification completed");
      finished = true;
      notifyAll();
    }
  }

}