package org.apache.hadoop.tools.posum.common.records.call;

import org.apache.hadoop.tools.posum.common.records.dataentity.DatabaseReference;
import org.apache.hadoop.tools.posum.common.records.payload.Payload;
import org.apache.hadoop.tools.posum.data.core.LockBasedDataStore;

abstract class ThreePhaseDatabaseCallImpl<T extends Payload> implements ThreePhaseDatabaseCall<T> {

  @Override
  public T executeCall(LockBasedDataStore dataStore, DatabaseReference db) {
    prepare(dataStore, db);
    try {
      T ret = execute(dataStore, db);
      commit(dataStore, db);
      return ret;
    } catch (Exception e) {
      rollBack(dataStore, db);
      throw e;
    }
  }
}

@@ -53,16 +53,101 @@
 .call;%0A%0A
+import org.apache.commons.logging.Log;%0Aimport org.apache.commons.logging.LogFactory;%0A
 import o
@@ -220,16 +220,16 @@
 erence;%0A
-
 import o
@@ -456,16 +456,99 @@
 all%3CT%3E %7B
+%0A  private static Log logger = LogFactory.getLog(ThreePhaseDatabaseCallImpl.class);
 %0A%0A  @Ove
@@ -753,16 +753,16 @@
 rn ret;%0A
-
     %7D ca
@@ -777,24 +777,83 @@
 eption e) %7B%0A
+      logger.debug(%22Exception occurred. Rolling back%22, e);%0A
       rollBa

rollback reasons are logged