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