[jboss-svn-commits] JBL Code SVN: r27526 - in labs/jbosstm/trunk/ArjunaCore/arjuna: tests/classes/com/hp/mwtests/ts/arjuna/objectstore and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Jul 4 04:11:03 EDT 2009
Author: mark.little at jboss.com
Date: 2009-07-04 04:11:03 -0400 (Sat, 04 Jul 2009)
New Revision: 27526
Modified:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/CacheStore.java
labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/objectstore/CachedTest.java
Log:
https://jira.jboss.org/jira/browse/JBTM-580 and https://jira.jboss.org/jira/browse/JBTM-576
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/CacheStore.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/CacheStore.java 2009-07-04 08:09:34 UTC (rev 27525)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/CacheStore.java 2009-07-04 08:11:03 UTC (rev 27526)
@@ -35,7 +35,6 @@
import com.arjuna.ats.arjuna.common.*;
import com.arjuna.ats.arjuna.objectstore.ObjectStore;
import com.arjuna.ats.arjuna.objectstore.ObjectStoreType;
-import com.arjuna.ats.arjuna.common.*;
import com.arjuna.ats.arjuna.state.*;
import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
@@ -143,9 +142,12 @@
/*
* Is it in the cache?
*/
-
+
int status = CacheStore._storeManager.removeState(objUid, ft);
+ if (status == AsyncStore.REMOVED)
+ return true;
+
/*
* Check to see if there's a state on disk. If there is, then we
* still need to add a remove work item to the cache queue.
@@ -180,7 +182,7 @@
*/
int status = CacheStore._storeManager.removeWriteState(objUid, ft);
-
+
return CacheStore._storeManager.addWork(this, AsyncStore.WRITE, objUid, tName, state, ft);
}
@@ -318,6 +320,11 @@
fileType = CacheStore.NO_STATE_TYPE;
removed = true;
}
+
+ public String toString ()
+ {
+ return "< "+typeOfWork+", "+objUid+", "+tName+", "+fileType+", "+removed+" >";
+ }
public CacheStore store;
public int typeOfWork;
@@ -372,9 +379,9 @@
public static final int REMOVE = 1;
public static final int WRITE = 2;
- public static final int IN_USE = 0;
- public static final int REMOVED = 1;
- public static final int NOT_PRESENT = 2;
+ public static final int IN_USE = 3;
+ public static final int REMOVED = 4;
+ public static final int NOT_PRESENT = 5;
public AsyncStore ()
{
@@ -659,6 +666,13 @@
return element.state;
}
}
+
+ /*
+ * If not in cache then maybe we're working on it?
+ */
+
+ if ((_work != null) && (_work.objUid.equals(objUid)))
+ return _work.state;
}
return null;
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/objectstore/CachedTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/objectstore/CachedTest.java 2009-07-04 08:09:34 UTC (rev 27525)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/objectstore/CachedTest.java 2009-07-04 08:11:03 UTC (rev 27526)
@@ -65,24 +65,25 @@
InputObjectState s = store.read_committed(u, TYPE);
Thread.yield();
-
+
if (s != null) {
if (store.remove_committed(u, TYPE))
passed = true;
}
+ else
+ System.err.println("No state found while trying to read "+u);
}
}
catch (Exception ex) {
ex.printStackTrace();
}
- System.out.println(passed);
+ System.err.println("Thread for "+u+" "+((passed) ? "succeeded" : "failed"));
}
public boolean passed = false;
private ObjectStore store = null;
-
}
@@ -102,13 +103,13 @@
long stime = Calendar.getInstance().getTime().getTime();
for (int i = 0; i < threads; i++) {
- System.out.println("i: "+i);
+ System.err.println("i: "+i);
t[i] = new ThreadWriter(store);
t[i].start();
}
for (int j = 0; j < threads; j++) {
- System.out.println("j: "+j);
+ System.err.println("j: "+j);
t[j].join();
assertTrue(((ThreadWriter) t[j]).passed);
}
@@ -118,7 +119,7 @@
store.sync();
- System.out.println("time for " + threads + " users is " + timeTaken);
+ System.err.println("time for " + threads + " users is " + timeTaken);
}
}
More information about the jboss-svn-commits
mailing list