8251548: Remove unnecessary explicit initialization of volatile variables in security-libs code

Reviewed-by: mullan
This commit is contained in:
Sergey Tsypanov 2020-09-18 21:26:59 +00:00 committed by Weijun Wang
parent d35b117956
commit f55dd9d40e
8 changed files with 17 additions and 17 deletions

View File

@ -219,7 +219,7 @@ public class KeyStore {
private KeyStoreSpi keyStoreSpi; private KeyStoreSpi keyStoreSpi;
// Has this keystore been initialized (loaded)? // Has this keystore been initialized (loaded)?
private boolean initialized = false; private boolean initialized;
/** /**
* A marker interface for {@code KeyStore} * A marker interface for {@code KeyStore}
@ -264,7 +264,7 @@ public class KeyStore {
private final char[] password; private final char[] password;
private final String protectionAlgorithm; private final String protectionAlgorithm;
private final AlgorithmParameterSpec protectionParameters; private final AlgorithmParameterSpec protectionParameters;
private volatile boolean destroyed = false; private volatile boolean destroyed;
/** /**
* Creates a password parameter. * Creates a password parameter.

View File

@ -206,5 +206,5 @@ public abstract class ListResourceBundle extends ResourceBundle {
lookup = temp; lookup = temp;
} }
private volatile Map<String,Object> lookup = null; private volatile Map<String,Object> lookup;
} }

View File

@ -126,7 +126,7 @@ public final class Subject implements java.io.Serializable {
* *
* @serial * @serial
*/ */
private volatile boolean readOnly = false; private volatile boolean readOnly;
private static final int PRINCIPAL_SET = 1; private static final int PRINCIPAL_SET = 1;
private static final int PUB_CREDENTIAL_SET = 2; private static final int PUB_CREDENTIAL_SET = 2;

View File

@ -71,7 +71,7 @@ public abstract class AbstractDrbg {
// Common working status // Common working status
private boolean instantiated = false; private boolean instantiated;
/** /**
* Reseed counter of a DRBG instance. A mechanism should increment it * Reseed counter of a DRBG instance. A mechanism should increment it
@ -80,7 +80,7 @@ public abstract class AbstractDrbg {
* *
* Volatile, will be used in a double checked locking. * Volatile, will be used in a double checked locking.
*/ */
protected volatile int reseedCounter = 0; protected volatile int reseedCounter;
// Mech features. If not same as below, must be redefined in constructor. // Mech features. If not same as below, must be redefined in constructor.

View File

@ -36,7 +36,7 @@ import sun.security.ssl.SSLCipher.SSLWriteCipher;
*/ */
final class DTLSOutputRecord extends OutputRecord implements DTLSRecord { final class DTLSOutputRecord extends OutputRecord implements DTLSRecord {
private DTLSFragmenter fragmenter = null; private DTLSFragmenter fragmenter;
int writeEpoch; int writeEpoch;
@ -44,7 +44,7 @@ final class DTLSOutputRecord extends OutputRecord implements DTLSRecord {
Authenticator prevWriteAuthenticator; Authenticator prevWriteAuthenticator;
SSLWriteCipher prevWriteCipher; SSLWriteCipher prevWriteCipher;
private volatile boolean isCloseWaiting = false; private volatile boolean isCloseWaiting;
DTLSOutputRecord(HandshakeHash handshakeHash) { DTLSOutputRecord(HandshakeHash handshakeHash) {
super(handshakeHash, SSLWriteCipher.nullDTlsWriteCipher()); super(handshakeHash, SSLWriteCipher.nullDTlsWriteCipher());

View File

@ -102,11 +102,11 @@ abstract class HandshakeContext implements ConnectionContext {
boolean isResumption; boolean isResumption;
SSLSessionImpl resumingSession; SSLSessionImpl resumingSession;
// Session is using stateless resumption // Session is using stateless resumption
boolean statelessResumption = false; boolean statelessResumption;
final Queue<Map.Entry<Byte, ByteBuffer>> delegatedActions; final Queue<Map.Entry<Byte, ByteBuffer>> delegatedActions;
volatile boolean taskDelegated = false; volatile boolean taskDelegated;
volatile Exception delegatedThrown = null; volatile Exception delegatedThrown;
ProtocolVersion negotiatedProtocol; ProtocolVersion negotiatedProtocol;
CipherSuite negotiatedCipherSuite; CipherSuite negotiatedCipherSuite;

View File

@ -37,11 +37,11 @@ import sun.security.ssl.SSLCipher.SSLWriteCipher;
*/ */
final class SSLEngineOutputRecord extends OutputRecord implements SSLRecord { final class SSLEngineOutputRecord extends OutputRecord implements SSLRecord {
private HandshakeFragment fragmenter = null; private HandshakeFragment fragmenter;
private boolean isTalkingToV2 = false; // SSLv2Hello private boolean isTalkingToV2; // SSLv2Hello
private ByteBuffer v2ClientHello = null; // SSLv2Hello private ByteBuffer v2ClientHello; // SSLv2Hello
private volatile boolean isCloseWaiting = false; private volatile boolean isCloseWaiting;
SSLEngineOutputRecord(HandshakeHash handshakeHash) { SSLEngineOutputRecord(HandshakeHash handshakeHash) {
super(handshakeHash, SSLWriteCipher.nullTlsWriteCipher()); super(handshakeHash, SSLWriteCipher.nullTlsWriteCipher());

View File

@ -83,8 +83,8 @@ public final class SSLSocketImpl
private String peerHost; private String peerHost;
private boolean autoClose; private boolean autoClose;
private boolean isConnected = false; private boolean isConnected;
private volatile boolean tlsIsClosed = false; private volatile boolean tlsIsClosed;
private final ReentrantLock socketLock = new ReentrantLock(); private final ReentrantLock socketLock = new ReentrantLock();
private final ReentrantLock handshakeLock = new ReentrantLock(); private final ReentrantLock handshakeLock = new ReentrantLock();