X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=support%2Fgeneral%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fconcurrency%2FReadWriteLock.java;h=678801d50140f13373f3dfe88980365812c458ef;hb=ddd261f331280640c5b53c7128230b629ebcd268;hp=bfa4d311a02862162ef6fd5640313a1893daf876;hpb=92e23e5ecf9614f2ab770a8cdedc0b21ddf1e127;p=utils diff --git a/support/general/src/main/java/org/wamblee/concurrency/ReadWriteLock.java b/support/general/src/main/java/org/wamblee/concurrency/ReadWriteLock.java index bfa4d311..678801d5 100644 --- a/support/general/src/main/java/org/wamblee/concurrency/ReadWriteLock.java +++ b/support/general/src/main/java/org/wamblee/concurrency/ReadWriteLock.java @@ -1,18 +1,18 @@ /* * Copyright 2005 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. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ package org.wamblee.concurrency; import java.util.HashSet; @@ -43,8 +43,8 @@ public class ReadWriteLock { * Constructs read-write lock. */ public ReadWriteLock() { - readers = new HashSet(); - writer = null; + readers = new HashSet(); + writer = null; } /** @@ -57,14 +57,14 @@ public class ReadWriteLock { public synchronized void acquireRead() { if (readers.contains(Thread.currentThread())) { throw new IllegalStateException( - "Read lock already acquired by current thread: " - + Thread.currentThread()); + "Read lock already acquired by current thread: " + + Thread.currentThread()); } if (writer == Thread.currentThread()) { throw new IllegalStateException( - "Trying to acquire the read lock while already holding a write lock: " - + Thread.currentThread()); + "Trying to acquire the read lock while already holding a write lock: " + + Thread.currentThread()); } while (writer != null) { @@ -106,14 +106,14 @@ public class ReadWriteLock { public synchronized void acquireWrite() { if (writer == Thread.currentThread()) { throw new IllegalStateException( - "Trying to acquire a write lock while already holding the write lock: " - + Thread.currentThread()); + "Trying to acquire a write lock while already holding the write lock: " + + Thread.currentThread()); } if (readers.contains(Thread.currentThread())) { throw new IllegalStateException( - "Trying to acquire a write lock while already holding the read lock: " - + Thread.currentThread()); + "Trying to acquire a write lock while already holding the read lock: " + + Thread.currentThread()); } // wait until there are no more writers and no more