mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Fabio Pistolesi
24.42.2016 7e3d34eeccce01fabf766ef7250ac1e940ec7bad
OPENDJ-3400 PDB WriteableTransaction should correctly manage Rollback exception

Rollback should be re-thrown to be able to retry the operation.
1 files modified
20 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/pdb/PDBStorage.java 20 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pdb/PDBStorage.java
@@ -632,10 +632,17 @@
        txn.begin();
        try
        {
          try
          {
          operation.run(this);
          txn.commit(commitPolicy);
          return;
        }
          catch (final StorageRuntimeException e)
          {
            throw unwrap(e);
          }
        }
        catch (final RollbackException e)
        {
          // retry after random sleep (reduces transactions collision. Drawback: increased latency)
@@ -1035,11 +1042,7 @@
    }
    catch (final StorageRuntimeException e)
    {
      if (e.getCause() != null)
      {
        throw (Exception) e.getCause();
      }
      throw e;
      throw unwrap(e);
    }
  }
@@ -1059,13 +1062,18 @@
    }
    catch (final StorageRuntimeException e)
    {
      throw unwrap(e);
    }
  }
  private Exception unwrap(StorageRuntimeException e) throws Exception
  {
      if (e.getCause() != null)
      {
        throw (Exception) e.getCause();
      }
      throw e;
    }
  }
  @Override
  public boolean supportsBackupAndRestore()