Skip to content

Commit

Permalink
minor: remove the unnecessary final,static
Browse files Browse the repository at this point in the history
  • Loading branch information
laglangyue committed Apr 14, 2024
1 parent 497e155 commit c5abab9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion alts/src/main/java/io/grpc/alts/AltsChannelBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public final class AltsChannelBuilder extends ForwardingChannelBuilder2<AltsChan
new AltsChannelCredentials.Builder();

/** "Overrides" the static method in {@link ManagedChannelBuilder}. */
public static final AltsChannelBuilder forTarget(String target) {
public static AltsChannelBuilder forTarget(String target) {
return new AltsChannelBuilder(target);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private ComputeEngineChannelBuilder(String target) {
}

/** "Overrides" the static method in {@link ManagedChannelBuilder}. */
public static final ComputeEngineChannelBuilder forTarget(String target) {
public static ComputeEngineChannelBuilder forTarget(String target) {
return new ComputeEngineChannelBuilder(target);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private GoogleDefaultChannelBuilder(String target) {
}

/** "Overrides" the static method in {@link ManagedChannelBuilder}. */
public static final GoogleDefaultChannelBuilder forTarget(String target) {
public static GoogleDefaultChannelBuilder forTarget(String target) {
return new GoogleDefaultChannelBuilder(target);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@RunWith(JUnit4.class)
public class AltsHandshakerStubTest {
/** Mock status of handshaker service. */
private static enum Status {
private enum Status {
OK,
ERROR,
COMPLETE
Expand Down
2 changes: 1 addition & 1 deletion core/src/testFixtures/java/io/grpc/internal/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public Runnable answer(InvocationOnMock invocation) throws Throwable {
}

@SuppressWarnings("ReferenceEquality")
public static final EquivalentAddressGroup stripAttrs(EquivalentAddressGroup eag) {
public static EquivalentAddressGroup stripAttrs(EquivalentAddressGroup eag) {
if (eag.getAttributes() == Attributes.EMPTY) {
return eag;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,16 @@ public RouteGuideServer(ServerBuilder<?> serverBuilder, int port, Collection<Fea
public void start() throws IOException {
server.start();
logger.info("Server started, listening on " + port);
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
// Use stderr here since the logger may have been reset by its JVM shutdown hook.
System.err.println("*** shutting down gRPC server since JVM is shutting down");
try {
RouteGuideServer.this.stop();
} catch (InterruptedException e) {
e.printStackTrace(System.err);
}
System.err.println("*** server shut down");
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
// Use stderr here since the logger may have been reset by its JVM shutdown hook.
System.err.println("*** shutting down gRPC server since JVM is shutting down");
try {
RouteGuideServer.this.stop();
} catch (InterruptedException e) {
e.printStackTrace(System.err);
}
});
System.err.println("*** server shut down");
}));
}

/** Stop serving requests and shutdown resources. */
Expand Down Expand Up @@ -120,7 +117,7 @@ public static void main(String[] args) throws Exception {
private static class RouteGuideService extends RouteGuideGrpc.RouteGuideImplBase {
private final Collection<Feature> features;
private final ConcurrentMap<Point, List<RouteNote>> routeNotes =
new ConcurrentHashMap<Point, List<RouteNote>>();
new ConcurrentHashMap<>();

RouteGuideService(Collection<Feature> features) {
this.features = features;
Expand Down Expand Up @@ -251,7 +248,7 @@ public void onCompleted() {
* Get the notes list for the given location. If missing, create it.
*/
private List<RouteNote> getOrCreateNotes(Point location) {
List<RouteNote> notes = Collections.synchronizedList(new ArrayList<RouteNote>());
List<RouteNote> notes = Collections.synchronizedList(new ArrayList<>());
List<RouteNote> prevNotes = routeNotes.putIfAbsent(location, notes);
return prevNotes != null ? prevNotes : notes;
}
Expand Down

0 comments on commit c5abab9

Please sign in to comment.