8313743: Make fields final in sun.nio.ch
Reviewed-by: bpb
This commit is contained in:
parent
ec0cc6300a
commit
b88c273503
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2023, 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
|
||||
@ -59,7 +59,7 @@ abstract class AsynchronousChannelGroupImpl
|
||||
private final AtomicInteger threadCount = new AtomicInteger();
|
||||
|
||||
// associated Executor for timeouts
|
||||
private ScheduledThreadPoolExecutor timeoutExecutor;
|
||||
private final ScheduledThreadPoolExecutor timeoutExecutor;
|
||||
|
||||
// task queue for when using a fixed thread pool. In that case, a thread
|
||||
// waiting on I/O events must be awoken to poll tasks from this queue.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2023, 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
|
||||
@ -58,7 +58,7 @@ abstract class AsynchronousServerSocketChannelImpl
|
||||
private final Object stateLock = new Object();
|
||||
|
||||
// close support
|
||||
private ReadWriteLock closeLock = new ReentrantReadWriteLock();
|
||||
private final ReadWriteLock closeLock = new ReentrantReadWriteLock();
|
||||
private volatile boolean closed;
|
||||
|
||||
// set true when accept operation is cancelled
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2023, 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
|
||||
@ -49,7 +49,7 @@ class FileLockTable {
|
||||
* FileLock (and FileChannel) alive.
|
||||
*/
|
||||
private static class FileLockReference extends WeakReference<FileLock> {
|
||||
private FileKey fileKey;
|
||||
private final FileKey fileKey;
|
||||
|
||||
FileLockReference(FileLock referent,
|
||||
ReferenceQueue<FileLock> queue,
|
||||
@ -66,11 +66,11 @@ class FileLockTable {
|
||||
// The system-wide map is a ConcurrentHashMap that is keyed on the FileKey.
|
||||
// The map value is a list of file locks represented by FileLockReferences.
|
||||
// All access to the list must be synchronized on the list.
|
||||
private static ConcurrentHashMap<FileKey, List<FileLockReference>> lockMap =
|
||||
new ConcurrentHashMap<FileKey, List<FileLockReference>>();
|
||||
private static final ConcurrentHashMap<FileKey, List<FileLockReference>> lockMap =
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
// reference queue for cleared refs
|
||||
private static ReferenceQueue<FileLock> queue = new ReferenceQueue<FileLock>();
|
||||
private static final ReferenceQueue<FileLock> queue = new ReferenceQueue<>();
|
||||
|
||||
// The connection to which this table is connected
|
||||
private final Channel channel;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2023, 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
|
||||
@ -69,7 +69,7 @@ class IOVecWrapper {
|
||||
final long address;
|
||||
|
||||
// Address size in bytes
|
||||
static int addressSize;
|
||||
static final int addressSize;
|
||||
|
||||
private static class Deallocator implements Runnable {
|
||||
private final AllocatedNativeObject obj;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2023, 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,8 +30,8 @@ package sun.nio.ch;
|
||||
*/
|
||||
|
||||
class OptionKey {
|
||||
private int level;
|
||||
private int name;
|
||||
private final int level;
|
||||
private final int name;
|
||||
|
||||
OptionKey(int level, int name) {
|
||||
this.level = level;
|
||||
|
@ -53,7 +53,7 @@ public class Util {
|
||||
private static final long MAX_CACHED_BUFFER_SIZE = getMaxCachedBufferSize();
|
||||
|
||||
// Per-carrier-thread cache of temporary direct buffers
|
||||
private static TerminatingThreadLocal<BufferCache> bufferCache = new TerminatingThreadLocal<>() {
|
||||
private static final TerminatingThreadLocal<BufferCache> bufferCache = new TerminatingThreadLocal<>() {
|
||||
@Override
|
||||
protected BufferCache initialValue() {
|
||||
return new BufferCache();
|
||||
@ -112,7 +112,7 @@ public class Util {
|
||||
*/
|
||||
private static class BufferCache {
|
||||
// the array of buffers
|
||||
private ByteBuffer[] buffers;
|
||||
private final ByteBuffer[] buffers;
|
||||
|
||||
// the number of buffers in the cache
|
||||
private int count;
|
||||
@ -378,7 +378,7 @@ public class Util {
|
||||
|
||||
// -- Unsafe access --
|
||||
|
||||
private static Unsafe unsafe = Unsafe.getUnsafe();
|
||||
private static final Unsafe unsafe = Unsafe.getUnsafe();
|
||||
|
||||
private static byte _get(long a) {
|
||||
return unsafe.getByte(a);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2023, 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 @@ class PollArrayWrapper {
|
||||
@Native private static final short FD_OFFSET = 0; // fd offset in pollfd
|
||||
@Native private static final short EVENT_OFFSET = 4; // events offset in pollfd
|
||||
|
||||
static short SIZE_POLLFD = 8; // sizeof pollfd struct
|
||||
static final short SIZE_POLLFD = 8; // sizeof pollfd struct
|
||||
|
||||
private int size; // Size of the pollArray
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2023, 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,10 +45,9 @@ class WindowsAsynchronousSocketChannelImpl
|
||||
extends AsynchronousSocketChannelImpl implements Iocp.OverlappedChannel
|
||||
{
|
||||
private static final Unsafe unsafe = Unsafe.getUnsafe();
|
||||
private static int addressSize = unsafe.addressSize();
|
||||
|
||||
private static int dependsArch(int value32, int value64) {
|
||||
return (addressSize == 4) ? value32 : value64;
|
||||
return (unsafe.addressSize() == 4) ? value32 : value64;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2023, 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
|
||||
@ -49,14 +49,13 @@ import jdk.internal.misc.Unsafe;
|
||||
|
||||
class WindowsSelectorImpl extends SelectorImpl {
|
||||
private static final Unsafe unsafe = Unsafe.getUnsafe();
|
||||
private static int addressSize = unsafe.addressSize();
|
||||
|
||||
private static int dependsArch(int value32, int value64) {
|
||||
return (addressSize == 4) ? value32 : value64;
|
||||
return (unsafe.addressSize() == 4) ? value32 : value64;
|
||||
}
|
||||
|
||||
// Initial capacity of the poll array
|
||||
private final int INIT_CAP = 8;
|
||||
private static final int INIT_CAP = 8;
|
||||
// Maximum number of sockets for select().
|
||||
// Should be INIT_CAP times a power of 2
|
||||
private static final int MAX_SELECTABLE_FDS = 1024;
|
||||
@ -74,7 +73,7 @@ class WindowsSelectorImpl extends SelectorImpl {
|
||||
private SelectionKeyImpl[] channelArray = new SelectionKeyImpl[INIT_CAP];
|
||||
|
||||
// The global native poll array holds file descriptors and event masks
|
||||
private PollArrayWrapper pollWrapper;
|
||||
private final PollArrayWrapper pollWrapper;
|
||||
|
||||
// The number of valid entries in poll array, including entries occupied
|
||||
// by wakeup socket handle.
|
||||
|
Loading…
Reference in New Issue
Block a user