Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -61,7 +61,7 @@ public void shutdown() {
} catch (InterruptedException ie) {
// (Re-)Cancel if current thread also interrupted
pool.shutdownNow();
// Preserve interrupt status
// Preserve interrupted status
Thread.currentThread().interrupt();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/java.base/share/classes/java/lang/Object.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -383,7 +383,7 @@ public final void wait(long timeoutMillis) throws InterruptedException {
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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/java.base/share/classes/java/lang/Process.java
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ public long pid() {
* @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
Expand Down
14 changes: 7 additions & 7 deletions src/java.base/share/classes/java/lang/Thread.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -355,7 +355,7 @@ void inheritScopedValueBindings(ThreadContainer container) {

/* 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;

Expand Down Expand Up @@ -1535,22 +1535,22 @@ private void exit() {
* 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.
Expand All @@ -1560,7 +1560,7 @@ private void exit() {
* 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

Expand Down
10 changes: 5 additions & 5 deletions src/java.base/share/classes/java/lang/VirtualThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,12 @@ private void mount() {
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();
}
Expand Down Expand Up @@ -721,7 +721,7 @@ public void run() {
/**
* 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() {
Expand Down Expand Up @@ -756,7 +756,7 @@ void park() {
* 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.
*/
Expand Down Expand Up @@ -799,7 +799,7 @@ void parkNanos(long nanos) {
/**
* 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
*/
Expand Down
8 changes: 4 additions & 4 deletions src/java.base/share/classes/java/net/DatagramSocket.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -611,13 +611,13 @@ public void send(DatagramPacket p) throws IOException {
* 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
Expand Down
8 changes: 4 additions & 4 deletions src/java.base/share/classes/java/net/ServerSocket.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -406,13 +406,13 @@ public SocketAddress getLocalSocketAddress() {
* 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
Expand Down
24 changes: 14 additions & 10 deletions src/java.base/share/classes/java/net/Socket.java
Original file line number Diff line number Diff line change
Expand Up @@ -573,12 +573,13 @@ void setConnected() {
* 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}
Expand Down Expand Up @@ -613,12 +614,13 @@ public void connect(SocketAddress endpoint) throws IOException {
* 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
Expand Down Expand Up @@ -886,13 +888,14 @@ public SocketChannel getChannel() {
* 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
Expand Down Expand Up @@ -1026,13 +1029,14 @@ public void close() throws IOException {
* 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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/**
* 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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -290,7 +290,7 @@ public abstract <T> DatagramChannel setOption(SocketOption<T> name, T value)
* 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
Expand Down Expand Up @@ -389,7 +389,7 @@ public abstract DatagramChannel connect(SocketAddress remote)
* 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
Expand Down Expand Up @@ -443,7 +443,7 @@ public abstract DatagramChannel connect(SocketAddress remote)
* 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
Expand Down
16 changes: 8 additions & 8 deletions src/java.base/share/classes/java/nio/channels/FileChannel.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -662,7 +662,7 @@ public final long write(ByteBuffer[] srcs) throws IOException {
* @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
Expand Down Expand Up @@ -732,7 +732,7 @@ public abstract long transferTo(long position, long count,
* @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
Expand Down Expand Up @@ -780,7 +780,7 @@ public abstract long transferFrom(ReadableByteChannel src,
* 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
Expand Down Expand Up @@ -829,7 +829,7 @@ public abstract long transferFrom(ReadableByteChannel src,
* 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
Expand Down Expand Up @@ -1093,10 +1093,10 @@ public MemorySegment map(MapMode mode, long offset, long size, Arena arena)
* 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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/**
* 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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -161,7 +161,7 @@ public long write(ByteBuffer[] srcs, int offset, int length)
* 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
Expand Down
Loading