From da7d1e9c8f3b09b569ce208f8e5bddfe2d20dba3 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Mon, 5 May 2008 00:12:49 +0000 Subject: Made TestLockStates a proper unit test. --- src/main/java/com/amazon/carbonado/repo/map/UpgradableLock.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main/java/com/amazon/carbonado') diff --git a/src/main/java/com/amazon/carbonado/repo/map/UpgradableLock.java b/src/main/java/com/amazon/carbonado/repo/map/UpgradableLock.java index 9862791..e4e8a56 100644 --- a/src/main/java/com/amazon/carbonado/repo/map/UpgradableLock.java +++ b/src/main/java/com/amazon/carbonado/repo/map/UpgradableLock.java @@ -1121,6 +1121,13 @@ class UpgradableLock { mWriteCount = writeCount; } + /** + * Used by unit tests. + */ + boolean noLocksHeld() { + return mState == 0 && mOwner == null && mUpgradeCount == 0 && mWriteCount == 0; + } + /** * Node class ripped off from AbstractQueuedSynchronizer and modified * slightly. Read the comments in that class for better understanding. -- cgit v1.2.3