Skip to content

Commit 650603d

Browse files
committed
Remove JSR-305 ThreadSafe annotation and replace with JavaDoc where appropriate
1 parent 13b4b97 commit 650603d

61 files changed

Lines changed: 223 additions & 138 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/src/main/java/io/grpc/Channel.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package io.grpc;
1818

19-
import javax.annotation.concurrent.ThreadSafe;
2019

2120
/**
2221
* A virtual connection to a conceptual endpoint, to perform RPCs. A channel is free to have zero or
@@ -29,8 +28,10 @@
2928
* implementations using {@link ClientInterceptor}. It is expected that most application
3029
* code will not use this class directly but rather work with stubs that have been bound to a
3130
* Channel that was decorated during application initialization.
31+
*
32+
* <p>This is thread-safe and should be considered
33+
* for the errorprone ThreadSafe annotation in the future.
3234
*/
33-
@ThreadSafe
3435
public abstract class Channel {
3536
/**
3637
* Create a {@link ClientCall} to the remote operation specified by the given

api/src/main/java/io/grpc/ChannelLogger.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@
1616

1717
package io.grpc;
1818

19-
import javax.annotation.concurrent.ThreadSafe;
2019

2120
/**
2221
* A Channel-specific logger provided by GRPC library to {@link LoadBalancer} implementations.
2322
* Information logged here goes to <strong>Channelz</strong>, and to the Java logger of this class
2423
* as well.
24+
*
25+
* <p>This is thread-safe and should be considered
26+
* for the errorprone ThreadSafe annotation in the future.
2527
*/
2628
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/5029")
27-
@ThreadSafe
2829
public abstract class ChannelLogger {
2930
/**
3031
* Log levels. See the table below for the mapping from the ChannelLogger levels to Channelz

api/src/main/java/io/grpc/ClientInterceptor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package io.grpc;
1818

19-
import javax.annotation.concurrent.ThreadSafe;
2019

2120
/**
2221
* Interface for intercepting outgoing calls before they are dispatched by a {@link Channel}.
@@ -37,8 +36,10 @@
3736
* without completing the previous ones first. Refer to the
3837
* {@link io.grpc.ClientCall.Listener ClientCall.Listener} docs for more details regarding thread
3938
* safety of the returned listener.
39+
*
40+
* <p>This is thread-safe and should be considered
41+
* for the errorprone ThreadSafe annotation in the future.
4042
*/
41-
@ThreadSafe
4243
public interface ClientInterceptor {
4344
/**
4445
* Intercept {@link ClientCall} creation by the {@code next} {@link Channel}.

api/src/main/java/io/grpc/ClientStreamTracer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@
1919
import static com.google.common.base.Preconditions.checkNotNull;
2020

2121
import com.google.common.base.MoreObjects;
22-
import javax.annotation.concurrent.ThreadSafe;
2322

2423
/**
2524
* {@link StreamTracer} for the client-side.
25+
*
26+
* <p>This is thread-safe and should be considered
27+
* for the errorprone ThreadSafe annotation in the future.
2628
*/
2729
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2861")
28-
@ThreadSafe
2930
public abstract class ClientStreamTracer extends StreamTracer {
3031
/**
3132
* Indicates how long the call was delayed, in nanoseconds, due to waiting for name resolution

api/src/main/java/io/grpc/CompressorRegistry.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@
2222
import java.util.concurrent.ConcurrentHashMap;
2323
import java.util.concurrent.ConcurrentMap;
2424
import javax.annotation.Nullable;
25-
import javax.annotation.concurrent.ThreadSafe;
2625

2726
/**
2827
* Encloses classes related to the compression and decompression of messages.
28+
*
29+
* <p>This is thread-safe and should be considered
30+
* for the errorprone ThreadSafe annotation in the future.
2931
*/
3032
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
31-
@ThreadSafe
3233
public final class CompressorRegistry {
3334
private static final CompressorRegistry DEFAULT_INSTANCE = new CompressorRegistry(
3435
new Codec.Gzip(),

api/src/main/java/io/grpc/DecompressorRegistry.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@
2727
import java.util.Map;
2828
import java.util.Set;
2929
import javax.annotation.Nullable;
30-
import javax.annotation.concurrent.ThreadSafe;
3130

3231
/**
3332
* Encloses classes related to the compression and decompression of messages.
33+
*
34+
* <p>This is thread-safe and should be considered
35+
* for the errorprone ThreadSafe annotation in the future.
3436
*/
3537
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
36-
@ThreadSafe
3738
public final class DecompressorRegistry {
3839
static final Joiner ACCEPT_ENCODING_JOINER = Joiner.on(',');
3940

api/src/main/java/io/grpc/HandlerRegistry.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
import java.util.Collections;
2020
import java.util.List;
2121
import javax.annotation.Nullable;
22-
import javax.annotation.concurrent.ThreadSafe;
2322

2423
/**
2524
* Registry of services and their methods used by servers to dispatching incoming calls.
25+
*
26+
* <p>This is thread-safe and should be considered
27+
* for the errorprone ThreadSafe annotation in the future.
2628
*/
27-
@ThreadSafe
2829
public abstract class HandlerRegistry {
2930

3031
/**

api/src/main/java/io/grpc/LoadBalancer.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import javax.annotation.Nullable;
3333
import javax.annotation.concurrent.Immutable;
3434
import javax.annotation.concurrent.NotThreadSafe;
35-
import javax.annotation.concurrent.ThreadSafe;
3635

3736
/**
3837
* A pluggable component that receives resolved addresses from {@link NameResolver} and provides the
@@ -447,10 +446,12 @@ public void requestConnection() {}
447446
/**
448447
* The main balancing logic. It <strong>must be thread-safe</strong>. Typically it should only
449448
* synchronize on its own state, and avoid synchronizing with the LoadBalancer's state.
449+
*
450+
* <p>This is thread-safe and should be considered
451+
* for the errorprone ThreadSafe annotation in the future.
450452
*
451453
* @since 1.2.0
452454
*/
453-
@ThreadSafe
454455
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
455456
public abstract static class SubchannelPicker {
456457
/**
@@ -1030,9 +1031,11 @@ public String toString() {
10301031
/**
10311032
* Provides essentials for LoadBalancer implementations.
10321033
*
1034+
* <p>This is thread-safe and should be considered
1035+
* for the errorprone ThreadSafe annotation in the future.
1036+
*
10331037
* @since 1.2.0
10341038
*/
1035-
@ThreadSafe
10361039
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
10371040
public abstract static class Helper {
10381041
/**
@@ -1551,9 +1554,11 @@ public interface SubchannelStateListener {
15511554
/**
15521555
* Factory to create {@link LoadBalancer} instance.
15531556
*
1557+
* <p>This is thread-safe and should be considered
1558+
* for the errorprone ThreadSafe annotation in the future.
1559+
*
15541560
* @since 1.2.0
15551561
*/
1556-
@ThreadSafe
15571562
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
15581563
public abstract static class Factory {
15591564
/**

api/src/main/java/io/grpc/LoadBalancerRegistry.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,17 @@
3030
import java.util.logging.Level;
3131
import java.util.logging.Logger;
3232
import javax.annotation.Nullable;
33-
import javax.annotation.concurrent.ThreadSafe;
3433

3534
/**
3635
* Registry of {@link LoadBalancerProvider}s. The {@link #getDefaultRegistry default instance}
3736
* loads providers at runtime through the Java service provider mechanism.
38-
*
37+
*
38+
* <p>This is thread-safe and should be considered
39+
* for the errorprone ThreadSafe annotation in the future.
40+
*
3941
* @since 1.17.0
4042
*/
4143
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
42-
@ThreadSafe
4344
public final class LoadBalancerRegistry {
4445
private static final Logger logger = Logger.getLogger(LoadBalancerRegistry.class.getName());
4546
private static LoadBalancerRegistry instance;

api/src/main/java/io/grpc/ManagedChannel.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
package io.grpc;
1818

1919
import java.util.concurrent.TimeUnit;
20-
import javax.annotation.concurrent.ThreadSafe;
2120

2221
/**
2322
* A {@link Channel} that provides lifecycle management.
23+
*
24+
* <p>This is thread-safe and should be considered
25+
* for the errorprone ThreadSafe annotation in the future.
2426
*/
25-
@ThreadSafe
2627
public abstract class ManagedChannel extends Channel {
2728
/**
2829
* Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately

0 commit comments

Comments
 (0)