mirror of https://github.com/grpc/grpc-java.git
testing: minor lint-suggested improvements (#9259)
Use for-each and Lists.reverse() instead of classic for
This commit is contained in:
parent
9cebe0aa2b
commit
a4a67b7fc7
|
|
@ -22,6 +22,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.base.Stopwatch;
|
import com.google.common.base.Stopwatch;
|
||||||
import com.google.common.base.Ticker;
|
import com.google.common.base.Ticker;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import io.grpc.ExperimentalApi;
|
import io.grpc.ExperimentalApi;
|
||||||
import io.grpc.ManagedChannel;
|
import io.grpc.ManagedChannel;
|
||||||
import io.grpc.Server;
|
import io.grpc.Server;
|
||||||
|
|
@ -170,8 +171,8 @@ public final class GrpcCleanupRule extends ExternalResource {
|
||||||
|
|
||||||
InterruptedException interrupted = null;
|
InterruptedException interrupted = null;
|
||||||
if (!abruptShutdown) {
|
if (!abruptShutdown) {
|
||||||
for (int i = resources.size() - 1; i >= 0; i--) {
|
for (Resource resource : Lists.reverse(resources)) {
|
||||||
resources.get(i).cleanUp();
|
resource.cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = resources.size() - 1; i >= 0; i--) {
|
for (int i = resources.size() - 1; i >= 0; i--) {
|
||||||
|
|
@ -190,8 +191,8 @@ public final class GrpcCleanupRule extends ExternalResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!resources.isEmpty()) {
|
if (!resources.isEmpty()) {
|
||||||
for (int i = resources.size() - 1; i >= 0; i--) {
|
for (Resource resource : Lists.reverse(resources)) {
|
||||||
resources.get(i).forceCleanUp();
|
resource.forceCleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue