package transaction;

import transaction.Lock.Token;

/**
 * A {@link TransactionContent} that gives write permissions on the dataVault
 * @author Balazs Pete
 *
 * @param <KEY>
 * @param <VALUE>
 */
public abstract class SudoTransactionContent<KEY, VALUE, RETURN> extends TransactionContent<KEY, VALUE, RETURN> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3125515031068969990L;

	@Override
	public void run() throws FailedTransactionException {
		Token t = dataVault.writeLock();
		try {
			script(t);
		} catch (LockException e) {
			throw new FailedTransactionException(e.getMessage());
		} finally {
			dataVault.writeUnlock(t);
		}
	}
	
	@Override
	public abstract void script(Token t) throws FailedTransactionException, LockException;

}

@@ -458,16 +458,59 @@
 ption %7B%0A
+%09%09FailedTransactionException ex = null;%0A%09%09%0A
 %09%09Token 
@@ -558,16 +558,40 @@
 ipt(t);%0A
+%09%09%09dataVault.commit(t);%0A
 %09%09%7D catc
@@ -615,21 +615,43 @@
 e) %7B%0A%09%09%09
-throw
+dataVault.abort(t);%0A%09%09%09ex =
  new Fai
@@ -738,16 +738,56 @@
 t);%0A%09%09%7D%0A
+%09%09%0A%09%09if (ex != null) %7B%0A%09%09%09throw ex;%0A%09%09%7D%0A
 %09%7D%0A%09%0A%09@O

Fix uncommitted data issue in SudoTransactionContent