mirror of https://github.com/grpc/grpc-java.git
Lint fixes
This commit is contained in:
parent
7af2373a03
commit
3002a23a0f
|
|
@ -33,7 +33,6 @@ import java.nio.ByteBuffer;
|
|||
import java.security.GeneralSecurityException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
|
|
|||
|
|
@ -23,11 +23,9 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.logging.Logger;
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
public final class Channelz {
|
||||
private static final Logger log = Logger.getLogger(Channelz.class.getName());
|
||||
private static final Channelz INSTANCE = new Channelz();
|
||||
|
||||
private final ConcurrentMap<Long, Instrumented<ServerStats>> servers =
|
||||
|
|
|
|||
|
|
@ -148,15 +148,14 @@ final class ManagedChannelOrphanWrapper extends ForwardingManagedChannel {
|
|||
orphanedChannels++;
|
||||
Level level = ref.shutdownNow ? Level.FINE : Level.SEVERE;
|
||||
if (logger.isLoggable(level)) {
|
||||
String fmt = new StringBuilder()
|
||||
.append("*~*~*~ Channel {0} was not ")
|
||||
String fmt =
|
||||
"*~*~*~ Channel {0} was not "
|
||||
// Prefer to complain about shutdown if neither has been called.
|
||||
.append(!ref.shutdown ? "shutdown" : "terminated")
|
||||
.append(" properly!!! ~*~*~*")
|
||||
.append(System.getProperty("line.separator"))
|
||||
.append(" Make sure to call shutdown()/shutdownNow() and wait "
|
||||
+ "until awaitTermination() returns true.")
|
||||
.toString();
|
||||
+ (!ref.shutdown ? "shutdown" : "terminated")
|
||||
+ " properly!!! ~*~*~*"
|
||||
+ System.getProperty("line.separator")
|
||||
+ " Make sure to call shutdown()/shutdownNow() and wait "
|
||||
+ "until awaitTermination() returns true.";
|
||||
LogRecord lr = new LogRecord(level, fmt);
|
||||
lr.setLoggerName(logger.getName());
|
||||
lr.setParameters(new Object[]{ref.channel.toString()});
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ public class BinaryLogProviderTest {
|
|||
}
|
||||
};
|
||||
Channel wChannel = binlogProvider.wrapChannel(channel);
|
||||
ClientCall<String, Integer> ignoredClientCall = wChannel.newCall(method, CallOptions.DEFAULT);
|
||||
ClientCall<String, Integer> unusedClientCall = wChannel.newCall(method, CallOptions.DEFAULT);
|
||||
validateWrappedMethod(methodRef.get());
|
||||
}
|
||||
|
||||
|
|
@ -486,4 +486,4 @@ public class BinaryLogProviderTest {
|
|||
return delegate().parse(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,7 +235,6 @@ public class ServerCallImplTest {
|
|||
serverCall.sendMessage(1L);
|
||||
verify(stream, times(1)).writeMessage(any(InputStream.class));
|
||||
ArgumentCaptor<Status> statusCaptor = ArgumentCaptor.forClass(Status.class);
|
||||
ArgumentCaptor<Metadata> metadataCaptor = ArgumentCaptor.forClass(Metadata.class);
|
||||
verify(stream, times(1)).cancel(statusCaptor.capture());
|
||||
assertEquals(Status.Code.INTERNAL, statusCaptor.getValue().getCode());
|
||||
assertEquals(ServerCallImpl.TOO_MANY_RESPONSES, statusCaptor.getValue().getDescription());
|
||||
|
|
|
|||
|
|
@ -1420,13 +1420,6 @@ public class ServerImplTest {
|
|||
verifyNoMoreInteractions(executorPool);
|
||||
}
|
||||
|
||||
private void ensureServerStateNotLeaked() {
|
||||
verify(stream).close(statusCaptor.capture(), metadataCaptor.capture());
|
||||
assertEquals(Status.UNKNOWN, statusCaptor.getValue());
|
||||
assertNull(statusCaptor.getValue().getCause());
|
||||
assertTrue(metadataCaptor.getValue().keys().isEmpty());
|
||||
}
|
||||
|
||||
private void ensureServerStateIsCancelled() {
|
||||
verify(stream).cancel(statusCaptor.capture());
|
||||
assertEquals(Status.INTERNAL, statusCaptor.getValue());
|
||||
|
|
|
|||
Loading…
Reference in New Issue