Source Home >> Java Source 1.6.0 >> java.lang.InterruptedException V 0.09
  • 01/*
  • 02 * @(#)InterruptedException.java 1.17 05/11/17
  • 03 *
  • 04 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
  • 05 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  • 06 */
  • 07
  • 08package java.lang;
  • 09
  • 10/**
  • 11 * Thrown when a thread is waiting, sleeping, or otherwise occupied,
  • 12 * and the thread is interrupted, either before or during the activity.
  • 13 * Occasionally a method may wish to test whether the current
  • 14 * thread has been interrupted, and if so, to immediately throw
  • 15 * this exception. The following code can be used to achieve
  • 16 * this effect:
  • 17 * <pre>
  • 18 * if (Thread.interrupted()) // Clears interrupted status!
  • 19 * throw new InterruptedException();
  • 20 * </pre>
  • 21 *
  • 22 * @author Frank Yellin
  • 23 * @version 1.17, 11/17/05
  • 24 * @see java.lang.Object#wait()
  • 25 * @see java.lang.Object#wait(long)
  • 26 * @see java.lang.Object#wait(long, int)
  • 27 * @see java.lang.Thread#sleep(long)
  • 28 * @see java.lang.Thread#interrupt()
  • 29 * @see java.lang.Thread#interrupted()
  • 30 * @since JDK1.0
  • 31 */
  • 32public
  • 33class InterruptedException extends Exception {
  • 34 /**
  • 35 * Constructs an <code>InterruptedException</code> with no detail message.
  • 36 */
  • 37 public InterruptedException() {
  • 38 super();
  • 39 }
  • 40
  • 41 /**
  • 42 * Constructs an <code>InterruptedException</code> with the
  • 43 * specified detail message.
  • 44 *
  • 45 * @param s the detail message.
  • 46 */
  • 47 public InterruptedException(String s) {
  • 48 super(s);
  • 49 }
  • 50}

文件:InterruptedException.java
包名:java.lang
类名:InterruptedException
继承:Exception
接口: