Skip to content

Commit fd678b8

Browse files
committed
Revert "Replace javax ThreadSafe annotation with errorprone ThreadSafe (grpc#12742)"
This reverts commit ef35313 because it breaks Google internal build. Error Prone adds a lot of restrictions, which we may or may not want. We'd need to look at each case and decide what to do.
1 parent ef35313 commit fd678b8

File tree

63 files changed

+81
-78
lines changed

Some content is hidden

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

63 files changed

+81
-78
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package io.grpc;
1818

19-
import com.google.errorprone.annotations.ThreadSafe;
19+
import javax.annotation.concurrent.ThreadSafe;
2020

2121
/**
2222
* A virtual connection to a conceptual endpoint, to perform RPCs. A channel is free to have zero or

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package io.grpc;
1818

19-
import com.google.errorprone.annotations.ThreadSafe;
19+
import javax.annotation.concurrent.ThreadSafe;
2020

2121
/**
2222
* A Channel-specific logger provided by GRPC library to {@link LoadBalancer} implementations.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package io.grpc;
1818

19-
import com.google.errorprone.annotations.ThreadSafe;
19+
import javax.annotation.concurrent.ThreadSafe;
2020

2121
/**
2222
* Interface for intercepting outgoing calls before they are dispatched by a {@link Channel}.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import static com.google.common.base.Preconditions.checkNotNull;
2020

2121
import com.google.common.base.MoreObjects;
22-
import com.google.errorprone.annotations.ThreadSafe;
22+
import javax.annotation.concurrent.ThreadSafe;
2323

2424
/**
2525
* {@link StreamTracer} for the client-side.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
import static com.google.common.base.Preconditions.checkArgument;
2020

2121
import com.google.common.annotations.VisibleForTesting;
22-
import com.google.errorprone.annotations.ThreadSafe;
2322
import java.util.concurrent.ConcurrentHashMap;
2423
import java.util.concurrent.ConcurrentMap;
2524
import javax.annotation.Nullable;
25+
import javax.annotation.concurrent.ThreadSafe;
2626

2727
/**
2828
* Encloses classes related to the compression and decompression of messages.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
import static com.google.common.base.Preconditions.checkNotNull;
2121

2222
import com.google.common.base.Joiner;
23-
import com.google.errorprone.annotations.ThreadSafe;
2423
import java.nio.charset.Charset;
2524
import java.util.Collections;
2625
import java.util.HashSet;
2726
import java.util.LinkedHashMap;
2827
import java.util.Map;
2928
import java.util.Set;
3029
import javax.annotation.Nullable;
30+
import javax.annotation.concurrent.ThreadSafe;
3131

3232
/**
3333
* Encloses classes related to the compression and decompression of messages.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
package io.grpc;
1818

19-
import com.google.errorprone.annotations.ThreadSafe;
2019
import java.util.Collections;
2120
import java.util.List;
2221
import javax.annotation.Nullable;
22+
import javax.annotation.concurrent.ThreadSafe;
2323

2424
/**
2525
* Registry of services and their methods used by servers to dispatching incoming calls.

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.google.common.base.MoreObjects;
2323
import com.google.common.base.Objects;
2424
import com.google.common.base.Preconditions;
25-
import com.google.errorprone.annotations.ThreadSafe;
2625
import java.util.ArrayList;
2726
import java.util.Arrays;
2827
import java.util.Collections;
@@ -33,6 +32,7 @@
3332
import javax.annotation.Nullable;
3433
import javax.annotation.concurrent.Immutable;
3534
import javax.annotation.concurrent.NotThreadSafe;
35+
import javax.annotation.concurrent.ThreadSafe;
3636

3737
/**
3838
* A pluggable component that receives resolved addresses from {@link NameResolver} and provides the
@@ -64,7 +64,7 @@
6464
* allows implementations to schedule tasks to be run in the same Synchronization Context, with or
6565
* without a delay, thus those tasks don't need to worry about synchronizing with the balancer
6666
* methods.
67-
*
67+
*
6868
* <p>However, the actual running thread may be the network thread, thus the following rules must be
6969
* followed to prevent blocking or even dead-locking in a network:
7070
*
@@ -417,7 +417,7 @@ public void handleSubchannelState(
417417
*
418418
* <p>This method should always return a constant value. It's not specified when this will be
419419
* called.
420-
*
420+
*
421421
* <p>Note that this method is only called when implementing {@code handleResolvedAddresses()}
422422
* instead of {@code acceptResolvedAddresses()}.
423423
*
@@ -640,7 +640,7 @@ private PickResult(
640640
* stream is created at all in some cases.
641641
* @since 1.3.0
642642
*/
643-
// TODO(shivaspeaks): Need to deprecate old APIs and create new ones,
643+
// TODO(shivaspeaks): Need to deprecate old APIs and create new ones,
644644
// per https://github.com/grpc/grpc-java/issues/12662.
645645
public static PickResult withSubchannel(
646646
Subchannel subchannel, @Nullable ClientStreamTracer.Factory streamTracerFactory) {
@@ -1332,7 +1332,7 @@ public MetricRecorder getMetricRecorder() {
13321332
}
13331333

13341334
/**
1335-
* A logical connection to a server, or a group of equivalent servers represented by an {@link
1335+
* A logical connection to a server, or a group of equivalent servers represented by an {@link
13361336
* EquivalentAddressGroup}.
13371337
*
13381338
* <p>It maintains at most one physical connection (aka transport) for sending new RPCs, while

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import static com.google.common.base.Preconditions.checkNotNull;
2121

2222
import com.google.common.annotations.VisibleForTesting;
23-
import com.google.errorprone.annotations.ThreadSafe;
2423
import java.util.ArrayList;
2524
import java.util.Collections;
2625
import java.util.LinkedHashMap;
@@ -31,6 +30,7 @@
3130
import java.util.logging.Level;
3231
import java.util.logging.Logger;
3332
import javax.annotation.Nullable;
33+
import javax.annotation.concurrent.ThreadSafe;
3434

3535
/**
3636
* Registry of {@link LoadBalancerProvider}s. The {@link #getDefaultRegistry default instance}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package io.grpc;
1818

19-
import com.google.errorprone.annotations.ThreadSafe;
2019
import java.util.concurrent.TimeUnit;
20+
import javax.annotation.concurrent.ThreadSafe;
2121

2222
/**
2323
* A {@link Channel} that provides lifecycle management.

0 commit comments

Comments
 (0)