jaroslav@49: /* jaroslav@49: * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. jaroslav@49: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jaroslav@49: * jaroslav@49: * This code is free software; you can redistribute it and/or modify it jaroslav@49: * under the terms of the GNU General Public License version 2 only, as jaroslav@49: * published by the Free Software Foundation. Oracle designates this jaroslav@49: * particular file as subject to the "Classpath" exception as provided jaroslav@49: * by Oracle in the LICENSE file that accompanied this code. jaroslav@49: * jaroslav@49: * This code is distributed in the hope that it will be useful, but WITHOUT jaroslav@49: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jaroslav@49: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jaroslav@49: * version 2 for more details (a copy is included in the LICENSE file that jaroslav@49: * accompanied this code). jaroslav@49: * jaroslav@49: * You should have received a copy of the GNU General Public License version jaroslav@49: * 2 along with this work; if not, write to the Free Software Foundation, jaroslav@49: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jaroslav@49: * jaroslav@49: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jaroslav@49: * or visit www.oracle.com if you need additional information or have any jaroslav@49: * questions. jaroslav@49: */ jaroslav@49: jaroslav@49: package java.lang; jaroslav@49: jaroslav@49: /** jaroslav@49: * Thrown when a thread is waiting, sleeping, or otherwise occupied, jaroslav@49: * and the thread is interrupted, either before or during the activity. jaroslav@49: * Occasionally a method may wish to test whether the current jaroslav@49: * thread has been interrupted, and if so, to immediately throw jaroslav@49: * this exception. The following code can be used to achieve jaroslav@49: * this effect: jaroslav@49: *
jaroslav@49: * if (Thread.interrupted()) // Clears interrupted status! jaroslav@49: * throw new InterruptedException(); jaroslav@49: *jaroslav@49: * jaroslav@49: * @author Frank Yellin jaroslav@49: * @see java.lang.Object#wait() jaroslav@49: * @see java.lang.Object#wait(long) jaroslav@49: * @see java.lang.Object#wait(long, int) jaroslav@49: * @see java.lang.Thread#sleep(long) jaroslav@49: * @see java.lang.Thread#interrupt() jaroslav@49: * @see java.lang.Thread#interrupted() jaroslav@49: * @since JDK1.0 jaroslav@49: */ jaroslav@49: public jaroslav@49: class InterruptedException extends Exception { jaroslav@49: private static final long serialVersionUID = 6700697376100628473L; jaroslav@49: jaroslav@49: /** jaroslav@49: * Constructs an
InterruptedException
with no detail message.
jaroslav@49: */
jaroslav@49: public InterruptedException() {
jaroslav@49: super();
jaroslav@49: }
jaroslav@49:
jaroslav@49: /**
jaroslav@49: * Constructs an InterruptedException
with the
jaroslav@49: * specified detail message.
jaroslav@49: *
jaroslav@49: * @param s the detail message.
jaroslav@49: */
jaroslav@49: public InterruptedException(String s) {
jaroslav@49: super(s);
jaroslav@49: }
jaroslav@49: }