Skip to content

Commit 24991fb

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

61 files changed

Lines changed: 154 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: 2 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,9 @@
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 for the errorprone ThreadSafe annotation in the future
3233
*/
33-
@ThreadSafe
3434
public abstract class Channel {
3535
/**
3636
* Create a {@link ClientCall} to the remote operation specified by the given

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
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 for the errorprone ThreadSafe annotation in the future
2526
*/
2627
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/5029")
27-
@ThreadSafe
2828
public abstract class ChannelLogger {
2929
/**
3030
* 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: 2 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,9 @@
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 for the errorprone ThreadSafe annotation in the future
4041
*/
41-
@ThreadSafe
4242
public interface ClientInterceptor {
4343
/**
4444
* Intercept {@link ClientCall} creation by the {@code next} {@link Channel}.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
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 for the errorprone ThreadSafe annotation in the future
2627
*/
2728
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2861")
28-
@ThreadSafe
2929
public abstract class ClientStreamTracer extends StreamTracer {
3030
/**
3131
* 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
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 for the errorprone ThreadSafe annotation in the future
2930
*/
3031
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
31-
@ThreadSafe
3232
public final class CompressorRegistry {
3333
private static final CompressorRegistry DEFAULT_INSTANCE = new CompressorRegistry(
3434
new Codec.Gzip(),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
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 for the errorprone ThreadSafe annotation in the future
3435
*/
3536
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
36-
@ThreadSafe
3737
public final class DecompressorRegistry {
3838
static final Joiner ACCEPT_ENCODING_JOINER = Joiner.on(',');
3939

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
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 for the errorprone ThreadSafe annotation in the future
2627
*/
27-
@ThreadSafe
2828
public abstract class HandlerRegistry {
2929

3030
/**

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

Lines changed: 4 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,11 @@ 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 for the errorprone ThreadSafe annotation in the future
450451
*
451452
* @since 1.2.0
452453
*/
453-
@ThreadSafe
454454
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
455455
public abstract static class SubchannelPicker {
456456
/**
@@ -1031,8 +1031,8 @@ public String toString() {
10311031
* Provides essentials for LoadBalancer implementations.
10321032
*
10331033
* @since 1.2.0
1034+
* <p>This is thread-safe and should be considered for the errorprone ThreadSafe annotation in the future
10341035
*/
1035-
@ThreadSafe
10361036
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
10371037
public abstract static class Helper {
10381038
/**
@@ -1552,8 +1552,8 @@ public interface SubchannelStateListener {
15521552
* Factory to create {@link LoadBalancer} instance.
15531553
*
15541554
* @since 1.2.0
1555+
* <p>This is thread-safe and should be considered for the errorprone ThreadSafe annotation in the future
15551556
*/
1556-
@ThreadSafe
15571557
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
15581558
public abstract static class Factory {
15591559
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@
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 for the errorprone ThreadSafe annotation in the future
39+
*
3940
* @since 1.17.0
4041
*/
4142
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
42-
@ThreadSafe
4343
public final class LoadBalancerRegistry {
4444
private static final Logger logger = Logger.getLogger(LoadBalancerRegistry.class.getName());
4545
private static LoadBalancerRegistry instance;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
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 for the errorprone ThreadSafe annotation in the future
2425
*/
25-
@ThreadSafe
2626
public abstract class ManagedChannel extends Channel {
2727
/**
2828
* Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately

0 commit comments

Comments
 (0)