From 7ca5390c71adc0781a53e78fdcf0547e7ba97f8c Mon Sep 17 00:00:00 2001 From: navid Date: Wed, 11 Feb 2009 22:02:18 +0000 Subject: [PATCH] *** empty log message *** --- Robust/Transactions/dstm2/src/dstm2/Defaults.java | 3 ++- Robust/Transactions/dstm2/src/dstm2/Init.java | 5 +++-- Robust/Transactions/dstm2/src/dstm2/Thread.java | 14 +++++++++----- .../dstm2/src/dstm2/manager/AggressiveManager.java | 8 ++++++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Robust/Transactions/dstm2/src/dstm2/Defaults.java b/Robust/Transactions/dstm2/src/dstm2/Defaults.java index 1295e017..453ba83e 100644 --- a/Robust/Transactions/dstm2/src/dstm2/Defaults.java +++ b/Robust/Transactions/dstm2/src/dstm2/Defaults.java @@ -52,7 +52,8 @@ public class Defaults { /** * 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 **/ diff --git a/Robust/Transactions/dstm2/src/dstm2/Init.java b/Robust/Transactions/dstm2/src/dstm2/Init.java index b7a87916..57f97dc2 100644 --- a/Robust/Transactions/dstm2/src/dstm2/Init.java +++ b/Robust/Transactions/dstm2/src/dstm2/Init.java @@ -12,7 +12,7 @@ package dstm2; public class Init { public static void init(){ - String managerClassName = Defaults.MANAGER; + String managerClassName = "dstm2.manager.AggressiveManager"; Class managerClass = null; String adapterClassName = Defaults.ADAPTER; @@ -22,7 +22,8 @@ public class Init { // 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) { diff --git a/Robust/Transactions/dstm2/src/dstm2/Thread.java b/Robust/Transactions/dstm2/src/dstm2/Thread.java index 63f21935..99cae520 100644 --- a/Robust/Transactions/dstm2/src/dstm2/Thread.java +++ b/Robust/Transactions/dstm2/src/dstm2/Thread.java @@ -259,6 +259,7 @@ public class Thread extends java.lang.Thread{ // 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"); @@ -274,18 +275,19 @@ public class Thread extends java.lang.Thread{ // 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; @@ -293,7 +295,9 @@ public class Thread extends java.lang.Thread{ } 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) { @@ -315,7 +319,7 @@ public class Thread extends java.lang.Thread{ /// } if (flag == true){ - // System.out.println(Thread.currentThread() + " committed"); + System.out.println(Thread.currentThread() + " committed"); break; } } diff --git a/Robust/Transactions/dstm2/src/dstm2/manager/AggressiveManager.java b/Robust/Transactions/dstm2/src/dstm2/manager/AggressiveManager.java index c199b5e3..a326c300 100644 --- a/Robust/Transactions/dstm2/src/dstm2/manager/AggressiveManager.java +++ b/Robust/Transactions/dstm2/src/dstm2/manager/AggressiveManager.java @@ -35,6 +35,7 @@ package dstm2.manager; import dstm2.util.Random; import dstm2.ContentionManager; import dstm2.Transaction; +import java.util.Collection; /** * The Chuck Norris contention manager: always abort other transaction. @@ -48,6 +49,13 @@ public class AggressiveManager extends BaseManager { other.abort(); } + @Override + public void resolveConflict(Transaction me, Collection others) { + for (Transaction other: others) + other.abort(); + } + + public long getPriority() { throw new UnsupportedOperationException(); } -- 2.34.1