/**
* fully-qualified contention manager name
**/
- public static final String MANAGER = "dstm2.manager.SpecialManager";
+ public static final String MANAGER = "dstm2.manager.AggressiveManager";
+ //public static final String MANAGER = "dstm2.manager.SpecialManager";
/**
* fully-qualified factory name
**/
public class Init {
public static void init(){
- String managerClassName = Defaults.MANAGER;
+ String managerClassName = "dstm2.manager.AggressiveManager";
Class managerClass = null;
String adapterClassName = Defaults.ADAPTER;
// Initialize contention manager.
try {
- managerClass = Class.forName(Defaults.MANAGER);
+ managerClass = Class.forName(managerClassName);
+ System.out.println("manage r" + managerClass);
Thread.setContentionManagerClass(managerClass);
} catch (ClassNotFoundException ex) {
// System.out.println(Thread.currentThread() + " even more offically started the transaction");
//////////////////////////////////////
try {
+
result = xaction.call();
// System.out.println(Thread.currentThread() + " starting2");
// System.out.println(Thread.currentThread() + " aborted in committing");
// e.printStackTrace();
// throw new PanicException("Unhandled exception " + e);
// }
+
threadState.totalMemRefs += threadState.transaction.memRefs;
threadState.transaction.attempts++;
-
+
Wrapper.prepareIOCommit();
-
+
///////////////////////////////
if (threadState.commitTransaction()) {
threadState.committedMemRefs += threadState.transaction.memRefs;
- Wrapper.realseOffsets();
+ //Wrapper.realseOffsets();
Wrapper.commitIO();
flag = true;
}
catch(AbortedException ex){
threadState.depth--;
- //System.out.println(Thread.currentThread() + " aborted");
+
+ System.out.println(Thread.currentThread() + " aborted");
+ ex.printStackTrace();
// Wrapper.getTransaction().unlockAllLocks();
}
catch (Exception e) {
///
}
if (flag == true){
- // System.out.println(Thread.currentThread() + " committed");
+ System.out.println(Thread.currentThread() + " committed");
break;
}
}
import dstm2.util.Random;
import dstm2.ContentionManager;
import dstm2.Transaction;
+import java.util.Collection;
/**
* The Chuck Norris contention manager: always abort other transaction.
other.abort();
}
+ @Override
+ public void resolveConflict(Transaction me, Collection<Transaction> others) {
+ for (Transaction other: others)
+ other.abort();
+ }
+
+
public long getPriority() {
throw new UnsupportedOperationException();
}