Code example for Hashtable

Methods: containsKey, get, remove

0
			final Thread t = Thread.currentThread();
			//System.out.println(t.getName() + " releasing SHARED lock"); 
			mLock.lock();
			//System.out.println(t.getName() + " locked lock held by " + mLock.getHoldCount()); 
			try { 
				if (mSharedOwners.containsKey(t)) {
					Integer count = mSharedOwners.get(t) - 1;
					//System.out.println(t.getName() + " now has " + count + " SHARED locks"); 
					if (count < 0)
						throw new RuntimeException("Release a lock count already zero");
					if (count != 0) {
						mSharedOwners.put(t,count);
					} else { 
						mSharedOwners.remove(t);
						mReleased.signal();
					} 
				} else { 
					throw new RuntimeException("Release a lock when not held");
				} 
			} finally { 
				mLock.unlock();