Skip to content
Permalink
Browse files
8255299: Drop explicit zeroing at instantiation of Atomic* objects
Reviewed-by: redestad, serb, prr
  • Loading branch information
stsypanov authored and dfuch committed Oct 28, 2020
1 parent 6b2d11b commit 3c4fc793265d76c2ef165a698a2e7e1dfcc7dd78
@@ -87,7 +87,7 @@
private static final String[] EMPTY_STRING_ARRAY = new String[0];

// Used to ensure that each spun class name is unique
private static final AtomicInteger counter = new AtomicInteger(0);
private static final AtomicInteger counter = new AtomicInteger();

// For dumping generated classes to disk, for debugging purposes
private static final ProxyClassesDumper dumper;
@@ -120,7 +120,7 @@ protected void finalize() throws Throwable {
/**
* This ID is used to generate thread names.
*/
private static final AtomicInteger nextSerialNumber = new AtomicInteger(0);
private static final AtomicInteger nextSerialNumber = new AtomicInteger();
private static int serialNumber() {
return nextSerialNumber.getAndIncrement();
}
@@ -68,7 +68,7 @@
protected AbstractShortCircuitTask(PipelineHelper<P_OUT> helper,
Spliterator<P_IN> spliterator) {
super(helper, spliterator);
sharedResult = new AtomicReference<>(null);
sharedResult = new AtomicReference<>();
}

/**
@@ -62,7 +62,7 @@
}
} catch (NumberFormatException e) {}
maxSockets = defmax;
numSockets = new AtomicInteger(0);
numSockets = new AtomicInteger();
}

public static void beforeUdpCreate() throws SocketException {
@@ -95,7 +95,7 @@
* @since 1.1
*/
public class EventQueue {
private static final AtomicInteger threadInitNumber = new AtomicInteger(0);
private static final AtomicInteger threadInitNumber = new AtomicInteger();

private static final int LOW_PRIORITY = 0;
private static final int NORM_PRIORITY = 1;
@@ -248,7 +248,7 @@ private static long now() {
* Sequence number to break scheduling ties, and in turn to
* guarantee FIFO order among tied entries.
*/
private static final AtomicLong sequencer = new AtomicLong(0);
private static final AtomicLong sequencer = new AtomicLong();

/** Sequence number to break ties FIFO */
private final long sequenceNumber;
@@ -208,7 +208,7 @@ public boolean isDisposed() {
* number is 1. If so, it returns the sole AppContext without
* checking Thread.currentThread().
*/
private static final AtomicInteger numAppContexts = new AtomicInteger(0);
private static final AtomicInteger numAppContexts = new AtomicInteger();


/*
@@ -72,7 +72,7 @@

public class LogRecord implements java.io.Serializable {
private static final AtomicLong globalSequenceNumber
= new AtomicLong(0);
= new AtomicLong();

/**
* Logging message level
@@ -39,7 +39,7 @@

final int limit;
final Http2Connection connection;
final AtomicInteger received = new AtomicInteger(0);
final AtomicInteger received = new AtomicInteger();

WindowUpdateSender(Http2Connection connection) {
this(connection, connection.clientSettings.getParameter(SettingsFrame.INITIAL_WINDOW_SIZE));
@@ -375,7 +375,7 @@ void stop() {
scheduler.stop();
}

AtomicInteger count = new AtomicInteger(0);
AtomicInteger count = new AtomicInteger();

// minimum number of bytes required to call unwrap.
// Usually this is 0, unless there was a buffer underflow.
@@ -74,7 +74,7 @@
private final CompletableFuture<Void> cf;
private final SequentialScheduler pushScheduler;
private final AtomicReference<Throwable> errorRef = new AtomicReference<>();
final AtomicLong upstreamWindow = new AtomicLong(0);
final AtomicLong upstreamWindow = new AtomicLong();

/**
* Wraps the given downstream subscriber. For each call to {@link
@@ -84,7 +84,7 @@
/** indicate compatibility with JDK 1.1.x version of class */
private static final long serialVersionUID = -6386392263968365220L;

private static final AtomicLong nextObjNum = new AtomicLong(0);
private static final AtomicLong nextObjNum = new AtomicLong();
private static final UID mySpace = new UID();
private static final SecureRandom secureRandom = new SecureRandom();

@@ -30,7 +30,6 @@
import java.security.PrivilegedAction;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;

@@ -70,7 +69,7 @@ private RuntimeUtil() {
scheduler = new ScheduledThreadPoolExecutor(
schedulerThreads,
new ThreadFactory() {
private final AtomicInteger count = new AtomicInteger(0);
private final AtomicInteger count = new AtomicInteger();
public Thread newThread(Runnable runnable) {
try {
return AccessController.doPrivileged(
@@ -128,8 +128,6 @@
private static final Map<Class<?>,?> withoutSkeletons =
Collections.synchronizedMap(new WeakHashMap<Class<?>,Void>());

private final AtomicInteger methodCallIDCount = new AtomicInteger(0);

/**
* Create a new (empty) Unicast server remote reference.
* The filter is null to defer to the default ObjectInputStream filter, if any.
@@ -115,7 +115,7 @@ public Thread newThread(Runnable runnable) {
});

/** total connections handled */
private static final AtomicInteger connectionCount = new AtomicInteger(0);
private static final AtomicInteger connectionCount = new AtomicInteger();

/** client host for the current thread's connection */
private static final ThreadLocal<ConnectionHandler>
@@ -48,7 +48,7 @@
* an event stream.
*/
abstract class AbstractEventStream implements EventStream {
private final static AtomicLong counter = new AtomicLong(0);
private final static AtomicLong counter = new AtomicLong();

private final Object terminated = new Object();
private final Runnable flushOperation = () -> dispatcher().runFlushActions();
@@ -32,7 +32,7 @@

public final class ThrowableTracer {

private static final AtomicLong numThrowables = new AtomicLong(0);
private static final AtomicLong numThrowables = new AtomicLong();

public static void traceError(Error e, String message) {
if (e instanceof OutOfMemoryError) {

1 comment on commit 3c4fc79

@bridgekeeper

This comment has been minimized.

Copy link

@bridgekeeper bridgekeeper bot commented on 3c4fc79 Oct 28, 2020

Please sign in to comment.