Skip to content

Commit 27acbb6

Browse files
committed
Remove JSR-305 ThreadSafe annotation and replace with JavaDoc
1 parent 7b0a7eb commit 27acbb6

24 files changed

Lines changed: 78 additions & 51 deletions

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/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/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

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import java.util.concurrent.ScheduledExecutorService;
3636
import javax.annotation.Nullable;
3737
import javax.annotation.concurrent.Immutable;
38-
import javax.annotation.concurrent.ThreadSafe;
3938

4039
/**
4140
* A pluggable component that resolves a target {@link URI} and return addresses to the caller.
@@ -214,11 +213,13 @@ public NameResolver newNameResolver(Uri targetUri, final Args args) {
214213
* Receives address updates.
215214
*
216215
* <p>All methods are expected to return quickly.
217-
*
216+
*
217+
* <p>This is thread-safe and should be considered
218+
* for the errorprone ThreadSafe annotation in the future.
219+
*
218220
* @since 1.0.0
219221
*/
220222
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1770")
221-
@ThreadSafe
222223
public interface Listener {
223224
/**
224225
* Handles updates on resolved addresses and attributes.

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@
2121
import java.util.Collections;
2222
import java.util.List;
2323
import java.util.concurrent.TimeUnit;
24-
import javax.annotation.concurrent.ThreadSafe;
2524

2625
/**
2726
* Server for listening for and dispatching incoming calls. It is not expected to be implemented by
2827
* application code or interceptors.
28+
*
29+
* <p>This is thread-safe and should be considered
30+
* for the errorprone ThreadSafe annotation in the future.
2931
*/
30-
@ThreadSafe
3132
public abstract class Server {
3233

3334
/**

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

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

1717
package io.grpc;
1818

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

2120
/**
2221
* Interface to initiate processing of incoming remote calls. Advanced applications and generated
2322
* code will implement this interface to allows {@link Server}s to invoke service methods.
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 interface ServerCallHandler<RequestT, ResponseT> {
2728
/**
2829
* Starts asynchronous processing of an incoming call.

0 commit comments

Comments
 (0)