Exemplo n.º 1
0
  /**
   * Commits this transaction with {@value #COMMIT_RETRIES} times of retries.
   *
   * <p><b>Throws</b>:<br>
   * {@link java.util.ConcurrentModificationException} - if commits failed
   *
   * @see #COMMIT_RETRIES
   */
  @Override
  public void commit() {
    int retries = COMMIT_RETRIES;

    while (true) {
      try {
        appEngineDatastoreTx.commit();

        GAERepository.TX.set(null);

        break;
      } catch (final ConcurrentModificationException e) {
        if (retries == 0) {
          throw e;
        }

        --retries;
        LOGGER.log(
            Level.WARN,
            "Retrying to commit this transaction[id={0}, app={1}]",
            new Object[] {appEngineDatastoreTx.getId(), appEngineDatastoreTx.getApp()});
      }
    }
  }
Exemplo n.º 2
0
  @Override
  public void rollback() {
    appEngineDatastoreTx.rollback();

    GAERepository.TX.set(null);
  }