X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=support%2Fgeneral%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fconcurrency%2FReadWriteLockTest.java;h=5b0d510e1806fd03fdb80facdc672e3ea2267f28;hb=4a575582a5c2999bd816b197d9cf274b4b3ddcd7;hp=8dccb3e135106f30155c6b2ae61097c4f86a43c3;hpb=8de36ff0206c996baf3ee4adc3e2293b12ff5f39;p=utils diff --git a/support/general/src/test/java/org/wamblee/concurrency/ReadWriteLockTest.java b/support/general/src/test/java/org/wamblee/concurrency/ReadWriteLockTest.java index 8dccb3e1..5b0d510e 100644 --- a/support/general/src/test/java/org/wamblee/concurrency/ReadWriteLockTest.java +++ b/support/general/src/test/java/org/wamblee/concurrency/ReadWriteLockTest.java @@ -1,12 +1,12 @@ /* - * Copyright 2005 the original author or authors. - * + * Copyright 2005-2010 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,7 +15,6 @@ */ package org.wamblee.concurrency; -import junit.framework.Assert; import junit.framework.TestCase; /** @@ -25,11 +24,11 @@ import junit.framework.TestCase; * @see ReadWriteLock */ public class ReadWriteLockTest extends TestCase { - private static final int HALF_SECOND = 500; + private static final int HALF_SECOND = 100; - private static final int ONE_SECOND = 1000; + private static final int ONE_SECOND = 200; - private static final int TWO_SECONDS = 2000; + private static final int TWO_SECONDS = 400; private ReadWriteLock lock; private int nReaders; private int nWriters; @@ -466,7 +465,7 @@ class ReadLocker implements Runnable { try { Thread.sleep(sleepTime); } catch (InterruptedException e) { - Assert.fail("ReadLocker thread was interrupted." + + throw new RuntimeException("ReadLocker thread was interrupted." + Thread.currentThread()); } @@ -499,7 +498,7 @@ class WriteLocker implements Runnable { try { Thread.sleep(sleepTime); } catch (InterruptedException e) { - Assert.fail("WriteLocker thread was interrupted: " + + throw new RuntimeException("WriteLocker thread was interrupted: " + Thread.currentThread()); }