mirror of https://github.com/grpc/grpc-java.git
all: fix lint warnings and errors (#7150)
This commit is contained in:
parent
8fb6591850
commit
df54162ffd
|
|
@ -70,7 +70,7 @@ public class RetryingHelloWorldClient {
|
||||||
.usePlaintext();
|
.usePlaintext();
|
||||||
if (enableRetries) {
|
if (enableRetries) {
|
||||||
Map<String, ?> serviceConfig = getRetryingServiceConfig();
|
Map<String, ?> serviceConfig = getRetryingServiceConfig();
|
||||||
logger.info("Client started with retrying configuration: " + serviceConfig.toString());
|
logger.info("Client started with retrying configuration: " + serviceConfig);
|
||||||
channelBuilder.defaultServiceConfig(serviceConfig).enableRetry();
|
channelBuilder.defaultServiceConfig(serviceConfig).enableRetry();
|
||||||
}
|
}
|
||||||
channel = channelBuilder.build();
|
channel = channelBuilder.build();
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ import java.util.logging.Logger;
|
||||||
*/
|
*/
|
||||||
public class RetryingHelloWorldServer {
|
public class RetryingHelloWorldServer {
|
||||||
private static final Logger logger = Logger.getLogger(RetryingHelloWorldServer.class.getName());
|
private static final Logger logger = Logger.getLogger(RetryingHelloWorldServer.class.getName());
|
||||||
private static final float unavailablePercentage = 0.5F;
|
private static final float UNAVAILABLE_PERCENTAGE = 0.5F;
|
||||||
private static Random random = new Random();
|
private static final Random random = new Random();
|
||||||
|
|
||||||
private Server server;
|
private Server server;
|
||||||
|
|
||||||
|
|
@ -50,7 +50,7 @@ public class RetryingHelloWorldServer {
|
||||||
logger.info("Server started, listening on " + port);
|
logger.info("Server started, listening on " + port);
|
||||||
|
|
||||||
DecimalFormat df = new DecimalFormat("#%");
|
DecimalFormat df = new DecimalFormat("#%");
|
||||||
logger.info("Responding as UNAVAILABLE to " + df.format(unavailablePercentage) + " requests");
|
logger.info("Responding as UNAVAILABLE to " + df.format(UNAVAILABLE_PERCENTAGE) + " requests");
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
@ -96,7 +96,7 @@ public class RetryingHelloWorldServer {
|
||||||
@Override
|
@Override
|
||||||
public void sayHello(HelloRequest request, StreamObserver<HelloReply> responseObserver) {
|
public void sayHello(HelloRequest request, StreamObserver<HelloReply> responseObserver) {
|
||||||
int count = retryCounter.incrementAndGet();
|
int count = retryCounter.incrementAndGet();
|
||||||
if (random.nextFloat() < unavailablePercentage) {
|
if (random.nextFloat() < UNAVAILABLE_PERCENTAGE) {
|
||||||
logger.info("Returning stubbed UNAVAILABLE error. count: " + count);
|
logger.info("Returning stubbed UNAVAILABLE error. count: " + count);
|
||||||
responseObserver.onError(Status.UNAVAILABLE
|
responseObserver.onError(Status.UNAVAILABLE
|
||||||
.withDescription("Greeter temporarily unavailable...").asRuntimeException());
|
.withDescription("Greeter temporarily unavailable...").asRuntimeException());
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ public final class EnvoyServerProtoData {
|
||||||
public abstract static class BaseTlsContext {
|
public abstract static class BaseTlsContext {
|
||||||
@Nullable protected final CommonTlsContext commonTlsContext;
|
@Nullable protected final CommonTlsContext commonTlsContext;
|
||||||
|
|
||||||
public BaseTlsContext(@Nullable CommonTlsContext commonTlsContext) {
|
protected BaseTlsContext(@Nullable CommonTlsContext commonTlsContext) {
|
||||||
this.commonTlsContext = commonTlsContext;
|
this.commonTlsContext = commonTlsContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@ public final class EnvoyServerProtoData {
|
||||||
if (this == o) {
|
if (this == o) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (o == null || !(o instanceof BaseTlsContext)) {
|
if (!(o instanceof BaseTlsContext)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
BaseTlsContext that = (BaseTlsContext) o;
|
BaseTlsContext that = (BaseTlsContext) o;
|
||||||
|
|
@ -63,7 +63,7 @@ public final class EnvoyServerProtoData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(commonTlsContext);
|
return Objects.hashCode(commonTlsContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,11 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.JUnit4;
|
||||||
|
|
||||||
/** Tests for {@link RouteMatch}. */
|
/** Tests for {@link RouteMatch}. */
|
||||||
|
@RunWith(JUnit4.class)
|
||||||
public class RouteMatchTest {
|
public class RouteMatchTest {
|
||||||
|
|
||||||
private final Map<String, Set<String>> headers = new HashMap<>();
|
private final Map<String, Set<String>> headers = new HashMap<>();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue