Example usage for java.lang IllegalMonitorStateException IllegalMonitorStateException

List of usage examples for java.lang IllegalMonitorStateException IllegalMonitorStateException

Introduction

In this page you can find the example usage for java.lang IllegalMonitorStateException IllegalMonitorStateException.

Prototype

public IllegalMonitorStateException() 

Source Link

Document

Constructs an IllegalMonitorStateException with no detail message.

Usage

From source file:org.sonews.daemon.sync.SynchronousNNTPConnection.java

/**
 * Releases the read lock in a Thread-safe way.
 *
 * @throws IllegalMonitorStateException/*  ww w.  j a  v  a2 s .  c o m*/
 *             if a Thread not holding the lock tries to release it.
 */
@Override
public void unlockReadLock() {
    synchronized (readLockGate) {
        if (readLock == Thread.currentThread().hashCode()) {
            readLock = 0;
        } else {
            throw new IllegalMonitorStateException();
        }
    }
}