Author: mircea.markus
Date: 2008-12-12 03:41:33 -0500 (Fri, 12 Dec 2008)
New Revision: 7295
Modified:
core/trunk/src/test/java/org/jboss/cache/lock/IdentityLockTest.java
core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java
core/trunk/src/test/java/org/jboss/cache/lock/LockTest.java
core/trunk/src/test/java/org/jboss/cache/lock/MVCCLockManagerRecordingTest.java
core/trunk/src/test/java/org/jboss/cache/lock/MVCCLockManagerTest.java
core/trunk/src/test/java/org/jboss/cache/lock/NonBlockingWriterLockTest.java
core/trunk/src/test/java/org/jboss/cache/lock/ReadWriteLockTest.java
core/trunk/src/test/java/org/jboss/cache/lock/ReadWriteLockWithUpgradeTest.java
core/trunk/src/test/java/org/jboss/cache/lock/ReentrantWriterPreference2Readers1WriterLockTest.java
core/trunk/src/test/java/org/jboss/cache/lock/ReentrantWriterPreferenceReadWriteLockTest.java
core/trunk/src/test/java/org/jboss/cache/lock/StripedLockTest.java
core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java
Log:
removed System.out.print
Modified: core/trunk/src/test/java/org/jboss/cache/lock/IdentityLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/IdentityLockTest.java 2008-12-12
08:40:31 UTC (rev 7294)
+++ core/trunk/src/test/java/org/jboss/cache/lock/IdentityLockTest.java 2008-12-12
08:41:33 UTC (rev 7295)
@@ -216,7 +216,6 @@
final Object o1 = new Object();
final Object o2 = new Object();
- System.out.println("");
// 1. o1 acquires the lock -- succeeds
Thread t1 = new Thread()
{
@@ -317,7 +316,6 @@
final Object o1 = new Object();
final Object o2 = new Object();
- System.out.println("");
// 1. o1 acquires the lock -- succeeds
Thread t1 = new Thread()
{
@@ -418,7 +416,6 @@
log("testReadAndReleaseAll() ...");
final Object o1 = new Object();
final Object o2 = new Object();
- System.out.println("");
// 1. o1 acquires the lock -- succeeds
try
@@ -476,7 +473,6 @@
setLevelSerial();
log("testWriteAndReleaseAll() ...");
final Object o1 = new Object();
- System.out.println("");
// 1. o1 acquires the lock -- succeeds
try
@@ -527,7 +523,6 @@
void log(String msg)
{
- // System.out.println("-- [" + Thread.currentThread() + "]:
" + msg);
logger_.info("-- [" + Thread.currentThread() + "]: " + msg);
}
@@ -546,7 +541,6 @@
{
for (int i = 0; i < opCount; i++)
{
-// if (i % 10 == 0) System.out.println("readLockChanger loop# " +
i);
lockMap.addReader(new Object());
}
}
@@ -562,7 +556,6 @@
{
if (i % 10 == 0)
{
-// System.out.println("toStringProcessor loop# " + i + ",
" + (System.currentTimeMillis() - initialTime));
initialTime = System.currentTimeMillis();
}
try
@@ -580,18 +573,13 @@
}
};
toStringProcessor.start();
- System.out.println("toStringProcessor started");
readLockChanger.start();
- System.out.println("readLockChanger started");
readLockChanger.join();
flags[1] = true;//stopping the toStringProcessor
- System.out.println("readLockChanger stopped");
toStringProcessor.join();
- System.out.println("toStringProcessor stopped");
- System.out.println("flags[0]=" + flags[0]);
assertFalse(flags[0]);
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java 2008-12-12 08:40:31
UTC (rev 7294)
+++ core/trunk/src/test/java/org/jboss/cache/lock/LockReleaseTest.java 2008-12-12 08:41:33
UTC (rev 7295)
@@ -144,7 +144,6 @@
assertEquals("we ran outside of a TX, locks should have been released: ",
0, cache.getNumberOfLocksHeld());
Set<Object> keys = cache.getNode(NODE1).getKeys();
- System.out.println("keys of " + NODE1 + " are " + keys);
assertEquals("getKeys() called outside the TX should have released all
locks", 0, cache.getNumberOfLocksHeld());
tx.begin();
@@ -166,7 +165,6 @@
assertEquals("we ran outside of a TX, locks should have been released: ",
0, cache.getNumberOfLocksHeld());
Set<Object> keys = cache.getNode(NODE2).getChildrenNames();
- System.out.println("keys of " + NODE2 + " are " + keys);
assertEquals("getChildrenNames() called outside the TX should have released
all locks", 0,
cache.getNumberOfLocksHeld());
@@ -187,13 +185,10 @@
cache.put(NODE2, KEY, VAL1);
assertEquals("we ran outside of a TX, locks should have been released: ",
0, cache.getNumberOfLocksHeld());
- System.out.println(cache.getNode(NODE1));
assertEquals("print() called outside the TX should have released all
locks", 0, cache.getNumberOfLocksHeld());
tx.begin();
- System.out.println(cache.getNode(NODE1));
assertEquals("we should hold 1 read locks now (for print()): ", 2,
cache.getNumberOfLocksHeld());
- System.out.println(cache.getNode(NODE2));
assertEquals("we should hold 3 read locks now (for print()): ", 4,
cache.getNumberOfLocksHeld());
tx.commit();
assertEquals("we should have released all 3 read locks: ", 0,
cache.getNumberOfLocksHeld());
@@ -286,6 +281,5 @@
txLocksReleased.await(); //wait for tx locks to be released
assertEquals(0, cache.getNumberOfLocksHeld());
- System.out.println("LockReleaseTest.testNodeReleaseOnAcquisitionTimeout
finished!");
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/lock/LockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/LockTest.java 2008-12-12 08:40:31 UTC
(rev 7294)
+++ core/trunk/src/test/java/org/jboss/cache/lock/LockTest.java 2008-12-12 08:41:33 UTC
(rev 7295)
@@ -510,7 +510,6 @@
start = System.currentTimeMillis();
now = System.currentTimeMillis();
- System.out.println("[" + Thread.currentThread().getName() + "]
[" + (now - start) + "] " + s);
}
Modified: core/trunk/src/test/java/org/jboss/cache/lock/MVCCLockManagerRecordingTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/lock/MVCCLockManagerRecordingTest.java 2008-12-12
08:40:31 UTC (rev 7294)
+++
core/trunk/src/test/java/org/jboss/cache/lock/MVCCLockManagerRecordingTest.java 2008-12-12
08:41:33 UTC (rev 7295)
@@ -48,6 +48,5 @@
fqns.add(Fqn.fromString("/1/2/3"));
fqns.add(Fqn.fromString("/a/b/c/d"));
- for (Fqn f : fqns) System.out.println("Fqn: " + f + "; hash = "
+ lc.hashToIndex(f));
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/lock/MVCCLockManagerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/MVCCLockManagerTest.java 2008-12-12
08:40:31 UTC (rev 7294)
+++ core/trunk/src/test/java/org/jboss/cache/lock/MVCCLockManagerTest.java 2008-12-12
08:41:33 UTC (rev 7295)
@@ -99,10 +99,5 @@
fqns.add(Fqn.fromString("/A/B/C"));
fqns.add(Fqn.fromString("/A/B/C/D"));
fqns.add(Fqn.fromString("/A/B/C/E"));
-
- for (Fqn f : fqns)
- {
- System.out.println("Fqn: " + f + " bucket: " +
lm.lockContainer.hashToIndex(f));
- }
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/lock/NonBlockingWriterLockTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/lock/NonBlockingWriterLockTest.java 2008-12-12
08:40:31 UTC (rev 7294)
+++
core/trunk/src/test/java/org/jboss/cache/lock/NonBlockingWriterLockTest.java 2008-12-12
08:41:33 UTC (rev 7295)
@@ -42,25 +42,16 @@
public void setUp() throws Exception
{
logX("\n");
- log("Setting up test case ...");
}
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
- log("Tearing down test case ...");
}
- private static void log(String str)
- {
- System.out.println(Thread.currentThread() + ": "
- + java.util.Calendar.getInstance().getTime() + " : " + str);
- }
-
// For debugging purpose
private static void logX(String str)
{
- log(str);
// try {
// logToFile(str);
// } catch (IOException ioe) {
Modified: core/trunk/src/test/java/org/jboss/cache/lock/ReadWriteLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/ReadWriteLockTest.java 2008-12-12
08:40:31 UTC (rev 7294)
+++ core/trunk/src/test/java/org/jboss/cache/lock/ReadWriteLockTest.java 2008-12-12
08:41:33 UTC (rev 7295)
@@ -113,9 +113,7 @@
{
try
{
- log("acquiring WL");
lock.writeLock().lock();
- log("acquired WL successfully");
sleep(1000);
}
catch (InterruptedException e)
@@ -124,7 +122,6 @@
}
finally
{
- log("releasing WL");
lock.writeLock().unlock();
}
}
@@ -142,9 +139,7 @@
{
try
{
- log("acquiring RL");
lock.readLock().lock();
- log("acquired RL successfully");
sleep(500);
}
catch (InterruptedException e)
@@ -153,15 +148,8 @@
}
finally
{
- log("releasing RL");
lock.readLock().unlock();
}
}
}
-
- static void log(String msg)
- {
- System.out.println(Thread.currentThread().getName() + ": " + msg);
- }
-
}
Modified: core/trunk/src/test/java/org/jboss/cache/lock/ReadWriteLockWithUpgradeTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/lock/ReadWriteLockWithUpgradeTest.java 2008-12-12
08:40:31 UTC (rev 7294)
+++
core/trunk/src/test/java/org/jboss/cache/lock/ReadWriteLockWithUpgradeTest.java 2008-12-12
08:41:33 UTC (rev 7295)
@@ -43,13 +43,7 @@
}
- private static void log(String str)
- {
- System.out.println(Thread.currentThread() + ": "
- + java.util.Calendar.getInstance().getTime() + " : " + str);
- }
-
/***************************************************************/
/* Utility functions to creat threads for RL, WL and UL */
/***************************************************************/
@@ -113,13 +107,11 @@
{
if (!rlock.tryLock(msecs, TimeUnit.MILLISECONDS))
{
- log(caseNum + "-" + name + " requesting read lock
failed!\n");
String str = caseNum + "-" + name + "-RL-0";
postLockingResult(str);
return;
}
// OK, read lock obtained, sleep and release it.
- log(caseNum + "-" + name + " requesting read lock
succeeded!\n");
String str = caseNum + "-" + name + "-RL-1";
postLockingResult(str);
TestingUtil.sleepThread(sleepSecs);
@@ -138,7 +130,6 @@
}
rlock.unlock();
- log(caseNum + "-" + name + " releasing read
lock.\n");
}
catch (Exception ex)
{
@@ -167,13 +158,11 @@
Lock wlock = lock_.writeLock();
if (!wlock.tryLock(msecs, TimeUnit.MILLISECONDS))
{
- log(caseNum + "-" + name + " requesting write lock
failed!\n");
String str = caseNum + "-" + name + "-WL-0";
postLockingResult(str);
return;
}
// OK, write lock obtained, sleep and release it.
- log(caseNum + "-" + name + " requesting write lock
succeeded!\n");
String str = caseNum + "-" + name + "-WL-1";
postLockingResult(str);
TestingUtil.sleepThread(sleepSecs);
@@ -192,7 +181,6 @@
}
wlock.unlock();
- log(caseNum + "-" + name + " releasing write
lock.\n");
}
catch (Exception ex)
{
@@ -223,23 +211,19 @@
Lock wlock = null;
if (!rlock.tryLock(msecs, TimeUnit.MILLISECONDS))
{
- log(caseNum + "-" + name + " requesting read lock
failed!\n");
String str = caseNum + "-" + name + "-RL-0";
postLockingResult(str);
return;
}
// OK, read lock obtained, sleep and upgrade it later.
- log(caseNum + "-" + name + " requesting read lock succeeded
(upgrade later)!\n");
TestingUtil.sleepThread(SLEEP_MSECS / 2);
String str = caseNum + "-" + name + "-UL-";
if ((wlock = lock_.upgradeLockAttempt(msecs)) == null)
{
- log(caseNum + "-" + name + " requesting upgrade lock
failed!\n");
str += "0";
}
else
{
- log(caseNum + "-" + name + " requesting upgrade lock
succeeded!\n");
str += "1";
}
postLockingResult(str);
@@ -248,7 +232,6 @@
if (wlock != null)
{
wlock.unlock();
- log(caseNum + "-" + name + " releasing upgrade
lock.\n");
}
rlock.unlock();
}
@@ -277,18 +260,15 @@
Lock rlock = lock_.readLock();
if (!rlock.tryLock(msecs, TimeUnit.MILLISECONDS))
{
- log(caseNum + "-" + name + " requesting read lock
failed!\n");
String str = caseNum + "-" + name + "-RL-0";
postLockingResult(str);
return;
}
// OK, read lock obtained, sleep and release it.
- log(caseNum + "-" + name + " requesting read lock
succeeded!\n");
String str = caseNum + "-" + name + "-RL-1";
postLockingResult(str);
TestingUtil.sleepThread(SLEEP_MSECS);
rlock.unlock();
- log(caseNum + "-" + name + " releasing read lock.\n");
}
catch (Exception ex)
{
@@ -307,18 +287,15 @@
Lock wlock = lock_.writeLock();
if (!wlock.tryLock(msecs, TimeUnit.MILLISECONDS))
{
- log(caseNum + "-" + name + " requesting write lock
failed!\n");
String str = caseNum + "-" + name + "-WL-0";
postLockingResult(str);
return;
}
// OK, write lock obtained, sleep and release it.
- log(caseNum + "-" + name + " requesting write lock
succeeded!\n");
String str = caseNum + "-" + name + "-WL-1";
postLockingResult(str);
TestingUtil.sleepThread(SLEEP_MSECS);
wlock.unlock();
- log(caseNum + "-" + name + " releasing write lock.\n");
}
catch (Exception ex)
{
@@ -337,18 +314,15 @@
Lock ulock = null;
if ((ulock = lock_.upgradeLockAttempt(msecs)) == null)
{
- log(caseNum + "-" + name + " requesting upgrade lock
failed!\n");
String str = caseNum + "-" + name + "-UL-0";
postLockingResult(str);
return;
}
// OK, write lock obtained, sleep and release it.
- log(caseNum + "-" + name + " requesting upgrade lock
succeeded!\n");
String str = caseNum + "-" + name + "-UL-1";
postLockingResult(str);
TestingUtil.sleepThread(SLEEP_MSECS);
ulock.unlock();
- log(caseNum + "-" + name + " releasing upgrade lock.\n");
}
catch (Exception ex)
{
@@ -371,7 +345,6 @@
*/
protected synchronized void postLockingResult(Object obj)
{
- log(" Added *" + obj + "* to the result vector\n");
// Make sure we only have one in the vector
//if (!checkLockingResult((String)obj))
lockResult.addElement(obj);
@@ -393,14 +366,6 @@
break;
}
}
- if (rc)
- {
- log(" Searching for *" + expected + "* SUCCEEDED.\n");
- }
- else
- {
- log(" Searching for *" + expected + "* FAILED.\n");
- }
return rc;
}
Modified:
core/trunk/src/test/java/org/jboss/cache/lock/ReentrantWriterPreference2Readers1WriterLockTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/lock/ReentrantWriterPreference2Readers1WriterLockTest.java 2008-12-12
08:40:31 UTC (rev 7294)
+++
core/trunk/src/test/java/org/jboss/cache/lock/ReentrantWriterPreference2Readers1WriterLockTest.java 2008-12-12
08:41:33 UTC (rev 7295)
@@ -43,13 +43,6 @@
}
- private void log(String msg)
- {
- System.out.println(System.currentTimeMillis() + " " +
Thread.currentThread() +
- " [" + Thread.currentThread().getName() + "]: " + msg);
- }
-
-
public void testSimpleUpgradeFromReadLockToWriteLock()
{
int readers, writers;
@@ -148,9 +141,7 @@
{
try
{
- log("acquiring RL");
rl.lock();
- log("acquired RL");
synchronized (this)
{
this.wait();
@@ -161,9 +152,7 @@
}
finally
{
- log("releasing RL");
rl.unlock();
- log("released RL");
}
}
}
@@ -188,26 +177,20 @@
{
try
{
- log("acquiring RL");
rl.lock();
- log("acquired RL");
synchronized (this)
{
this.wait();
}
- log("attempting to acquire WL");
wl.lock();
upgradeSuccessful = true;
- log("acquired WL");
synchronized (this)
{
this.wait();
}
- log("releasing WL");
rl.unlock();
- log("released WL");
}
catch (InterruptedException e)
{
Modified:
core/trunk/src/test/java/org/jboss/cache/lock/ReentrantWriterPreferenceReadWriteLockTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/lock/ReentrantWriterPreferenceReadWriteLockTest.java 2008-12-12
08:40:31 UTC (rev 7294)
+++
core/trunk/src/test/java/org/jboss/cache/lock/ReentrantWriterPreferenceReadWriteLockTest.java 2008-12-12
08:41:33 UTC (rev 7295)
@@ -175,7 +175,6 @@
synchronized (writer)
{
- log("terminating Writer");
writer.notify();
}
TestingUtil.sleepThread(500);
@@ -199,7 +198,6 @@
synchronized (reader)
{
- log("terminating Reader");
reader.notify();
}
@@ -213,12 +211,6 @@
}
- private static void log(String msg)
- {
- System.out.println(System.currentTimeMillis() + " " +
Thread.currentThread() +
- " [" + Thread.currentThread().getName() + "]: " + msg);
- }
-
class Reader extends Thread
{
@@ -231,16 +223,12 @@
{
try
{
- log("acquiring RL");
rl.lock();
- log("acquired RL");
synchronized (this)
{
this.wait();
}
- log("releasing RL");
rl.unlock();
- log("released RL");
}
catch (InterruptedException e)
{
@@ -261,16 +249,12 @@
{
try
{
- log("acquiring WL");
wl.lock();
- log("acquired WL");
synchronized (this)
{
this.wait();
}
- log("releasing WL");
wl.unlock();
- log("released WL");
}
catch (InterruptedException e)
{
@@ -298,21 +282,15 @@
{
try
{
- log("acquiring RL");
rl.lock();
- log("acquired RL");
synchronized (this)
{
this.wait();
}
- log("attempting to lock WL");
// rl.unlock();
wl.lock();
upgradeSuccessful = true;
- log("acquired WL");
- log("releasing WL/RL");
wl.unlock();
- log("released WL/RL");
}
catch (InterruptedException e)
{
Modified: core/trunk/src/test/java/org/jboss/cache/lock/StripedLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/StripedLockTest.java 2008-12-12 08:40:31
UTC (rev 7294)
+++ core/trunk/src/test/java/org/jboss/cache/lock/StripedLockTest.java 2008-12-12 08:41:33
UTC (rev 7295)
@@ -45,11 +45,6 @@
}
}
- System.out.println(distribution);
-
- // cannot be larger than the number of locks
- System.out.println("dist size: " + distribution.size());
- System.out.println("num shared locks: " +
stripedLock.sharedLocks.length);
assertTrue(distribution.size() <= stripedLock.sharedLocks.length);
// assume at least a 2/3rd spread
assertTrue(distribution.size() * 1.5 >= stripedLock.sharedLocks.length);
@@ -65,9 +60,6 @@
Fqn fqn = Fqn.fromString("/" + ((char) (65 + r.nextInt(26))) +
"/" + ((char) (65 + r.nextInt(26))) + "/" + ((char) (65 +
r.nextInt(26))));
f.add(fqn);
}
-
- System.out.println("Fqns: " + f);
-
return f;
}
}
Modified:
core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java 2008-12-12
08:40:31 UTC (rev 7294)
+++
core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java 2008-12-12
08:41:33 UTC (rev 7295)
@@ -66,7 +66,6 @@
// TODO: 3.0.0: This is still a known failure. MVCC in 3.0.0 will fix this; enable it
in 3.0.0.
public void testLock() throws Exception
{
- System.out.println("ConcurrentPutRemoveTest.testLock count = " +
(++count));
for (int x = 0; x < 2; x++)
{
SeparateThread t = new SeparateThread(x);