mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8370568: Refer to Thread.interrupted as "interrupted status" consistently
Reviewed-by: jpai, rriggs, alanb
This commit is contained in:
parent
eab5644a96
commit
28f2591bad
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -61,7 +61,7 @@ public class CompilerThreadPool {
|
||||
} catch (InterruptedException ie) {
|
||||
// (Re-)Cancel if current thread also interrupted
|
||||
pool.shutdownNow();
|
||||
// Preserve interrupt status
|
||||
// Preserve interrupted status
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -383,7 +383,7 @@ public class Object {
|
||||
try {
|
||||
wait0(timeoutMillis);
|
||||
} catch (InterruptedException e) {
|
||||
// virtual thread's interrupt status needs to be cleared
|
||||
// virtual thread's interrupted status needs to be cleared
|
||||
vthread.getAndClearInterrupt();
|
||||
throw e;
|
||||
}
|
||||
|
||||
@ -774,7 +774,7 @@ public abstract class Process {
|
||||
* @implSpec
|
||||
* This implementation executes {@link #waitFor()} in a separate thread
|
||||
* repeatedly until it returns successfully. If the execution of
|
||||
* {@code waitFor} is interrupted, the thread's interrupt status is preserved.
|
||||
* {@code waitFor} is interrupted, the thread's interrupted status is preserved.
|
||||
* <p>
|
||||
* When {@link #waitFor()} returns successfully the CompletableFuture is
|
||||
* {@linkplain java.util.concurrent.CompletableFuture#complete completed} regardless
|
||||
|
||||
@ -228,7 +228,7 @@ public class Thread implements Runnable {
|
||||
// thread name
|
||||
private volatile String name;
|
||||
|
||||
// interrupt status (read/written by VM)
|
||||
// interrupted status (read/written by VM)
|
||||
volatile boolean interrupted;
|
||||
|
||||
// context ClassLoader
|
||||
@ -355,7 +355,7 @@ public class Thread implements Runnable {
|
||||
|
||||
/* The object in which this thread is blocked in an interruptible I/O
|
||||
* operation, if any. The blocker's interrupt method should be invoked
|
||||
* after setting this thread's interrupt status.
|
||||
* after setting this thread's interrupted status.
|
||||
*/
|
||||
private Interruptible nioBlocker;
|
||||
|
||||
@ -1535,22 +1535,22 @@ public class Thread implements Runnable {
|
||||
* Object#wait(long, int) wait(long, int)} methods of the {@link Object}
|
||||
* class, or of the {@link #join()}, {@link #join(long)}, {@link
|
||||
* #join(long, int)}, {@link #sleep(long)}, or {@link #sleep(long, int)}
|
||||
* methods of this class, then its interrupt status will be cleared and it
|
||||
* methods of this class, then its interrupted status will be cleared and it
|
||||
* will receive an {@link InterruptedException}.
|
||||
*
|
||||
* <p> If this thread is blocked in an I/O operation upon an {@link
|
||||
* java.nio.channels.InterruptibleChannel InterruptibleChannel}
|
||||
* then the channel will be closed, the thread's interrupt
|
||||
* then the channel will be closed, the thread's interrupted
|
||||
* status will be set, and the thread will receive a {@link
|
||||
* java.nio.channels.ClosedByInterruptException}.
|
||||
*
|
||||
* <p> If this thread is blocked in a {@link java.nio.channels.Selector}
|
||||
* then the thread's interrupt status will be set and it will return
|
||||
* then the thread's interrupted status will be set and it will return
|
||||
* immediately from the selection operation, possibly with a non-zero
|
||||
* value, just as if the selector's {@link
|
||||
* java.nio.channels.Selector#wakeup wakeup} method were invoked.
|
||||
*
|
||||
* <p> If none of the previous conditions hold then this thread's interrupt
|
||||
* <p> If none of the previous conditions hold then this thread's interrupted
|
||||
* status will be set. </p>
|
||||
*
|
||||
* <p> Interrupting a thread that is not alive need not have any effect.
|
||||
@ -1560,7 +1560,7 @@ public class Thread implements Runnable {
|
||||
* will report it via {@link #interrupted()} and {@link #isInterrupted()}.
|
||||
*/
|
||||
public void interrupt() {
|
||||
// Setting the interrupt status must be done before reading nioBlocker.
|
||||
// Setting the interrupted status must be done before reading nioBlocker.
|
||||
interrupted = true;
|
||||
interrupt0(); // inform VM of interrupt
|
||||
|
||||
|
||||
@ -483,12 +483,12 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
Thread carrier = Thread.currentCarrierThread();
|
||||
setCarrierThread(carrier);
|
||||
|
||||
// sync up carrier thread interrupt status if needed
|
||||
// sync up carrier thread interrupted status if needed
|
||||
if (interrupted) {
|
||||
carrier.setInterrupt();
|
||||
} else if (carrier.isInterrupted()) {
|
||||
synchronized (interruptLock) {
|
||||
// need to recheck interrupt status
|
||||
// need to recheck interrupted status
|
||||
if (!interrupted) {
|
||||
carrier.clearInterrupt();
|
||||
}
|
||||
@ -721,7 +721,7 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
/**
|
||||
* Parks until unparked or interrupted. If already unparked then the parking
|
||||
* permit is consumed and this method completes immediately (meaning it doesn't
|
||||
* yield). It also completes immediately if the interrupt status is set.
|
||||
* yield). It also completes immediately if the interrupted status is set.
|
||||
*/
|
||||
@Override
|
||||
void park() {
|
||||
@ -756,7 +756,7 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
* Parks up to the given waiting time or until unparked or interrupted.
|
||||
* If already unparked then the parking permit is consumed and this method
|
||||
* completes immediately (meaning it doesn't yield). It also completes immediately
|
||||
* if the interrupt status is set or the waiting time is {@code <= 0}.
|
||||
* if the interrupted status is set or the waiting time is {@code <= 0}.
|
||||
*
|
||||
* @param nanos the maximum number of nanoseconds to wait.
|
||||
*/
|
||||
@ -799,7 +799,7 @@ final class VirtualThread extends BaseVirtualThread {
|
||||
/**
|
||||
* Parks the current carrier thread up to the given waiting time or until
|
||||
* unparked or interrupted. If the virtual thread is interrupted then the
|
||||
* interrupt status will be propagated to the carrier thread.
|
||||
* interrupted status will be propagated to the carrier thread.
|
||||
* @param timed true for a timed park, false for untimed
|
||||
* @param nanos the waiting time in nanoseconds
|
||||
*/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -611,13 +611,13 @@ public class DatagramSocket implements java.io.Closeable {
|
||||
* with a {@link DatagramChannel DatagramChannel}. In that case,
|
||||
* interrupting a thread receiving a datagram packet will close the
|
||||
* underlying channel and cause this method to throw {@link
|
||||
* java.nio.channels.ClosedByInterruptException} with the interrupt
|
||||
* status set.
|
||||
* java.nio.channels.ClosedByInterruptException} with the thread's
|
||||
* interrupted status set.
|
||||
* <li> The datagram socket uses the system-default socket implementation and
|
||||
* a {@linkplain Thread#isVirtual() virtual thread} is receiving a
|
||||
* datagram packet. In that case, interrupting the virtual thread will
|
||||
* cause it to wakeup and close the socket. This method will then throw
|
||||
* {@code SocketException} with the interrupt status set.
|
||||
* {@code SocketException} with the thread's interrupted status set.
|
||||
* </ol>
|
||||
*
|
||||
* @param p the {@code DatagramPacket} into which to place
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -406,13 +406,13 @@ public class ServerSocket implements java.io.Closeable {
|
||||
* with a {@link ServerSocketChannel ServerSocketChannel}. In that
|
||||
* case, interrupting a thread accepting a connection will close the
|
||||
* underlying channel and cause this method to throw {@link
|
||||
* java.nio.channels.ClosedByInterruptException} with the interrupt
|
||||
* status set.
|
||||
* java.nio.channels.ClosedByInterruptException} with the thread's
|
||||
* interrupted status set.
|
||||
* <li> The socket uses the system-default socket implementation and a
|
||||
* {@linkplain Thread#isVirtual() virtual thread} is accepting a
|
||||
* connection. In that case, interrupting the virtual thread will
|
||||
* cause it to wakeup and close the socket. This method will then throw
|
||||
* {@code SocketException} with the interrupt status set.
|
||||
* {@code SocketException} with the thread's interrupted status set.
|
||||
* </ol>
|
||||
*
|
||||
* @implNote
|
||||
|
||||
@ -573,12 +573,13 @@ public class Socket implements java.io.Closeable {
|
||||
* a {@link SocketChannel SocketChannel}.
|
||||
* In that case, interrupting a thread establishing a connection will
|
||||
* close the underlying channel and cause this method to throw
|
||||
* {@link ClosedByInterruptException} with the interrupt status set.
|
||||
* {@link ClosedByInterruptException} with the thread's interrupted
|
||||
* status set.
|
||||
* <li> The socket uses the system-default socket implementation and a
|
||||
* {@linkplain Thread#isVirtual() virtual thread} is establishing a
|
||||
* connection. In that case, interrupting the virtual thread will
|
||||
* cause it to wakeup and close the socket. This method will then throw
|
||||
* {@code SocketException} with the interrupt status set.
|
||||
* {@code SocketException} with the thread's interrupted status set.
|
||||
* </ol>
|
||||
*
|
||||
* @param endpoint the {@code SocketAddress}
|
||||
@ -613,12 +614,13 @@ public class Socket implements java.io.Closeable {
|
||||
* a {@link SocketChannel SocketChannel}.
|
||||
* In that case, interrupting a thread establishing a connection will
|
||||
* close the underlying channel and cause this method to throw
|
||||
* {@link ClosedByInterruptException} with the interrupt status set.
|
||||
* {@link ClosedByInterruptException} with the thread's interrupted
|
||||
* status set.
|
||||
* <li> The socket uses the system-default socket implementation and a
|
||||
* {@linkplain Thread#isVirtual() virtual thread} is establishing a
|
||||
* connection. In that case, interrupting the virtual thread will
|
||||
* cause it to wakeup and close the socket. This method will then throw
|
||||
* {@code SocketException} with the interrupt status set.
|
||||
* {@code SocketException} with the thread's interrupted status set.
|
||||
* </ol>
|
||||
*
|
||||
* @apiNote Establishing a TCP/IP connection is subject to connect timeout settings
|
||||
@ -886,13 +888,14 @@ public class Socket implements java.io.Closeable {
|
||||
* a {@link SocketChannel SocketChannel}.
|
||||
* In that case, interrupting a thread reading from the input stream
|
||||
* will close the underlying channel and cause the read method to
|
||||
* throw {@link ClosedByInterruptException} with the interrupt
|
||||
* status set.
|
||||
* throw {@link ClosedByInterruptException} with the thread's
|
||||
* interrupted status set.
|
||||
* <li> The socket uses the system-default socket implementation and a
|
||||
* {@linkplain Thread#isVirtual() virtual thread} is reading from the
|
||||
* input stream. In that case, interrupting the virtual thread will
|
||||
* cause it to wakeup and close the socket. The read method will then
|
||||
* throw {@code SocketException} with the interrupt status set.
|
||||
* throw {@code SocketException} with the thread's interrupted
|
||||
* status set.
|
||||
* </ol>
|
||||
*
|
||||
* <p>Under abnormal conditions the underlying connection may be
|
||||
@ -1026,13 +1029,14 @@ public class Socket implements java.io.Closeable {
|
||||
* a {@link SocketChannel SocketChannel}.
|
||||
* In that case, interrupting a thread writing to the output stream
|
||||
* will close the underlying channel and cause the write method to
|
||||
* throw {@link ClosedByInterruptException} with the interrupt status
|
||||
* set.
|
||||
* throw {@link ClosedByInterruptException} with the thread's
|
||||
* interrupted status set.
|
||||
* <li> The socket uses the system-default socket implementation and a
|
||||
* {@linkplain Thread#isVirtual() virtual thread} is writing to the
|
||||
* output stream. In that case, interrupting the virtual thread will
|
||||
* cause it to wakeup and close the socket. The write method will then
|
||||
* throw {@code SocketException} with the interrupt status set.
|
||||
* throw {@code SocketException} with the thread's interrupted
|
||||
* status set.
|
||||
* </ol>
|
||||
*
|
||||
* <p> Closing the returned {@link java.io.OutputStream OutputStream}
|
||||
|
||||
@ -28,7 +28,7 @@ package java.nio.channels;
|
||||
/**
|
||||
* Checked exception received by a thread when another thread interrupts it
|
||||
* while it is blocked in an I/O operation upon a channel. Before this
|
||||
* exception is thrown the channel will have been closed and the interrupt
|
||||
* exception is thrown the channel will have been closed and the interrupted
|
||||
* status of the previously-blocked thread will have been set.
|
||||
*
|
||||
* @since 1.4
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -290,7 +290,7 @@ public abstract class DatagramChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the connect operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws UnresolvedAddressException
|
||||
* If the given remote address is not fully resolved
|
||||
@ -389,7 +389,7 @@ public abstract class DatagramChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the read operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws IOException
|
||||
* If some other I/O error occurs
|
||||
@ -443,7 +443,7 @@ public abstract class DatagramChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the read operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws UnresolvedAddressException
|
||||
* If the given remote address is not fully resolved
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -662,7 +662,7 @@ public abstract class FileChannel
|
||||
* @throws ClosedByInterruptException
|
||||
* If another thread interrupts the current thread while the
|
||||
* transfer is in progress, thereby closing both channels and
|
||||
* setting the current thread's interrupt status
|
||||
* setting the current thread's interrupted status
|
||||
*
|
||||
* @throws IOException
|
||||
* If some other I/O error occurs
|
||||
@ -732,7 +732,7 @@ public abstract class FileChannel
|
||||
* @throws ClosedByInterruptException
|
||||
* If another thread interrupts the current thread while the
|
||||
* transfer is in progress, thereby closing both channels and
|
||||
* setting the current thread's interrupt status
|
||||
* setting the current thread's interrupted status
|
||||
*
|
||||
* @throws IOException
|
||||
* If some other I/O error occurs
|
||||
@ -780,7 +780,7 @@ public abstract class FileChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the read operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws IOException
|
||||
* If some other I/O error occurs
|
||||
@ -829,7 +829,7 @@ public abstract class FileChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the write operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws IOException
|
||||
* If some other I/O error occurs
|
||||
@ -1093,10 +1093,10 @@ public abstract class FileChannel
|
||||
* this method then an {@link AsynchronousCloseException} will be thrown.
|
||||
*
|
||||
* <p> If the invoking thread is interrupted while waiting to acquire the
|
||||
* lock then its interrupt status will be set and a {@link
|
||||
* lock then its interrupted status will be set and a {@link
|
||||
* FileLockInterruptionException} will be thrown. If the invoker's
|
||||
* interrupt status is set when this method is invoked then that exception
|
||||
* will be thrown immediately; the thread's interrupt status will not be
|
||||
* interrupted status is set when this method is invoked then that exception
|
||||
* will be thrown immediately; the thread's interrupted status will not be
|
||||
* changed.
|
||||
*
|
||||
* <p> The region specified by the {@code position} and {@code size}
|
||||
|
||||
@ -28,7 +28,7 @@ package java.nio.channels;
|
||||
/**
|
||||
* Checked exception received by a thread when another thread interrupts it
|
||||
* while it is waiting to acquire a file lock. Before this exception is thrown
|
||||
* the interrupt status of the previously-blocked thread will have been set.
|
||||
* the interrupted status of the previously-blocked thread will have been set.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
|
||||
@ -123,7 +123,7 @@ public interface GatheringByteChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the write operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws IOException
|
||||
* If some other I/O error occurs
|
||||
@ -161,7 +161,7 @@ public interface GatheringByteChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the write operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws IOException
|
||||
* If some other I/O error occurs
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -45,11 +45,11 @@ import java.io.IOException;
|
||||
* another thread may invoke the blocked thread's {@link Thread#interrupt()
|
||||
* interrupt} method. This will cause the channel to be closed, the blocked
|
||||
* thread to receive a {@link ClosedByInterruptException}, and the blocked
|
||||
* thread's interrupt status to be set.
|
||||
* thread's interrupted status to be set.
|
||||
*
|
||||
* <p> If a thread's interrupt status is already set and it invokes a blocking
|
||||
* <p> If a thread's interrupted status is already set and it invokes a blocking
|
||||
* I/O operation upon a channel then the channel will be closed and the thread
|
||||
* will immediately receive a {@link ClosedByInterruptException}; its interrupt
|
||||
* will immediately receive a {@link ClosedByInterruptException}; its interrupted
|
||||
* status will remain set.
|
||||
*
|
||||
* <p> A channel supports asynchronous closing and interruption if, and only
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -101,7 +101,7 @@ public interface ReadableByteChannel extends Channel {
|
||||
* If another thread interrupts the current thread
|
||||
* while the read operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws IOException
|
||||
* If some other I/O error occurs
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -119,7 +119,7 @@ public interface ScatteringByteChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the read operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws IOException
|
||||
* If some other I/O error occurs
|
||||
@ -160,7 +160,7 @@ public interface ScatteringByteChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the read operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws IOException
|
||||
* If some other I/O error occurs
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -236,7 +236,7 @@ import java.util.function.Consumer;
|
||||
*
|
||||
* <li><p> By invoking the blocked thread's {@link
|
||||
* java.lang.Thread#interrupt() interrupt} method, in which case its
|
||||
* interrupt status will be set and the selector's {@link #wakeup wakeup}
|
||||
* interrupted status will be set and the selector's {@link #wakeup wakeup}
|
||||
* method will be invoked. </p></li>
|
||||
*
|
||||
* </ul>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -328,7 +328,7 @@ public abstract class ServerSocketChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the accept operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws NotYetBoundException
|
||||
* If this channel's socket has not yet been bound
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -250,7 +250,7 @@ public abstract class SocketChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the connect operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws UnresolvedAddressException
|
||||
* If the given remote address is an InetSocketAddress that is not fully
|
||||
@ -485,7 +485,7 @@ public abstract class SocketChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the connect operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws UnresolvedAddressException
|
||||
* If the given remote address is an InetSocketAddress that is not fully resolved
|
||||
@ -542,7 +542,7 @@ public abstract class SocketChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the connect operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws IOException
|
||||
* If some other I/O error occurs
|
||||
|
||||
@ -98,7 +98,7 @@ public interface WritableByteChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the write operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws IOException
|
||||
* If some other I/O error occurs
|
||||
|
||||
@ -133,7 +133,7 @@ import java.util.List;
|
||||
* } catch (InterruptedException ex) {
|
||||
* // (Re-)Cancel if current thread also interrupted
|
||||
* pool.shutdownNow();
|
||||
* // Preserve interrupt status
|
||||
* // Preserve interrupted status
|
||||
* Thread.currentThread().interrupt();
|
||||
* }
|
||||
* }}</pre>
|
||||
@ -375,7 +375,7 @@ public interface ExecutorService extends Executor, AutoCloseable {
|
||||
* <p> If interrupted while waiting, this method stops all executing tasks as
|
||||
* if by invoking {@link #shutdownNow()}. It then continues to wait until all
|
||||
* actively executing tasks have completed. Tasks that were awaiting
|
||||
* execution are not executed. The interrupt status will be re-asserted
|
||||
* execution are not executed. The interrupted status will be re-asserted
|
||||
* before this method returns.
|
||||
*
|
||||
* <p> If already terminated, invoking this method has no effect.
|
||||
|
||||
@ -875,7 +875,7 @@ public class ForkJoinPool extends AbstractExecutorService
|
||||
* ====================
|
||||
*
|
||||
* Regular ForkJoinTasks manage task cancellation (method cancel)
|
||||
* independently from the interrupt status of threads running
|
||||
* independently from the interrupted status of threads running
|
||||
* tasks. Interrupts are issued internally only while
|
||||
* terminating, to wake up workers and cancel queued tasks. By
|
||||
* default, interrupts are cleared only when necessary to ensure
|
||||
@ -900,7 +900,7 @@ public class ForkJoinPool extends AbstractExecutorService
|
||||
* with results accessed via join() differ from those via get(),
|
||||
* which differ from those invoked using pool submit methods by
|
||||
* non-workers (which comply with Future.get() specs). Internal
|
||||
* usages of ForkJoinTasks ignore interrupt status when executing
|
||||
* usages of ForkJoinTasks ignore interrupted status when executing
|
||||
* or awaiting completion. Otherwise, reporting task results or
|
||||
* exceptions is preferred to throwing InterruptedExceptions,
|
||||
* which are in turn preferred to timeouts. Similarly, completion
|
||||
@ -4171,7 +4171,7 @@ public class ForkJoinPool extends AbstractExecutorService
|
||||
* method stops all executing tasks as if by invoking {@link
|
||||
* #shutdownNow()}. It then continues to wait until all actively
|
||||
* executing tasks have completed. Tasks that were awaiting
|
||||
* execution are not executed. The interrupt status will be
|
||||
* execution are not executed. The interrupted status will be
|
||||
* re-asserted before this method returns.
|
||||
*
|
||||
* @since 19
|
||||
|
||||
@ -69,7 +69,7 @@ public class FutureTask<V> implements RunnableFuture<V> {
|
||||
/*
|
||||
* Revision notes: This differs from previous versions of this
|
||||
* class that relied on AbstractQueuedSynchronizer, mainly to
|
||||
* avoid surprising users about retaining interrupt status during
|
||||
* avoid surprising users about retaining interrupted status during
|
||||
* cancellation races. Sync control in the current design relies
|
||||
* on a "state" field updated via CAS to track completion, along
|
||||
* with a simple Treiber stack to hold waiting threads.
|
||||
|
||||
@ -334,7 +334,7 @@ public class Semaphore implements java.io.Serializable {
|
||||
* while waiting for a permit then it will continue to wait, but the
|
||||
* time at which the thread is assigned a permit may change compared to
|
||||
* the time it would have received the permit had no interruption
|
||||
* occurred. When the thread does return from this method its interrupt
|
||||
* occurred. When the thread does return from this method its interrupted
|
||||
* status will be set.
|
||||
*/
|
||||
public void acquireUninterruptibly() {
|
||||
@ -494,7 +494,7 @@ public class Semaphore implements java.io.Serializable {
|
||||
* <p>If the current thread is {@linkplain Thread#interrupt interrupted}
|
||||
* while waiting for permits then it will continue to wait and its
|
||||
* position in the queue is not affected. When the thread does return
|
||||
* from this method its interrupt status will be set.
|
||||
* from this method its interrupted status will be set.
|
||||
*
|
||||
* @param permits the number of permits to acquire
|
||||
* @throws IllegalArgumentException if {@code permits} is negative
|
||||
|
||||
@ -652,7 +652,7 @@ public abstract class AbstractQueuedLongSynchronizer
|
||||
|
||||
/**
|
||||
* Acquires in exclusive mode, aborting if interrupted.
|
||||
* Implemented by first checking interrupt status, then invoking
|
||||
* Implemented by first checking interrupted status, then invoking
|
||||
* at least once {@link #tryAcquire}, returning on
|
||||
* success. Otherwise the thread is queued, possibly repeatedly
|
||||
* blocking and unblocking, invoking {@link #tryAcquire}
|
||||
@ -674,7 +674,7 @@ public abstract class AbstractQueuedLongSynchronizer
|
||||
/**
|
||||
* Attempts to acquire in exclusive mode, aborting if interrupted,
|
||||
* and failing if the given timeout elapses. Implemented by first
|
||||
* checking interrupt status, then invoking at least once {@link
|
||||
* checking interrupted status, then invoking at least once {@link
|
||||
* #tryAcquire}, returning on success. Otherwise, the thread is
|
||||
* queued, possibly repeatedly blocking and unblocking, invoking
|
||||
* {@link #tryAcquire} until success or the thread is interrupted
|
||||
@ -741,7 +741,7 @@ public abstract class AbstractQueuedLongSynchronizer
|
||||
|
||||
/**
|
||||
* Acquires in shared mode, aborting if interrupted. Implemented
|
||||
* by first checking interrupt status, then invoking at least once
|
||||
* by first checking interrupted status, then invoking at least once
|
||||
* {@link #tryAcquireShared}, returning on success. Otherwise the
|
||||
* thread is queued, possibly repeatedly blocking and unblocking,
|
||||
* invoking {@link #tryAcquireShared} until success or the thread
|
||||
@ -763,7 +763,7 @@ public abstract class AbstractQueuedLongSynchronizer
|
||||
/**
|
||||
* Attempts to acquire in shared mode, aborting if interrupted, and
|
||||
* failing if the given timeout elapses. Implemented by first
|
||||
* checking interrupt status, then invoking at least once {@link
|
||||
* checking interrupted status, then invoking at least once {@link
|
||||
* #tryAcquireShared}, returning on success. Otherwise, the
|
||||
* thread is queued, possibly repeatedly blocking and unblocking,
|
||||
* invoking {@link #tryAcquireShared} until success or the thread
|
||||
|
||||
@ -1032,7 +1032,7 @@ public abstract class AbstractQueuedSynchronizer
|
||||
|
||||
/**
|
||||
* Acquires in exclusive mode, aborting if interrupted.
|
||||
* Implemented by first checking interrupt status, then invoking
|
||||
* Implemented by first checking interrupted status, then invoking
|
||||
* at least once {@link #tryAcquire}, returning on
|
||||
* success. Otherwise the thread is queued, possibly repeatedly
|
||||
* blocking and unblocking, invoking {@link #tryAcquire}
|
||||
@ -1054,7 +1054,7 @@ public abstract class AbstractQueuedSynchronizer
|
||||
/**
|
||||
* Attempts to acquire in exclusive mode, aborting if interrupted,
|
||||
* and failing if the given timeout elapses. Implemented by first
|
||||
* checking interrupt status, then invoking at least once {@link
|
||||
* checking interrupted status, then invoking at least once {@link
|
||||
* #tryAcquire}, returning on success. Otherwise, the thread is
|
||||
* queued, possibly repeatedly blocking and unblocking, invoking
|
||||
* {@link #tryAcquire} until success or the thread is interrupted
|
||||
@ -1121,7 +1121,7 @@ public abstract class AbstractQueuedSynchronizer
|
||||
|
||||
/**
|
||||
* Acquires in shared mode, aborting if interrupted. Implemented
|
||||
* by first checking interrupt status, then invoking at least once
|
||||
* by first checking interrupted status, then invoking at least once
|
||||
* {@link #tryAcquireShared}, returning on success. Otherwise the
|
||||
* thread is queued, possibly repeatedly blocking and unblocking,
|
||||
* invoking {@link #tryAcquireShared} until success or the thread
|
||||
@ -1143,7 +1143,7 @@ public abstract class AbstractQueuedSynchronizer
|
||||
/**
|
||||
* Attempts to acquire in shared mode, aborting if interrupted, and
|
||||
* failing if the given timeout elapses. Implemented by first
|
||||
* checking interrupt status, then invoking at least once {@link
|
||||
* checking interrupted status, then invoking at least once {@link
|
||||
* #tryAcquireShared}, returning on success. Otherwise, the
|
||||
* thread is queued, possibly repeatedly blocking and unblocking,
|
||||
* invoking {@link #tryAcquireShared} until success or the thread
|
||||
|
||||
@ -121,7 +121,7 @@ import jdk.internal.misc.Unsafe;
|
||||
* }
|
||||
*
|
||||
* waiters.remove();
|
||||
* // ensure correct interrupt status on return
|
||||
* // ensure correct interrupted status on return
|
||||
* if (wasInterrupted)
|
||||
* Thread.currentThread().interrupt();
|
||||
* }
|
||||
@ -207,7 +207,7 @@ public final class LockSupport {
|
||||
* <p>This method does <em>not</em> report which of these caused the
|
||||
* method to return. Callers should re-check the conditions which caused
|
||||
* the thread to park in the first place. Callers may also determine,
|
||||
* for example, the interrupt status of the thread upon return.
|
||||
* for example, the interrupted status of the thread upon return.
|
||||
*
|
||||
* @param blocker the synchronization object responsible for this
|
||||
* thread parking
|
||||
@ -252,7 +252,7 @@ public final class LockSupport {
|
||||
* <p>This method does <em>not</em> report which of these caused the
|
||||
* method to return. Callers should re-check the conditions which caused
|
||||
* the thread to park in the first place. Callers may also determine,
|
||||
* for example, the interrupt status of the thread, or the elapsed time
|
||||
* for example, the interrupted status of the thread, or the elapsed time
|
||||
* upon return.
|
||||
*
|
||||
* @param blocker the synchronization object responsible for this
|
||||
@ -300,7 +300,7 @@ public final class LockSupport {
|
||||
* <p>This method does <em>not</em> report which of these caused the
|
||||
* method to return. Callers should re-check the conditions which caused
|
||||
* the thread to park in the first place. Callers may also determine,
|
||||
* for example, the interrupt status of the thread, or the current time
|
||||
* for example, the interrupted status of the thread, or the current time
|
||||
* upon return.
|
||||
*
|
||||
* @param blocker the synchronization object responsible for this
|
||||
@ -360,7 +360,7 @@ public final class LockSupport {
|
||||
* <p>This method does <em>not</em> report which of these caused the
|
||||
* method to return. Callers should re-check the conditions which caused
|
||||
* the thread to park in the first place. Callers may also determine,
|
||||
* for example, the interrupt status of the thread upon return.
|
||||
* for example, the interrupted status of the thread upon return.
|
||||
*/
|
||||
public static void park() {
|
||||
if (Thread.currentThread().isVirtual()) {
|
||||
@ -395,7 +395,7 @@ public final class LockSupport {
|
||||
* <p>This method does <em>not</em> report which of these caused the
|
||||
* method to return. Callers should re-check the conditions which caused
|
||||
* the thread to park in the first place. Callers may also determine,
|
||||
* for example, the interrupt status of the thread, or the elapsed time
|
||||
* for example, the interrupted status of the thread, or the elapsed time
|
||||
* upon return.
|
||||
*
|
||||
* @param nanos the maximum number of nanoseconds to wait
|
||||
@ -434,7 +434,7 @@ public final class LockSupport {
|
||||
* <p>This method does <em>not</em> report which of these caused the
|
||||
* method to return. Callers should re-check the conditions which caused
|
||||
* the thread to park in the first place. Callers may also determine,
|
||||
* for example, the interrupt status of the thread, or the current time
|
||||
* for example, the interrupted status of the thread, or the current time
|
||||
* upon return.
|
||||
*
|
||||
* @param deadline the absolute time, in milliseconds from the Epoch,
|
||||
|
||||
@ -379,7 +379,7 @@ public class ThreadFlock implements AutoCloseable {
|
||||
* <p> This method may only be invoked by the flock owner.
|
||||
*
|
||||
* <p> If interrupted then this method continues to wait until all threads
|
||||
* finish, before completing with the interrupt status set.
|
||||
* finish, before completing with the interrupted status set.
|
||||
*
|
||||
* <p> A ThreadFlock is intended to be used in a <em>structured manner</em>. If
|
||||
* this method is called to close a flock before nested flocks are closed then it
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -35,14 +35,14 @@ public interface Interruptible {
|
||||
* Invoked by Thread.interrupt when the given Thread is interrupted. Thread.interrupt
|
||||
* invokes this method while holding the given Thread's interrupt lock. This method
|
||||
* is also invoked by AbstractInterruptibleChannel when beginning an I/O operation
|
||||
* with the current thread's interrupt status set. This method must not block.
|
||||
* with the current thread's interrupted status set. This method must not block.
|
||||
*/
|
||||
void interrupt(Thread target);
|
||||
|
||||
/**
|
||||
* Invoked by Thread.interrupt after releasing the Thread's interrupt lock.
|
||||
* It may also be invoked by AbstractInterruptibleChannel or AbstractSelector when
|
||||
* beginning an I/O operation with the current thread's interrupt status set, or at
|
||||
* beginning an I/O operation with the current thread's interrupted status set, or at
|
||||
* the end of an I/O operation when any thread doing I/O on the channel (or selector)
|
||||
* has been interrupted. This method closes the channel (or wakes up the Selector) to
|
||||
* ensure that AsynchronousCloseException or ClosedByInterruptException is thrown.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -278,7 +278,7 @@ final class StatusResponseManager {
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException intex) {
|
||||
// Log and reset the interrupt state
|
||||
// Log and reset the interrupted state
|
||||
Thread.currentThread().interrupt();
|
||||
if (SSLLogger.isOn && SSLLogger.isOn("respmgr")) {
|
||||
SSLLogger.fine("Interrupt occurred while fetching: " +
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -717,8 +717,8 @@ public class Robot {
|
||||
* Sleeps for the specified time.
|
||||
* <p>
|
||||
* If the invoking thread is interrupted while waiting, then it will return
|
||||
* immediately with the interrupt status set. If the interrupted status is
|
||||
* already set, this method returns immediately with the interrupt status
|
||||
* immediately with the interrupted status set. If the interrupted status is
|
||||
* already set, this method returns immediately with the interrupted status
|
||||
* set.
|
||||
*
|
||||
* @apiNote It is recommended to avoid calling this method on
|
||||
@ -736,7 +736,7 @@ public class Robot {
|
||||
try {
|
||||
Thread.sleep(ms);
|
||||
} catch (final InterruptedException ignored) {
|
||||
thread.interrupt(); // Preserve interrupt status
|
||||
thread.interrupt(); // Preserve interrupted status
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -933,7 +933,7 @@ public abstract class HttpClient implements AutoCloseable {
|
||||
* <p> If interrupted while waiting, this method may attempt to stop all
|
||||
* operations by calling {@link #shutdownNow()}. It then continues to wait
|
||||
* until all actively executing operations have completed.
|
||||
* The interrupt status will be re-asserted before this method returns.
|
||||
* The interrupted status will be re-asserted before this method returns.
|
||||
*
|
||||
* <p> If already terminated, invoking this method has no effect.
|
||||
*
|
||||
|
||||
@ -1330,7 +1330,7 @@ public interface HttpResponse<T> {
|
||||
* @implNote The {@code read} method of the {@code InputStream}
|
||||
* returned by the default implementation of this method will
|
||||
* throw an {@code IOException} with the {@linkplain Thread#isInterrupted()
|
||||
* thread interrupt status set} if the thread is interrupted
|
||||
* thread interrupted status set} if the thread is interrupted
|
||||
* while blocking on read. In that case, the request will also be
|
||||
* cancelled and the {@code InputStream} will be closed.
|
||||
*
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -926,7 +926,7 @@ extends AbstractDOMParser implements LSParser, DOMConfiguration {
|
||||
parse (source);
|
||||
fBusy = false;
|
||||
if (abortNow && currentThread.isInterrupted()) {
|
||||
//reset interrupt state
|
||||
//reset interrupted state
|
||||
abortNow = false;
|
||||
Thread.interrupted();
|
||||
}
|
||||
@ -983,7 +983,7 @@ extends AbstractDOMParser implements LSParser, DOMConfiguration {
|
||||
parse (xmlInputSource);
|
||||
fBusy = false;
|
||||
if (abortNow && currentThread.isInterrupted()) {
|
||||
//reset interrupt state
|
||||
//reset interrupted state
|
||||
abortNow = false;
|
||||
Thread.interrupted();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -202,7 +202,7 @@ public abstract class SctpChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the connect operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws java.nio.channels.UnresolvedAddressException
|
||||
* If the given remote address is not fully resolved
|
||||
@ -422,7 +422,7 @@ public abstract class SctpChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the connect operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws java.nio.channels.UnresolvedAddressException
|
||||
* If the given remote address is not fully resolved
|
||||
@ -483,7 +483,7 @@ public abstract class SctpChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the connect operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws java.nio.channels.UnresolvedAddressException
|
||||
* If the given remote address is not fully resolved
|
||||
@ -552,7 +552,7 @@ public abstract class SctpChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the connect operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws IOException
|
||||
* If some other I/O error occurs
|
||||
@ -776,7 +776,7 @@ public abstract class SctpChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the read operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws java.nio.channels.NotYetConnectedException
|
||||
* If this channel is not yet connected
|
||||
@ -843,7 +843,7 @@ public abstract class SctpChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the read operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws java.nio.channels.NotYetConnectedException
|
||||
* If this channel is not yet connected
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -596,7 +596,7 @@ public abstract class SctpMultiChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the read operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws NotYetBoundException
|
||||
* If this channel is not yet bound
|
||||
@ -682,7 +682,7 @@ public abstract class SctpMultiChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the read operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws IOException
|
||||
* If some other I/O error occurs
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -132,7 +132,7 @@ public abstract class SctpServerChannel
|
||||
* If another thread interrupts the current thread
|
||||
* while the accept operation is in progress, thereby
|
||||
* closing the channel and setting the current thread's
|
||||
* interrupt status
|
||||
* interrupted status
|
||||
*
|
||||
* @throws java.nio.channels.NotYetBoundException
|
||||
* If this channel's socket has not yet been bound
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -105,7 +105,7 @@ class GetThreadStateTest {
|
||||
int expected = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE;
|
||||
check(thread, expected);
|
||||
|
||||
// re-test with interrupt status set
|
||||
// re-test with interrupted status set
|
||||
thread.interrupt();
|
||||
check(thread, expected | JVMTI_THREAD_STATE_INTERRUPTED);
|
||||
} finally {
|
||||
@ -143,7 +143,7 @@ class GetThreadStateTest {
|
||||
int expected = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER;
|
||||
await(thread, expected);
|
||||
|
||||
// re-test with interrupt status set
|
||||
// re-test with interrupted status set
|
||||
thread.interrupt();
|
||||
check(thread, expected | JVMTI_THREAD_STATE_INTERRUPTED);
|
||||
}
|
||||
@ -192,7 +192,7 @@ class GetThreadStateTest {
|
||||
expected = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER;
|
||||
check(thread, expected);
|
||||
|
||||
// re-test with interrupt status set
|
||||
// re-test with interrupted status set
|
||||
thread.interrupt();
|
||||
check(thread, expected | JVMTI_THREAD_STATE_INTERRUPTED);
|
||||
}
|
||||
@ -244,7 +244,7 @@ class GetThreadStateTest {
|
||||
expected = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER;
|
||||
check(thread, expected);
|
||||
|
||||
// re-test with interrupt status set
|
||||
// re-test with interrupted status set
|
||||
thread.interrupt();
|
||||
check(thread, expected | JVMTI_THREAD_STATE_INTERRUPTED);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -36,7 +36,7 @@
|
||||
* - sleeping on Thread.sleep()
|
||||
* then agent part of the test calls InterruptThread for these threads
|
||||
* and the debugee checks that:
|
||||
* - the running thread get interrupt status
|
||||
* - the running thread get interrupted status
|
||||
* - the waiting and sleeping threads get InterruptedException
|
||||
* COMMENTS
|
||||
*
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -383,7 +383,7 @@ public class Object {
|
||||
try {
|
||||
wait0(timeoutMillis);
|
||||
} catch (InterruptedException e) {
|
||||
// virtual thread's interrupt status needs to be cleared
|
||||
// virtual thread's interrupted status needs to be cleared
|
||||
vthread.getAndClearInterrupt();
|
||||
throw e;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -51,7 +51,7 @@
|
||||
* COMMENTS
|
||||
* Converted the test to use GetThreadState instead of GetThreadStatus.
|
||||
* Test fixed according to test bug:
|
||||
* 4935244 TEST BUG: wrong interrupt status flag tests.
|
||||
* 4935244 TEST BUG: wrong interrupted status flag tests.
|
||||
* Fixed according to test bug:
|
||||
* 6405644 TEST_BUG: no proper sync with agent thread in sp02t001/sp02t003
|
||||
*
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -52,7 +52,7 @@
|
||||
* COMMENTS
|
||||
* Converted the test to use GetThreadState instead of GetThreadStatus.
|
||||
* Test fixed according to test bug:
|
||||
* 4935244 TEST BUG: wrong interrupt status flag tests.
|
||||
* 4935244 TEST BUG: wrong interrupted status flag tests.
|
||||
* Fixed according to test bug:
|
||||
* 6405644 TEST_BUG: no proper sync with agent thread in sp02t001/sp02t003
|
||||
*
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -41,7 +41,7 @@ public class AllDiag implements Runnable {
|
||||
|
||||
public void run() {
|
||||
AllMemoryObject.dumpStatistics();
|
||||
// Ensure that interrupt status is not lost
|
||||
// Ensure that interrupted status is not lost
|
||||
if (Thread.currentThread().isInterrupted())
|
||||
return;
|
||||
try {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -41,7 +41,7 @@ public class FinDiag implements Runnable {
|
||||
|
||||
public void run() {
|
||||
FinMemoryObject.dumpStatistics();
|
||||
// Ensure that interrupt status is not lost
|
||||
// Ensure that interrupted status is not lost
|
||||
if (Thread.currentThread().isInterrupted())
|
||||
return;
|
||||
try {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -39,7 +39,7 @@ public class MemDiag implements Runnable {
|
||||
|
||||
public void run() {
|
||||
System.out.println(Runtime.getRuntime().freeMemory());
|
||||
// Ensure that interrupt status is not lost
|
||||
// Ensure that interrupted status is not lost
|
||||
if (Thread.currentThread().isInterrupted())
|
||||
return;
|
||||
try {
|
||||
|
||||
@ -190,7 +190,7 @@ public class Accept {
|
||||
|
||||
/* TEST 5: AsynchronousCloseException */
|
||||
debug("TEST 5: AsynchronousCloseException");
|
||||
/* reset thread interrupt status */
|
||||
/* reset thread interrupted status */
|
||||
Thread.currentThread().interrupted();
|
||||
|
||||
ssc = SctpServerChannel.open().bind(null);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -100,7 +100,7 @@ class JoinWithDuration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test invoking join with interrupt status set.
|
||||
* Test invoking join with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testJoinWithInterruptStatusSet() throws Exception {
|
||||
@ -141,7 +141,7 @@ class JoinWithDuration {
|
||||
thread.join(Duration.ofMinutes(1));
|
||||
fail();
|
||||
} catch (InterruptedException e) {
|
||||
// interrupt status should be cleared
|
||||
// interrupted status should be cleared
|
||||
assertFalse(thread.isInterrupted());
|
||||
} finally {
|
||||
LockSupport.unpark(thread);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -53,7 +53,7 @@ class SleepWithDuration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Thread.sleep with interrupt status set.
|
||||
* Test Thread.sleep with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testSleepWithInterruptStatusSet() throws Exception {
|
||||
@ -94,7 +94,7 @@ class SleepWithDuration {
|
||||
Thread.sleep(Duration.ofSeconds(60));
|
||||
fail();
|
||||
} catch (InterruptedException e) {
|
||||
// interrupt status should be cleared
|
||||
// interrupted status should be cleared
|
||||
assertFalse(Thread.interrupted());
|
||||
} finally {
|
||||
wakerThread.join();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -204,7 +204,7 @@ class CustomScheduler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test running task with the carrier interrupt status set.
|
||||
* Test running task with the carrier's interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testRunWithInterruptSet() throws Exception {
|
||||
|
||||
@ -419,7 +419,7 @@ class MonitorWaitNotify {
|
||||
}
|
||||
|
||||
/**
|
||||
* Testing invoking Object.wait with interrupt status set.
|
||||
* Testing invoking Object.wait with interrupted status set.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ValueSource(ints = { 0, 30000, Integer.MAX_VALUE })
|
||||
|
||||
@ -169,7 +169,7 @@ class Parking {
|
||||
}
|
||||
|
||||
/**
|
||||
* Park with interrupt status set.
|
||||
* Park with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testPark8() throws Exception {
|
||||
@ -196,7 +196,7 @@ class Parking {
|
||||
}
|
||||
|
||||
/**
|
||||
* Park while holding monitor and with interrupt status set.
|
||||
* Park while holding monitor and with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testPark10() throws Exception {
|
||||
@ -318,7 +318,7 @@ class Parking {
|
||||
}
|
||||
|
||||
/**
|
||||
* Park with parkNanos and interrupt status set.
|
||||
* Park with parkNanos and interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testParkNanos8() throws Exception {
|
||||
@ -345,7 +345,7 @@ class Parking {
|
||||
}
|
||||
|
||||
/**
|
||||
* Park with parkNanos while holding monitor and with interrupt status set.
|
||||
* Park with parkNanos while holding monitor and with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testParkNanos10() throws Exception {
|
||||
|
||||
@ -403,7 +403,7 @@ class ThreadAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test platform thread invoking Thread.join with interrupt status set.
|
||||
* Test platform thread invoking Thread.join with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testJoin15() throws Exception {
|
||||
@ -419,7 +419,7 @@ class ThreadAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test virtual thread invoking Thread.join with interrupt status set.
|
||||
* Test virtual thread invoking Thread.join with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testJoin16() throws Exception {
|
||||
@ -427,7 +427,7 @@ class ThreadAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test platform thread invoking timed-Thread.join with interrupt status set.
|
||||
* Test platform thread invoking timed-Thread.join with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testJoin17() throws Exception {
|
||||
@ -443,7 +443,7 @@ class ThreadAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test virtual thread invoking timed-Thread.join with interrupt status set.
|
||||
* Test virtual thread invoking timed-Thread.join with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testJoin18() throws Exception {
|
||||
@ -451,7 +451,7 @@ class ThreadAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test platform thread invoking timed-Thread.join with interrupt status set.
|
||||
* Test platform thread invoking timed-Thread.join with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testJoin19() throws Exception {
|
||||
@ -468,7 +468,7 @@ class ThreadAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test virtual thread invoking timed-Thread.join with interrupt status set.
|
||||
* Test virtual thread invoking timed-Thread.join with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testJoin20() throws Exception {
|
||||
@ -593,7 +593,7 @@ class ThreadAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test virtual thread with interrupt status set calling Thread.join to wait
|
||||
* Test virtual thread with interrupted status set calling Thread.join to wait
|
||||
* for platform thread to terminate.
|
||||
*/
|
||||
@Test
|
||||
@ -732,7 +732,7 @@ class ThreadAPI {
|
||||
assertFalse(me.isInterrupted());
|
||||
me.interrupt();
|
||||
assertTrue(me.isInterrupted());
|
||||
Thread.interrupted(); // clear interrupt status
|
||||
Thread.interrupted(); // clear interrupted status
|
||||
assertFalse(me.isInterrupted());
|
||||
me.interrupt();
|
||||
});
|
||||
@ -760,7 +760,7 @@ class ThreadAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test termination with interrupt status set.
|
||||
* Test termination with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testInterrupt4() throws Exception {
|
||||
@ -805,7 +805,7 @@ class ThreadAPI {
|
||||
Thread.sleep(60*1000);
|
||||
fail("sleep not interrupted");
|
||||
} catch (InterruptedException e) {
|
||||
// interrupt status should be reset
|
||||
// interrupted status should be reset
|
||||
assertFalse(Thread.interrupted());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -839,7 +839,7 @@ class ThreadAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test trying to park with interrupt status set.
|
||||
* Test trying to park with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testInterrupt8() throws Exception {
|
||||
@ -852,7 +852,7 @@ class ThreadAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test trying to wait with interrupt status set.
|
||||
* Test trying to wait with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testInterrupt9() throws Exception {
|
||||
@ -871,7 +871,7 @@ class ThreadAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test trying to block with interrupt status set.
|
||||
* Test trying to block with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testInterrupt10() throws Exception {
|
||||
@ -1237,7 +1237,7 @@ class ThreadAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Thread.sleep with interrupt status set.
|
||||
* Test Thread.sleep with interrupted status set.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@MethodSource("sleepers")
|
||||
@ -1256,7 +1256,7 @@ class ThreadAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Thread.sleep with interrupt status set and a negative duration.
|
||||
* Test Thread.sleep with interrupted status set and a negative duration.
|
||||
*/
|
||||
@Test
|
||||
void testSleep4() throws Exception {
|
||||
@ -1292,7 +1292,7 @@ class ThreadAPI {
|
||||
sleeper.run();
|
||||
fail("sleep was not interrupted");
|
||||
} catch (InterruptedException e) {
|
||||
// interrupt status should be cleared
|
||||
// interrupted status should be cleared
|
||||
assertFalse(t.isInterrupted());
|
||||
}
|
||||
});
|
||||
@ -1356,7 +1356,7 @@ class ThreadAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Thread.sleep when pinned and with interrupt status set.
|
||||
* Test Thread.sleep when pinned and with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testSleep9() throws Exception {
|
||||
@ -1389,7 +1389,7 @@ class ThreadAPI {
|
||||
});
|
||||
fail("sleep not interrupted");
|
||||
} catch (InterruptedException e) {
|
||||
// interrupt status should be cleared
|
||||
// interrupted status should be cleared
|
||||
assertFalse(t.isInterrupted());
|
||||
}
|
||||
});
|
||||
|
||||
@ -442,7 +442,7 @@ class Timeouts {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test timed accept with the thread interrupt status set.
|
||||
* Test timed accept with the thread interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
void testTimedAccept8() throws IOException {
|
||||
@ -461,7 +461,7 @@ class Timeouts {
|
||||
checkDuration(startMillis, timeout-100, timeout+20_000);
|
||||
assertTrue(Thread.currentThread().isInterrupted());
|
||||
} finally {
|
||||
Thread.interrupted(); // clear interrupt status
|
||||
Thread.interrupted(); // clear interrupted status
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -488,7 +488,7 @@ class Timeouts {
|
||||
assertTrue(Thread.currentThread().isInterrupted());
|
||||
} finally {
|
||||
interrupter.cancel(true);
|
||||
Thread.interrupted(); // clear interrupt status
|
||||
Thread.interrupted(); // clear interrupted status
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -607,7 +607,7 @@ public class CancelRequestTest implements HttpServerAdapters {
|
||||
} else if (failed instanceof IOException) {
|
||||
out.println(uriStr + ": got IOException: " + failed);
|
||||
// that could be OK if the main thread was interrupted
|
||||
// from the main thread: the interrupt status could have
|
||||
// from the main thread: the interrupted status could have
|
||||
// been caught by writing to the socket from the main
|
||||
// thread.
|
||||
if (interruptingThread.isDone() && interruptingThread.get() == main) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -130,7 +130,7 @@ public class SocketChannelStreams {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test interrupt status set before read.
|
||||
* Test interrupted status set before read.
|
||||
*/
|
||||
public void testRead7() throws Exception {
|
||||
withConnection((sc, peer) -> {
|
||||
@ -220,7 +220,7 @@ public class SocketChannelStreams {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test interrupt status set before write.
|
||||
* Test interrupted status set before write.
|
||||
*/
|
||||
public void testWrite4() throws Exception {
|
||||
withConnection((sc, peer) -> {
|
||||
|
||||
@ -61,7 +61,7 @@ public class InterruptibleOrNot {
|
||||
}
|
||||
|
||||
/**
|
||||
* Call DatagramChannel.receive with the interrupt status set, the DatagramChannel
|
||||
* Call DatagramChannel.receive with the interrupted status set, the DatagramChannel
|
||||
* is interruptible.
|
||||
*/
|
||||
@Test
|
||||
@ -72,7 +72,7 @@ public class InterruptibleOrNot {
|
||||
assertThrows(ClosedByInterruptException.class, () -> dc.receive(buf));
|
||||
assertFalse(dc.isOpen());
|
||||
} finally {
|
||||
Thread.interrupted(); // clear interrupt status
|
||||
Thread.interrupted(); // clear interrupted status
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,12 +89,12 @@ public class InterruptibleOrNot {
|
||||
assertThrows(ClosedByInterruptException.class, () -> dc.receive(buf));
|
||||
assertFalse(dc.isOpen());
|
||||
} finally {
|
||||
Thread.interrupted(); // clear interrupt status
|
||||
Thread.interrupted(); // clear interrupted status
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call DatagramChannel.receive with the interrupt status set, the DatagramChannel
|
||||
* Call DatagramChannel.receive with the interrupted status set, the DatagramChannel
|
||||
* is not interruptible.
|
||||
*/
|
||||
@Test
|
||||
@ -111,7 +111,7 @@ public class InterruptibleOrNot {
|
||||
assertThrows(AsynchronousCloseException.class, () -> dc.receive(buf));
|
||||
assertFalse(dc.isOpen());
|
||||
} finally {
|
||||
Thread.interrupted(); // clear interrupt status
|
||||
Thread.interrupted(); // clear interrupted status
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,12 +136,12 @@ public class InterruptibleOrNot {
|
||||
assertThrows(AsynchronousCloseException.class, () -> dc.receive(buf));
|
||||
assertFalse(dc.isOpen());
|
||||
} finally {
|
||||
Thread.interrupted(); // clear interrupt status
|
||||
Thread.interrupted(); // clear interrupted status
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call DatagramChannel.send with the interrupt status set, the DatagramChannel
|
||||
* Call DatagramChannel.send with the interrupted status set, the DatagramChannel
|
||||
* is interruptible.
|
||||
*/
|
||||
@Test
|
||||
@ -158,7 +158,7 @@ public class InterruptibleOrNot {
|
||||
}
|
||||
|
||||
/**
|
||||
* Call DatagramChannel.send with the interrupt status set, the DatagramChannel
|
||||
* Call DatagramChannel.send with the interrupted status set, the DatagramChannel
|
||||
* is not interruptible.
|
||||
*/
|
||||
@Test
|
||||
@ -171,7 +171,7 @@ public class InterruptibleOrNot {
|
||||
assertEquals(100, n);
|
||||
assertTrue(dc.isOpen());
|
||||
} finally {
|
||||
Thread.interrupted(); // clear interrupt status
|
||||
Thread.interrupted(); // clear interrupted status
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -232,7 +232,7 @@ class CloseDuringTransfer {
|
||||
|
||||
/**
|
||||
* Waits for the interrupt task submitted by scheduleInterrupt, and clears the
|
||||
* current thread's interrupt status.
|
||||
* current thread's interrupted status.
|
||||
*/
|
||||
private void finishInterrupt(Future<?> interrupter) throws Exception {
|
||||
boolean done = false;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -144,9 +144,9 @@ public class ClosedByInterrupt {
|
||||
} catch (ClosedByInterruptException e) {
|
||||
if (interruptible) {
|
||||
if (Thread.interrupted()) {
|
||||
expected(e + " thrown and interrupt status set");
|
||||
expected(e + " thrown and interrupted status set");
|
||||
} else {
|
||||
unexpected(e + " thrown but interrupt status not set");
|
||||
unexpected(e + " thrown but interrupted status not set");
|
||||
}
|
||||
} else {
|
||||
unexpected(e);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -55,7 +55,7 @@ public class PipeInterrupt {
|
||||
close();
|
||||
if (interrupted) {
|
||||
if (!this.isInterrupted())
|
||||
exc = new RuntimeException("interrupt status reset");
|
||||
exc = new RuntimeException("interrupted status reset");
|
||||
break;
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -64,7 +64,7 @@ public class LotsOfInterrupts {
|
||||
phaser.arriveAndAwaitAdvance();
|
||||
sel.select();
|
||||
|
||||
// clear interrupt status and consume wakeup
|
||||
// clear interrupted status and consume wakeup
|
||||
Thread.interrupted();
|
||||
sel.selectNow();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -360,7 +360,7 @@ public class SelectWithConsumer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test invoking select with interrupt status set
|
||||
* Test invoking select with interrupted status set
|
||||
*/
|
||||
public void testInterruptBeforeSelect() throws Exception {
|
||||
// select(Consumer)
|
||||
@ -371,7 +371,7 @@ public class SelectWithConsumer {
|
||||
assertTrue(Thread.currentThread().isInterrupted());
|
||||
assertTrue(sel.isOpen());
|
||||
} finally {
|
||||
Thread.currentThread().interrupted(); // clear interrupt status
|
||||
Thread.currentThread().interrupted(); // clear interrupted status
|
||||
}
|
||||
|
||||
// select(Consumer, timeout)
|
||||
@ -384,7 +384,7 @@ public class SelectWithConsumer {
|
||||
assertTrue(Thread.currentThread().isInterrupted());
|
||||
assertTrue(sel.isOpen());
|
||||
} finally {
|
||||
Thread.currentThread().interrupted(); // clear interrupt status
|
||||
Thread.currentThread().interrupted(); // clear interrupted status
|
||||
}
|
||||
}
|
||||
|
||||
@ -400,7 +400,7 @@ public class SelectWithConsumer {
|
||||
assertTrue(Thread.currentThread().isInterrupted());
|
||||
assertTrue(sel.isOpen());
|
||||
} finally {
|
||||
Thread.currentThread().interrupted(); // clear interrupt status
|
||||
Thread.currentThread().interrupted(); // clear interrupted status
|
||||
}
|
||||
|
||||
// select(Consumer, timeout)
|
||||
@ -411,7 +411,7 @@ public class SelectWithConsumer {
|
||||
assertTrue(Thread.currentThread().isInterrupted());
|
||||
assertTrue(sel.isOpen());
|
||||
} finally {
|
||||
Thread.currentThread().interrupted(); // clear interrupt status
|
||||
Thread.currentThread().interrupted(); // clear interrupted status
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/* @test
|
||||
* @bug 6524172
|
||||
* @summary Invoking wakeup on closed Selector can throw NPE if close resets interrupt status
|
||||
* @summary Invoking wakeup on closed Selector can throw NPE if close resets interrupted status
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -106,7 +106,7 @@ public class AdaptorStreams {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test interrupt status set before read
|
||||
* Test interrupted status set before read
|
||||
*/
|
||||
public void testRead6() throws Exception {
|
||||
withConnection((sc, peer) -> {
|
||||
@ -203,7 +203,7 @@ public class AdaptorStreams {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test interrupt status set before timed read
|
||||
* Test interrupted status set before timed read
|
||||
*/
|
||||
public void testTimedRead5() throws Exception {
|
||||
withConnection((sc, peer) -> {
|
||||
@ -257,7 +257,7 @@ public class AdaptorStreams {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test interrupt status set before write
|
||||
* Test interrupted status set before write
|
||||
*/
|
||||
public void testWrite2() throws Exception {
|
||||
withConnection((sc, peer) -> {
|
||||
|
||||
@ -253,7 +253,7 @@ class SelectorOps {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test calling select with interrupt status set.
|
||||
* Test calling select with interrupted status set.
|
||||
*/
|
||||
@Test
|
||||
public void testInterruptBeforeSelect() throws Exception {
|
||||
@ -270,7 +270,7 @@ class SelectorOps {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test calling select with interrupt status set and thread is pinned.
|
||||
* Test calling select with interrupted status set and thread is pinned.
|
||||
*/
|
||||
@Test
|
||||
public void testInterruptBeforeSelectWhenPinned() throws Exception {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,7 +25,7 @@
|
||||
* @test
|
||||
* @bug 8205612
|
||||
* @run testng CallWithInterruptSet
|
||||
* @summary Test invoking Files methods with the interrupt status set
|
||||
* @summary Test invoking Files methods with the interrupted status set
|
||||
*/
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -120,7 +120,7 @@ public class InterruptCopy {
|
||||
} catch (IOException e) {
|
||||
boolean interrupted = Thread.interrupted();
|
||||
if (!interrupted)
|
||||
throw new RuntimeException("Interrupt status was not set");
|
||||
throw new RuntimeException("Interrupted status was not set");
|
||||
System.out.println("Copy failed (this is expected).");
|
||||
}
|
||||
try {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,7 +30,7 @@ import static java.util.concurrent.TimeUnit.DAYS;
|
||||
* @test
|
||||
* @bug 8254350
|
||||
* @run main LostInterrupt
|
||||
* @summary CompletableFuture.get may swallow interrupt status
|
||||
* @summary CompletableFuture.get may swallow interrupted status
|
||||
* @key randomness
|
||||
*/
|
||||
|
||||
@ -38,9 +38,9 @@ import static java.util.concurrent.TimeUnit.DAYS;
|
||||
|
||||
/**
|
||||
* Submits a task that completes immediately, then invokes CompletableFuture.get
|
||||
* with the interrupt status set. CompletableFuture.get should either complete
|
||||
* immediately with the interrupt status set, or else throw InterruptedException
|
||||
* with the interrupt status cleared.
|
||||
* with the interrupted status set. CompletableFuture.get should either complete
|
||||
* immediately with the interrupted status set, or else throw InterruptedException
|
||||
* with the interrupted status cleared.
|
||||
*/
|
||||
public class LostInterrupt {
|
||||
static final int ITERATIONS = 10_000;
|
||||
@ -63,7 +63,7 @@ public class LostInterrupt {
|
||||
} catch (InterruptedException expected) {
|
||||
if (Thread.interrupted())
|
||||
throw new AssertionError(
|
||||
"interrupt status not cleared, run=" + i);
|
||||
"interrupted status not cleared, run=" + i);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -57,12 +57,12 @@ public class SwallowedInterruptedException {
|
||||
|
||||
if (!Thread.currentThread().isInterrupted()) {
|
||||
fail.set(new AssertionError(
|
||||
"Future.get completed with interrupt status not set"));
|
||||
"Future.get completed with interrupted status not set"));
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
fail.set(new AssertionError(
|
||||
"InterruptedException with interrupt status set"));
|
||||
"InterruptedException with interrupted status set"));
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
fail.set(ex);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -207,7 +207,7 @@ class CloseTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test invoking close with interrupt status set.
|
||||
* Test invoking close with interrupted status set.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@MethodSource("executors")
|
||||
@ -225,7 +225,7 @@ class CloseTest {
|
||||
executor.close();
|
||||
assertTrue(Thread.currentThread().isInterrupted());
|
||||
} finally {
|
||||
Thread.interrupted(); // clear interrupt status
|
||||
Thread.interrupted(); // clear interrupted status
|
||||
}
|
||||
assertTrue(executor.isShutdown());
|
||||
assertTrue(executor.isTerminated());
|
||||
@ -259,7 +259,7 @@ class CloseTest {
|
||||
executor.close();
|
||||
assertTrue(Thread.currentThread().isInterrupted());
|
||||
} finally {
|
||||
Thread.interrupted(); // clear interrupt status
|
||||
Thread.interrupted(); // clear interrupted status
|
||||
}
|
||||
assertTrue(executor.isShutdown());
|
||||
assertTrue(executor.isTerminated());
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -284,7 +284,7 @@ class InvokeTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test invokeAny with interrupt status set.
|
||||
* Test invokeAny with interrupted status set.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@MethodSource("executors")
|
||||
@ -530,7 +530,7 @@ class InvokeTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test invokeAll with interrupt status set.
|
||||
* Test invokeAll with interrupted status set.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@MethodSource("executors")
|
||||
@ -555,7 +555,7 @@ class InvokeTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test timed-invokeAll with interrupt status set.
|
||||
* Test timed-invokeAll with interrupted status set.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@MethodSource("executors")
|
||||
|
||||
@ -425,7 +425,7 @@ class StructuredTaskScopeTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test join with interrupt status set.
|
||||
* Test join with interrupted status set.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@MethodSource("factories")
|
||||
@ -444,7 +444,7 @@ class StructuredTaskScopeTest {
|
||||
scope.join();
|
||||
fail("join did not throw");
|
||||
} catch (InterruptedException expected) {
|
||||
assertFalse(Thread.interrupted()); // interrupt status should be cleared
|
||||
assertFalse(Thread.interrupted()); // interrupted status should be cleared
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -470,7 +470,7 @@ class StructuredTaskScopeTest {
|
||||
scope.join();
|
||||
fail("join did not throw");
|
||||
} catch (InterruptedException expected) {
|
||||
assertFalse(Thread.interrupted()); // interrupt status should be clear
|
||||
assertFalse(Thread.interrupted()); // interrupted status should be clear
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -745,7 +745,7 @@ class StructuredTaskScopeTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test close with interrupt status set.
|
||||
* Test close with interrupted status set.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@MethodSource("factories")
|
||||
@ -776,12 +776,12 @@ class StructuredTaskScopeTest {
|
||||
|
||||
scope.join();
|
||||
|
||||
// invoke close with interrupt status set
|
||||
// invoke close with interrupted status set
|
||||
Thread.currentThread().interrupt();
|
||||
try {
|
||||
scope.close();
|
||||
} finally {
|
||||
assertTrue(Thread.interrupted()); // clear interrupt status
|
||||
assertTrue(Thread.interrupted()); // clear interrupted status
|
||||
assertTrue(done.get());
|
||||
}
|
||||
}
|
||||
@ -829,7 +829,7 @@ class StructuredTaskScopeTest {
|
||||
try {
|
||||
scope.close();
|
||||
} finally {
|
||||
assertTrue(Thread.interrupted()); // clear interrupt status
|
||||
assertTrue(Thread.interrupted()); // clear interrupted status
|
||||
assertTrue(done.get());
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ class ThreadPerTaskExecutorTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke close with interrupt status set.
|
||||
* Invoke close with interrupted status set.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@MethodSource("executors")
|
||||
@ -593,7 +593,7 @@ class ThreadPerTaskExecutorTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test invokeAny with interrupt status set.
|
||||
* Test invokeAny with interrupted status set.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@MethodSource("executors")
|
||||
@ -822,7 +822,7 @@ class ThreadPerTaskExecutorTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test untimed-invokeAll with interrupt status set.
|
||||
* Test untimed-invokeAll with interrupted status set.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@MethodSource("executors")
|
||||
@ -846,7 +846,7 @@ class ThreadPerTaskExecutorTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test timed-invokeAll with interrupt status set.
|
||||
* Test timed-invokeAll with interrupted status set.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@MethodSource("executors")
|
||||
|
||||
@ -832,7 +832,7 @@ public class JSR166TestCase extends TestCase {
|
||||
* by rethrowing, in the test harness thread, any exception recorded
|
||||
* earlier by threadRecordFailure.
|
||||
*
|
||||
* Triggers test case failure if interrupt status is set in the main thread.
|
||||
* Triggers test case failure if interrupted status is set in the main thread.
|
||||
*/
|
||||
public void tearDown() throws Exception {
|
||||
Throwable t = threadFailure.getAndSet(null);
|
||||
@ -848,7 +848,7 @@ public class JSR166TestCase extends TestCase {
|
||||
}
|
||||
|
||||
if (Thread.interrupted())
|
||||
tearDownFail("interrupt status set in main thread");
|
||||
tearDownFail("interrupted status set in main thread");
|
||||
|
||||
checkForkJoinPoolThreadLeaks();
|
||||
}
|
||||
@ -1460,7 +1460,7 @@ public class JSR166TestCase extends TestCase {
|
||||
|
||||
/**
|
||||
* Spin-waits up to LONG_DELAY_MS milliseconds for the current thread to
|
||||
* be interrupted. Clears the interrupt status before returning.
|
||||
* be interrupted. Clears the interrupted status before returning.
|
||||
*/
|
||||
void awaitInterrupted() {
|
||||
for (long startTime = 0L; !Thread.interrupted(); ) {
|
||||
|
||||
@ -410,7 +410,7 @@ public class StampedLockTest extends JSR166TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-interruptible operations ignore and preserve interrupt status
|
||||
* Non-interruptible operations ignore and preserve interrupted status
|
||||
*/
|
||||
public void testNonInterruptibleOperationsIgnoreInterrupts() {
|
||||
final StampedLock lock = new StampedLock();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -45,7 +45,7 @@ public class InterruptibleZip {
|
||||
System.out.printf("interrupted=%s n=%d name=%s%n",
|
||||
interrupted, n, ze.getName());
|
||||
if (! interrupted) {
|
||||
throw new Error("Wrong interrupt status");
|
||||
throw new Error("Wrong interrupted status");
|
||||
}
|
||||
if (n != buf.length) {
|
||||
throw new Error("Read error");
|
||||
|
||||
@ -530,7 +530,7 @@ class ThreadFlockTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test awaitAll with interrupt status set, should interrupt thread.
|
||||
* Test awaitAll with interrupted status set, should interrupt thread.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@MethodSource("factories")
|
||||
@ -550,17 +550,17 @@ class ThreadFlockTest {
|
||||
Thread thread = factory.newThread(awaitLatch);
|
||||
flock.start(thread);
|
||||
|
||||
// invoke awaitAll with interrupt status set.
|
||||
// invoke awaitAll with interrupted status set.
|
||||
Thread.currentThread().interrupt();
|
||||
try {
|
||||
flock.awaitAll();
|
||||
fail("awaitAll did not throw");
|
||||
} catch (InterruptedException e) {
|
||||
// interrupt status should be clear
|
||||
// interrupted status should be clear
|
||||
assertFalse(Thread.currentThread().isInterrupted());
|
||||
}
|
||||
|
||||
// invoke awaitAll(Duration) with interrupt status set.
|
||||
// invoke awaitAll(Duration) with interrupted status set.
|
||||
Thread.currentThread().interrupt();
|
||||
try {
|
||||
flock.awaitAll(Duration.ofSeconds(30));
|
||||
@ -568,7 +568,7 @@ class ThreadFlockTest {
|
||||
} catch (TimeoutException e) {
|
||||
fail("TimeoutException not expected");
|
||||
} catch (InterruptedException e) {
|
||||
// interrupt status should be clear
|
||||
// interrupted status should be clear
|
||||
assertFalse(Thread.currentThread().isInterrupted());
|
||||
}
|
||||
|
||||
@ -609,7 +609,7 @@ class ThreadFlockTest {
|
||||
flock.awaitAll();
|
||||
fail("awaitAll did not throw");
|
||||
} catch (InterruptedException e) {
|
||||
// interrupt status should be clear
|
||||
// interrupted status should be clear
|
||||
assertFalse(Thread.currentThread().isInterrupted());
|
||||
}
|
||||
|
||||
@ -620,7 +620,7 @@ class ThreadFlockTest {
|
||||
} catch (TimeoutException e) {
|
||||
fail("TimeoutException not expected");
|
||||
} catch (InterruptedException e) {
|
||||
// interrupt status should be clear
|
||||
// interrupted status should be clear
|
||||
assertFalse(Thread.currentThread().isInterrupted());
|
||||
}
|
||||
|
||||
@ -841,7 +841,7 @@ class ThreadFlockTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test close with interrupt status set, should not interrupt threads.
|
||||
* Test close with interrupted status set, should not interrupt threads.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@MethodSource("factories")
|
||||
|
||||
@ -272,7 +272,7 @@ public class StatusResponseManagerTests {
|
||||
CertStatusRequest oReq = OCSPStatusRequest.EMPTY_OCSP;
|
||||
|
||||
try {
|
||||
// Force the interrupt flag to be set on the thread that
|
||||
// Force the interrupted flag to be set on the thread that
|
||||
// performs the invokeAll in the SRM.
|
||||
Thread.currentThread().interrupt();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user