mirror of https://github.com/grpc/grpc-java.git
all: use Java7 brackets
This commit is contained in:
parent
6cf849a7ce
commit
b0f423295b
|
@ -36,7 +36,7 @@ public final class AltsClientOptions extends AltsHandshakerOptions {
|
||||||
super(builder.rpcProtocolVersions);
|
super(builder.rpcProtocolVersions);
|
||||||
targetName = builder.targetName;
|
targetName = builder.targetName;
|
||||||
targetServiceAccounts =
|
targetServiceAccounts =
|
||||||
Collections.unmodifiableList(new ArrayList<String>(builder.targetServiceAccounts));
|
Collections.unmodifiableList(new ArrayList<>(builder.targetServiceAccounts));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTargetName() {
|
public String getTargetName() {
|
||||||
|
@ -51,7 +51,7 @@ public final class AltsClientOptions extends AltsHandshakerOptions {
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
@Nullable private String targetName;
|
@Nullable private String targetName;
|
||||||
@Nullable private RpcProtocolVersions rpcProtocolVersions;
|
@Nullable private RpcProtocolVersions rpcProtocolVersions;
|
||||||
private ArrayList<String> targetServiceAccounts = new ArrayList<String>();
|
private ArrayList<String> targetServiceAccounts = new ArrayList<>();
|
||||||
|
|
||||||
public Builder setTargetName(String targetName) {
|
public Builder setTargetName(String targetName) {
|
||||||
this.targetName = targetName;
|
this.targetName = targetName;
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class AltsTsiFrameProtectorTest {
|
||||||
private static final int FRAME_MIN_SIZE =
|
private static final int FRAME_MIN_SIZE =
|
||||||
AltsTsiFrameProtector.getHeaderTypeFieldBytes() + FakeChannelCrypter.getTagBytes();
|
AltsTsiFrameProtector.getHeaderTypeFieldBytes() + FakeChannelCrypter.getTagBytes();
|
||||||
|
|
||||||
private final List<ReferenceCounted> references = new ArrayList<ReferenceCounted>();
|
private final List<ReferenceCounted> references = new ArrayList<>();
|
||||||
private final RegisterRef ref =
|
private final RegisterRef ref =
|
||||||
new RegisterRef() {
|
new RegisterRef() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -127,7 +127,7 @@ public class InteropInstrumentationTest {
|
||||||
new InteropTask(
|
new InteropTask(
|
||||||
listener,
|
listener,
|
||||||
TesterOkHttpChannelBuilder.build(host, port, serverHostOverride, useTls, testCa),
|
TesterOkHttpChannelBuilder.build(host, port, serverHostOverride, useTls, testCa),
|
||||||
new ArrayList<ClientInterceptor>(),
|
new ArrayList<>(),
|
||||||
testCase)
|
testCase)
|
||||||
.execute();
|
.execute();
|
||||||
String result = resultFuture.get(TIMEOUT_SECONDS, TimeUnit.SECONDS);
|
String result = resultFuture.get(TIMEOUT_SECONDS, TimeUnit.SECONDS);
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class TesterActivity extends AppCompatActivity
|
||||||
ManagedChannel channel =
|
ManagedChannel channel =
|
||||||
TesterOkHttpChannelBuilder.build(host, port, serverHostOverride, true, testCert);
|
TesterOkHttpChannelBuilder.build(host, port, serverHostOverride, true, testCert);
|
||||||
|
|
||||||
List<ClientInterceptor> interceptors = new ArrayList<ClientInterceptor>();
|
List<ClientInterceptor> interceptors = new ArrayList<>();
|
||||||
if (getCheckBox.isChecked()) {
|
if (getCheckBox.isChecked()) {
|
||||||
interceptors.add(new SafeMethodChannelInterceptor());
|
interceptors.add(new SafeMethodChannelInterceptor());
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class GoogleAuthLibraryCallCredentialsTest {
|
||||||
.set(CallCredentials.ATTR_SECURITY_LEVEL, SecurityLevel.PRIVACY_AND_INTEGRITY)
|
.set(CallCredentials.ATTR_SECURITY_LEVEL, SecurityLevel.PRIVACY_AND_INTEGRITY)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
private ArrayList<Runnable> pendingRunnables = new ArrayList<Runnable>();
|
private ArrayList<Runnable> pendingRunnables = new ArrayList<>();
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
@ -424,7 +424,7 @@ public class GoogleAuthLibraryCallCredentialsTest {
|
||||||
|
|
||||||
private int runPendingRunnables() {
|
private int runPendingRunnables() {
|
||||||
ArrayList<Runnable> savedPendingRunnables = pendingRunnables;
|
ArrayList<Runnable> savedPendingRunnables = pendingRunnables;
|
||||||
pendingRunnables = new ArrayList<Runnable>();
|
pendingRunnables = new ArrayList<>();
|
||||||
for (Runnable r : savedPendingRunnables) {
|
for (Runnable r : savedPendingRunnables) {
|
||||||
r.run();
|
r.run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class HandlerRegistryBenchmark {
|
||||||
@Setup(Level.Trial)
|
@Setup(Level.Trial)
|
||||||
public void setup() throws Exception {
|
public void setup() throws Exception {
|
||||||
registry = new MutableHandlerRegistry();
|
registry = new MutableHandlerRegistry();
|
||||||
fullMethodNames = new ArrayList<String>(serviceCount * methodCountPerService);
|
fullMethodNames = new ArrayList<>(serviceCount * methodCountPerService);
|
||||||
for (int serviceIndex = 0; serviceIndex < serviceCount; ++serviceIndex) {
|
for (int serviceIndex = 0; serviceIndex < serviceCount; ++serviceIndex) {
|
||||||
String serviceName = randomString();
|
String serviceName = randomString();
|
||||||
ServerServiceDefinition.Builder serviceBuilder = ServerServiceDefinition.builder(serviceName);
|
ServerServiceDefinition.Builder serviceBuilder = ServerServiceDefinition.builder(serviceName);
|
||||||
|
|
|
@ -149,7 +149,7 @@ public abstract class AbstractConfigurationBuilder<T extends Configuration>
|
||||||
public final void printUsage() {
|
public final void printUsage() {
|
||||||
System.out.println("Usage: [ARGS...]");
|
System.out.println("Usage: [ARGS...]");
|
||||||
int column1Width = 0;
|
int column1Width = 0;
|
||||||
List<Param> params = new ArrayList<Param>();
|
List<Param> params = new ArrayList<>();
|
||||||
params.add(HELP);
|
params.add(HELP);
|
||||||
params.addAll(getParams());
|
params.addAll(getParams());
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class AsyncClient {
|
||||||
|
|
||||||
SimpleRequest req = newRequest();
|
SimpleRequest req = newRequest();
|
||||||
|
|
||||||
List<ManagedChannel> channels = new ArrayList<ManagedChannel>(config.channels);
|
List<ManagedChannel> channels = new ArrayList<>(config.channels);
|
||||||
for (int i = 0; i < config.channels; i++) {
|
for (int i = 0; i < config.channels; i++) {
|
||||||
channels.add(config.newChannel());
|
channels.add(config.newChannel());
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ public class AsyncClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Wait for completion
|
// Wait for completion
|
||||||
List<Histogram> histograms = new ArrayList<Histogram>(futures.size());
|
List<Histogram> histograms = new ArrayList<>(futures.size());
|
||||||
for (Future<Histogram> future : futures) {
|
for (Future<Histogram> future : futures) {
|
||||||
histograms.add(future.get());
|
histograms.add(future.get());
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class ReadBenchmark {
|
||||||
@State(Scope.Benchmark)
|
@State(Scope.Benchmark)
|
||||||
public static class ContextState {
|
public static class ContextState {
|
||||||
List<Context.Key<Object>> keys = new ArrayList<Context.Key<Object>>();
|
List<Context.Key<Object>> keys = new ArrayList<Context.Key<Object>>();
|
||||||
List<Context> contexts = new ArrayList<Context>();
|
List<Context> contexts = new ArrayList<>();
|
||||||
|
|
||||||
@Setup
|
@Setup
|
||||||
public void setup() {
|
public void setup() {
|
||||||
|
|
|
@ -471,7 +471,7 @@ public class Context {
|
||||||
if (listeners == null) {
|
if (listeners == null) {
|
||||||
// Now that we have a listener we need to listen to our parent so
|
// Now that we have a listener we need to listen to our parent so
|
||||||
// we can cascade listener notification.
|
// we can cascade listener notification.
|
||||||
listeners = new ArrayList<ExecutableListener>();
|
listeners = new ArrayList<>();
|
||||||
listeners.add(executableListener);
|
listeners.add(executableListener);
|
||||||
if (cancellableAncestor != null) {
|
if (cancellableAncestor != null) {
|
||||||
cancellableAncestor.addListener(parentListener, DirectExecutor.INSTANCE);
|
cancellableAncestor.addListener(parentListener, DirectExecutor.INSTANCE);
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class ClientInterceptors {
|
||||||
*/
|
*/
|
||||||
public static Channel interceptForward(Channel channel,
|
public static Channel interceptForward(Channel channel,
|
||||||
List<? extends ClientInterceptor> interceptors) {
|
List<? extends ClientInterceptor> interceptors) {
|
||||||
List<? extends ClientInterceptor> copy = new ArrayList<ClientInterceptor>(interceptors);
|
List<? extends ClientInterceptor> copy = new ArrayList<>(interceptors);
|
||||||
Collections.reverse(copy);
|
Collections.reverse(copy);
|
||||||
return intercept(channel, copy);
|
return intercept(channel, copy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public final class EquivalentAddressGroup {
|
||||||
*/
|
*/
|
||||||
public EquivalentAddressGroup(List<SocketAddress> addrs, Attributes attrs) {
|
public EquivalentAddressGroup(List<SocketAddress> addrs, Attributes attrs) {
|
||||||
Preconditions.checkArgument(!addrs.isEmpty(), "addrs is empty");
|
Preconditions.checkArgument(!addrs.isEmpty(), "addrs is empty");
|
||||||
this.addrs = Collections.unmodifiableList(new ArrayList<SocketAddress>(addrs));
|
this.addrs = Collections.unmodifiableList(new ArrayList<>(addrs));
|
||||||
this.attrs = Preconditions.checkNotNull(attrs, "attrs");
|
this.attrs = Preconditions.checkNotNull(attrs, "attrs");
|
||||||
// Attributes may contain mutable objects, which means Attributes' hashCode may change over
|
// Attributes may contain mutable objects, which means Attributes' hashCode may change over
|
||||||
// time, thus we don't cache Attributes' hashCode.
|
// time, thus we don't cache Attributes' hashCode.
|
||||||
|
|
|
@ -186,7 +186,7 @@ public final class InternalChannelz {
|
||||||
if (serverSockets == null) {
|
if (serverSockets == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<InternalWithLogId> socketList = new ArrayList<InternalWithLogId>(maxPageSize);
|
List<InternalWithLogId> socketList = new ArrayList<>(maxPageSize);
|
||||||
Iterator<InternalInstrumented<SocketStats>> iterator
|
Iterator<InternalInstrumented<SocketStats>> iterator
|
||||||
= serverSockets.tailMap(fromId).values().iterator();
|
= serverSockets.tailMap(fromId).values().iterator();
|
||||||
while (socketList.size() < maxPageSize && iterator.hasNext()) {
|
while (socketList.size() < maxPageSize && iterator.hasNext()) {
|
||||||
|
@ -504,7 +504,7 @@ public final class InternalChannelz {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setEvents(List<Event> events) {
|
public Builder setEvents(List<Event> events) {
|
||||||
this.events = Collections.unmodifiableList(new ArrayList<Event>(events));
|
this.events = Collections.unmodifiableList(new ArrayList<>(events));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ public abstract class NameResolverProvider extends NameResolver.Factory {
|
||||||
private final List<NameResolverProvider> providers;
|
private final List<NameResolverProvider> providers;
|
||||||
|
|
||||||
NameResolverFactory(List<NameResolverProvider> providers) {
|
NameResolverFactory(List<NameResolverProvider> providers) {
|
||||||
this.providers = Collections.unmodifiableList(new ArrayList<NameResolverProvider>(providers));
|
this.providers = Collections.unmodifiableList(new ArrayList<>(providers));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -62,7 +62,7 @@ public final class ServerInterceptors {
|
||||||
public static ServerServiceDefinition interceptForward(
|
public static ServerServiceDefinition interceptForward(
|
||||||
ServerServiceDefinition serviceDef,
|
ServerServiceDefinition serviceDef,
|
||||||
List<? extends ServerInterceptor> interceptors) {
|
List<? extends ServerInterceptor> interceptors) {
|
||||||
List<? extends ServerInterceptor> copy = new ArrayList<ServerInterceptor>(interceptors);
|
List<? extends ServerInterceptor> copy = new ArrayList<>(interceptors);
|
||||||
Collections.reverse(copy);
|
Collections.reverse(copy);
|
||||||
return intercept(serviceDef, copy);
|
return intercept(serviceDef, copy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ final class ServiceProviders {
|
||||||
} else {
|
} else {
|
||||||
candidates = getCandidatesViaServiceLoader(klass, cl);
|
candidates = getCandidatesViaServiceLoader(klass, cl);
|
||||||
}
|
}
|
||||||
List<T> list = new ArrayList<T>();
|
List<T> list = new ArrayList<>();
|
||||||
for (T current: candidates) {
|
for (T current: candidates) {
|
||||||
if (!priorityAccessor.isAvailable(current)) {
|
if (!priorityAccessor.isAvailable(current)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -115,7 +115,7 @@ final class ServiceProviders {
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static <T> Iterable<T> getCandidatesViaHardCoded(Class<T> klass, Iterable<Class<?>> hardcoded) {
|
static <T> Iterable<T> getCandidatesViaHardCoded(Class<T> klass, Iterable<Class<?>> hardcoded) {
|
||||||
List<T> list = new ArrayList<T>();
|
List<T> list = new ArrayList<>();
|
||||||
for (Class<?> candidate : hardcoded) {
|
for (Class<?> candidate : hardcoded) {
|
||||||
list.add(create(klass, candidate));
|
list.add(create(klass, candidate));
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,7 @@ public final class Status {
|
||||||
+ replaced.getCode().name() + " & " + code.name());
|
+ replaced.getCode().name() + " & " + code.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Collections.unmodifiableList(new ArrayList<Status>(canonicalizer.values()));
|
return Collections.unmodifiableList(new ArrayList<>(canonicalizer.values()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// A pseudo-enum of Status instances mapped 1:1 with values in Code. This simplifies construction
|
// A pseudo-enum of Status instances mapped 1:1 with values in Code. This simplifies construction
|
||||||
|
|
|
@ -207,7 +207,7 @@ final class InProcessTransport implements ServerTransport, ConnectionClientTrans
|
||||||
if (terminated) {
|
if (terminated) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
streamsCopy = new ArrayList<InProcessStream>(streams);
|
streamsCopy = new ArrayList<>(streams);
|
||||||
}
|
}
|
||||||
for (InProcessStream stream : streamsCopy) {
|
for (InProcessStream stream : streamsCopy) {
|
||||||
stream.clientStream.cancel(reason);
|
stream.clientStream.cancel(reason);
|
||||||
|
|
|
@ -97,7 +97,7 @@ public abstract class AbstractManagedChannelImplBuilder
|
||||||
|
|
||||||
ObjectPool<? extends Executor> executorPool = DEFAULT_EXECUTOR_POOL;
|
ObjectPool<? extends Executor> executorPool = DEFAULT_EXECUTOR_POOL;
|
||||||
|
|
||||||
private final List<ClientInterceptor> interceptors = new ArrayList<ClientInterceptor>();
|
private final List<ClientInterceptor> interceptors = new ArrayList<>();
|
||||||
|
|
||||||
// Access via getter, which may perform authority override as needed
|
// Access via getter, which may perform authority override as needed
|
||||||
private NameResolver.Factory nameResolverFactory = DEFAULT_NAME_RESOLVER_FACTORY;
|
private NameResolver.Factory nameResolverFactory = DEFAULT_NAME_RESOLVER_FACTORY;
|
||||||
|
@ -418,7 +418,7 @@ public abstract class AbstractManagedChannelImplBuilder
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
final List<ClientInterceptor> getEffectiveInterceptors() {
|
final List<ClientInterceptor> getEffectiveInterceptors() {
|
||||||
List<ClientInterceptor> effectiveInterceptors =
|
List<ClientInterceptor> effectiveInterceptors =
|
||||||
new ArrayList<ClientInterceptor>(this.interceptors);
|
new ArrayList<>(this.interceptors);
|
||||||
temporarilyDisableRetry = false;
|
temporarilyDisableRetry = false;
|
||||||
if (statsEnabled) {
|
if (statsEnabled) {
|
||||||
temporarilyDisableRetry = true;
|
temporarilyDisableRetry = true;
|
||||||
|
|
|
@ -82,12 +82,12 @@ public abstract class AbstractServerImplBuilder<T extends AbstractServerImplBuil
|
||||||
new InternalHandlerRegistry.Builder();
|
new InternalHandlerRegistry.Builder();
|
||||||
|
|
||||||
final List<ServerTransportFilter> transportFilters =
|
final List<ServerTransportFilter> transportFilters =
|
||||||
new ArrayList<ServerTransportFilter>();
|
new ArrayList<>();
|
||||||
|
|
||||||
final List<ServerInterceptor> interceptors = new ArrayList<ServerInterceptor>();
|
final List<ServerInterceptor> interceptors = new ArrayList<>();
|
||||||
|
|
||||||
private final List<InternalNotifyOnServerBuild> notifyOnBuildList =
|
private final List<InternalNotifyOnServerBuild> notifyOnBuildList =
|
||||||
new ArrayList<InternalNotifyOnServerBuild>();
|
new ArrayList<>();
|
||||||
|
|
||||||
private final List<ServerStreamTracer.Factory> streamTracerFactories =
|
private final List<ServerStreamTracer.Factory> streamTracerFactories =
|
||||||
new ArrayList<ServerStreamTracer.Factory>();
|
new ArrayList<ServerStreamTracer.Factory>();
|
||||||
|
|
|
@ -82,7 +82,7 @@ final class ChannelTracer {
|
||||||
int eventsLoggedSnapshot;
|
int eventsLoggedSnapshot;
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
eventsLoggedSnapshot = eventsLogged;
|
eventsLoggedSnapshot = eventsLogged;
|
||||||
eventsSnapshot = new ArrayList<Event>(events);
|
eventsSnapshot = new ArrayList<>(events);
|
||||||
}
|
}
|
||||||
builder.setChannelTrace(new ChannelTrace.Builder()
|
builder.setChannelTrace(new ChannelTrace.Builder()
|
||||||
.setNumEventsLogged(eventsLoggedSnapshot)
|
.setNumEventsLogged(eventsLoggedSnapshot)
|
||||||
|
|
|
@ -33,7 +33,7 @@ import javax.annotation.concurrent.NotThreadSafe;
|
||||||
*/
|
*/
|
||||||
@NotThreadSafe
|
@NotThreadSafe
|
||||||
final class ConnectivityStateManager {
|
final class ConnectivityStateManager {
|
||||||
private ArrayList<Listener> listeners = new ArrayList<Listener>();
|
private ArrayList<Listener> listeners = new ArrayList<>();
|
||||||
|
|
||||||
private volatile ConnectivityState state = ConnectivityState.IDLE;
|
private volatile ConnectivityState state = ConnectivityState.IDLE;
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ final class ConnectivityStateManager {
|
||||||
// Swap out callback list before calling them, because a callback may register new callbacks,
|
// Swap out callback list before calling them, because a callback may register new callbacks,
|
||||||
// if run in direct executor, can cause ConcurrentModificationException.
|
// if run in direct executor, can cause ConcurrentModificationException.
|
||||||
ArrayList<Listener> savedListeners = listeners;
|
ArrayList<Listener> savedListeners = listeners;
|
||||||
listeners = new ArrayList<Listener>();
|
listeners = new ArrayList<>();
|
||||||
for (Listener listener : savedListeners) {
|
for (Listener listener : savedListeners) {
|
||||||
listener.runInExecutor();
|
listener.runInExecutor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,9 +281,9 @@ final class DelayedClientTransport implements ManagedClientTransport {
|
||||||
if (picker == null || !hasPendingStreams()) {
|
if (picker == null || !hasPendingStreams()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
toProcess = new ArrayList<PendingStream>(pendingStreams);
|
toProcess = new ArrayList<>(pendingStreams);
|
||||||
}
|
}
|
||||||
ArrayList<PendingStream> toRemove = new ArrayList<PendingStream>();
|
ArrayList<PendingStream> toRemove = new ArrayList<>();
|
||||||
|
|
||||||
for (final PendingStream stream : toProcess) {
|
for (final PendingStream stream : toProcess) {
|
||||||
PickResult pickResult = picker.pickSubchannel(stream.args);
|
PickResult pickResult = picker.pickSubchannel(stream.args);
|
||||||
|
|
|
@ -52,7 +52,7 @@ class DelayedStream implements ClientStream {
|
||||||
@GuardedBy("this")
|
@GuardedBy("this")
|
||||||
private Status error;
|
private Status error;
|
||||||
@GuardedBy("this")
|
@GuardedBy("this")
|
||||||
private List<Runnable> pendingCalls = new ArrayList<Runnable>();
|
private List<Runnable> pendingCalls = new ArrayList<>();
|
||||||
@GuardedBy("this")
|
@GuardedBy("this")
|
||||||
private DelayedStreamListener delayedListener;
|
private DelayedStreamListener delayedListener;
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ class DelayedStream implements ClientStream {
|
||||||
private void drainPendingCalls() {
|
private void drainPendingCalls() {
|
||||||
assert realStream != null;
|
assert realStream != null;
|
||||||
assert !passThrough;
|
assert !passThrough;
|
||||||
List<Runnable> toRun = new ArrayList<Runnable>();
|
List<Runnable> toRun = new ArrayList<>();
|
||||||
DelayedStreamListener delayedListener = null;
|
DelayedStreamListener delayedListener = null;
|
||||||
while (true) {
|
while (true) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
@ -367,7 +367,7 @@ class DelayedStream implements ClientStream {
|
||||||
private final ClientStreamListener realListener;
|
private final ClientStreamListener realListener;
|
||||||
private volatile boolean passThrough;
|
private volatile boolean passThrough;
|
||||||
@GuardedBy("this")
|
@GuardedBy("this")
|
||||||
private List<Runnable> pendingCallbacks = new ArrayList<Runnable>();
|
private List<Runnable> pendingCallbacks = new ArrayList<>();
|
||||||
|
|
||||||
public DelayedStreamListener(ClientStreamListener listener) {
|
public DelayedStreamListener(ClientStreamListener listener) {
|
||||||
this.realListener = listener;
|
this.realListener = listener;
|
||||||
|
@ -445,7 +445,7 @@ class DelayedStream implements ClientStream {
|
||||||
|
|
||||||
public void drainPendingCallbacks() {
|
public void drainPendingCallbacks() {
|
||||||
assert !passThrough;
|
assert !passThrough;
|
||||||
List<Runnable> toRun = new ArrayList<Runnable>();
|
List<Runnable> toRun = new ArrayList<>();
|
||||||
while (true) {
|
while (true) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (pendingCallbacks.isEmpty()) {
|
if (pendingCallbacks.isEmpty()) {
|
||||||
|
|
|
@ -244,7 +244,7 @@ final class DnsNameResolver extends NameResolver {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Each address forms an EAG
|
// Each address forms an EAG
|
||||||
List<EquivalentAddressGroup> servers = new ArrayList<EquivalentAddressGroup>();
|
List<EquivalentAddressGroup> servers = new ArrayList<>();
|
||||||
for (InetAddress inetAddr : resolutionResults.addresses) {
|
for (InetAddress inetAddr : resolutionResults.addresses) {
|
||||||
servers.add(new EquivalentAddressGroup(new InetSocketAddress(inetAddr, port)));
|
servers.add(new EquivalentAddressGroup(new InetSocketAddress(inetAddr, port)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ final class InternalHandlerRegistry extends HandlerRegistry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new InternalHandlerRegistry(
|
return new InternalHandlerRegistry(
|
||||||
Collections.unmodifiableList(new ArrayList<ServerServiceDefinition>(services.values())),
|
Collections.unmodifiableList(new ArrayList<>(services.values())),
|
||||||
Collections.unmodifiableMap(map));
|
Collections.unmodifiableMap(map));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,8 +125,7 @@ final class InternalSubchannel implements InternalInstrumented<ChannelStats> {
|
||||||
* also be present.
|
* also be present.
|
||||||
*/
|
*/
|
||||||
@GuardedBy("lock")
|
@GuardedBy("lock")
|
||||||
private final Collection<ConnectionClientTransport> transports =
|
private final Collection<ConnectionClientTransport> transports = new ArrayList<>();
|
||||||
new ArrayList<ConnectionClientTransport>();
|
|
||||||
|
|
||||||
// Must only be used from channelExecutor
|
// Must only be used from channelExecutor
|
||||||
private final InUseStateAggregator<ConnectionClientTransport> inUseStateAggregator =
|
private final InUseStateAggregator<ConnectionClientTransport> inUseStateAggregator =
|
||||||
|
@ -172,7 +171,7 @@ final class InternalSubchannel implements InternalInstrumented<ChannelStats> {
|
||||||
Preconditions.checkArgument(!addressGroups.isEmpty(), "addressGroups is empty");
|
Preconditions.checkArgument(!addressGroups.isEmpty(), "addressGroups is empty");
|
||||||
checkListHasNoNulls(addressGroups, "addressGroups contains null entry");
|
checkListHasNoNulls(addressGroups, "addressGroups contains null entry");
|
||||||
this.addressIndex = new Index(
|
this.addressIndex = new Index(
|
||||||
Collections.unmodifiableList(new ArrayList<EquivalentAddressGroup>(addressGroups)));
|
Collections.unmodifiableList(new ArrayList<>(addressGroups)));
|
||||||
this.authority = authority;
|
this.authority = authority;
|
||||||
this.userAgent = userAgent;
|
this.userAgent = userAgent;
|
||||||
this.backoffPolicyProvider = backoffPolicyProvider;
|
this.backoffPolicyProvider = backoffPolicyProvider;
|
||||||
|
@ -352,7 +351,7 @@ final class InternalSubchannel implements InternalInstrumented<ChannelStats> {
|
||||||
checkListHasNoNulls(newAddressGroups, "newAddressGroups contains null entry");
|
checkListHasNoNulls(newAddressGroups, "newAddressGroups contains null entry");
|
||||||
Preconditions.checkArgument(!newAddressGroups.isEmpty(), "newAddressGroups is empty");
|
Preconditions.checkArgument(!newAddressGroups.isEmpty(), "newAddressGroups is empty");
|
||||||
newAddressGroups =
|
newAddressGroups =
|
||||||
Collections.unmodifiableList(new ArrayList<EquivalentAddressGroup>(newAddressGroups));
|
Collections.unmodifiableList(new ArrayList<>(newAddressGroups));
|
||||||
ManagedClientTransport savedTransport = null;
|
ManagedClientTransport savedTransport = null;
|
||||||
try {
|
try {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
|
|
|
@ -116,7 +116,7 @@ final class JndiResourceResolverFactory implements DnsNameResolver.ResourceResol
|
||||||
Level.FINER, "Found {0} TXT records", new Object[]{serviceConfigRawTxtRecords.size()});
|
Level.FINER, "Found {0} TXT records", new Object[]{serviceConfigRawTxtRecords.size()});
|
||||||
}
|
}
|
||||||
List<String> serviceConfigTxtRecords =
|
List<String> serviceConfigTxtRecords =
|
||||||
new ArrayList<String>(serviceConfigRawTxtRecords.size());
|
new ArrayList<>(serviceConfigRawTxtRecords.size());
|
||||||
for (String serviceConfigRawTxtRecord : serviceConfigRawTxtRecords) {
|
for (String serviceConfigRawTxtRecord : serviceConfigRawTxtRecords) {
|
||||||
serviceConfigTxtRecords.add(unquote(serviceConfigRawTxtRecord));
|
serviceConfigTxtRecords.add(unquote(serviceConfigRawTxtRecord));
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ final class JndiResourceResolverFactory implements DnsNameResolver.ResourceResol
|
||||||
Level.FINER, "Found {0} SRV records", new Object[]{grpclbSrvRecords.size()});
|
Level.FINER, "Found {0} SRV records", new Object[]{grpclbSrvRecords.size()});
|
||||||
}
|
}
|
||||||
List<EquivalentAddressGroup> balancerAddresses =
|
List<EquivalentAddressGroup> balancerAddresses =
|
||||||
new ArrayList<EquivalentAddressGroup>(grpclbSrvRecords.size());
|
new ArrayList<>(grpclbSrvRecords.size());
|
||||||
Exception first = null;
|
Exception first = null;
|
||||||
Level level = Level.WARNING;
|
Level level = Level.WARNING;
|
||||||
for (String srvRecord : grpclbSrvRecords) {
|
for (String srvRecord : grpclbSrvRecords) {
|
||||||
|
@ -146,7 +146,7 @@ final class JndiResourceResolverFactory implements DnsNameResolver.ResourceResol
|
||||||
SrvRecord record = parseSrvRecord(srvRecord);
|
SrvRecord record = parseSrvRecord(srvRecord);
|
||||||
|
|
||||||
List<? extends InetAddress> addrs = addressResolver.resolveAddress(record.host);
|
List<? extends InetAddress> addrs = addressResolver.resolveAddress(record.host);
|
||||||
List<SocketAddress> sockaddrs = new ArrayList<SocketAddress>(addrs.size());
|
List<SocketAddress> sockaddrs = new ArrayList<>(addrs.size());
|
||||||
for (InetAddress addr : addrs) {
|
for (InetAddress addr : addrs) {
|
||||||
sockaddrs.add(new InetSocketAddress(addr, record.port));
|
sockaddrs.add(new InetSocketAddress(addr, record.port));
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ final class JndiResourceResolverFactory implements DnsNameResolver.ResourceResol
|
||||||
private static List<String> getAllRecords(String recordType, String name)
|
private static List<String> getAllRecords(String recordType, String name)
|
||||||
throws NamingException {
|
throws NamingException {
|
||||||
String[] rrType = new String[]{recordType};
|
String[] rrType = new String[]{recordType};
|
||||||
List<String> records = new ArrayList<String>();
|
List<String> records = new ArrayList<>();
|
||||||
|
|
||||||
@SuppressWarnings("JdkObsolete")
|
@SuppressWarnings("JdkObsolete")
|
||||||
Hashtable<String, String> env = new Hashtable<String, String>();
|
Hashtable<String, String> env = new Hashtable<String, String>();
|
||||||
|
|
|
@ -92,7 +92,7 @@ public final class JsonParser {
|
||||||
|
|
||||||
private static List<Object> parseJsonArray(JsonReader jr) throws IOException {
|
private static List<Object> parseJsonArray(JsonReader jr) throws IOException {
|
||||||
jr.beginArray();
|
jr.beginArray();
|
||||||
List<Object> array = new ArrayList<Object>();
|
List<Object> array = new ArrayList<>();
|
||||||
while (jr.hasNext()) {
|
while (jr.hasNext()) {
|
||||||
Object value = parseRecursive(jr);
|
Object value = parseRecursive(jr);
|
||||||
array.add(value);
|
array.add(value);
|
||||||
|
|
|
@ -308,7 +308,7 @@ final class ManagedChannelImpl extends ManagedChannel implements
|
||||||
channelTracer.updateBuilder(builder);
|
channelTracer.updateBuilder(builder);
|
||||||
}
|
}
|
||||||
builder.setTarget(target).setState(channelStateManager.getState());
|
builder.setTarget(target).setState(channelStateManager.getState());
|
||||||
List<InternalWithLogId> children = new ArrayList<InternalWithLogId>();
|
List<InternalWithLogId> children = new ArrayList<>();
|
||||||
children.addAll(subchannels);
|
children.addAll(subchannels);
|
||||||
children.addAll(oobChannels);
|
children.addAll(oobChannels);
|
||||||
builder.setSubchannels(children);
|
builder.setSubchannels(children);
|
||||||
|
@ -963,7 +963,7 @@ final class ManagedChannelImpl extends ManagedChannel implements
|
||||||
Collection<ClientStream> streams;
|
Collection<ClientStream> streams;
|
||||||
|
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
streams = new ArrayList<ClientStream>(uncommittedRetriableStreams);
|
streams = new ArrayList<>(uncommittedRetriableStreams);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ClientStream stream : streams) {
|
for (ClientStream stream : streams) {
|
||||||
|
|
|
@ -381,7 +381,7 @@ public class MessageFramer implements Framer {
|
||||||
* {@link OutputStream}.
|
* {@link OutputStream}.
|
||||||
*/
|
*/
|
||||||
private final class BufferChainOutputStream extends OutputStream {
|
private final class BufferChainOutputStream extends OutputStream {
|
||||||
private final List<WritableBuffer> bufferList = new ArrayList<WritableBuffer>();
|
private final List<WritableBuffer> bufferList = new ArrayList<>();
|
||||||
private WritableBuffer current;
|
private WritableBuffer current;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -220,7 +220,7 @@ abstract class RetriableStream<ReqT> implements ClientStream {
|
||||||
|
|
||||||
int stop = Math.min(index + chunk, savedState.buffer.size());
|
int stop = Math.min(index + chunk, savedState.buffer.size());
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
list = new ArrayList<BufferEntry>(savedState.buffer.subList(index, stop));
|
list = new ArrayList<>(savedState.buffer.subList(index, stop));
|
||||||
} else {
|
} else {
|
||||||
list.clear();
|
list.clear();
|
||||||
list.addAll(savedState.buffer.subList(index, stop));
|
list.addAll(savedState.buffer.subList(index, stop));
|
||||||
|
@ -761,7 +761,7 @@ abstract class RetriableStream<ReqT> implements ClientStream {
|
||||||
// optimize for 0-retry, which is most of the cases.
|
// optimize for 0-retry, which is most of the cases.
|
||||||
drainedSubstreams = Collections.singletonList(substream);
|
drainedSubstreams = Collections.singletonList(substream);
|
||||||
} else {
|
} else {
|
||||||
drainedSubstreams = new ArrayList<Substream>(this.drainedSubstreams);
|
drainedSubstreams = new ArrayList<>(this.drainedSubstreams);
|
||||||
drainedSubstreams.add(substream);
|
drainedSubstreams.add(substream);
|
||||||
drainedSubstreams = Collections.unmodifiableCollection(drainedSubstreams);
|
drainedSubstreams = Collections.unmodifiableCollection(drainedSubstreams);
|
||||||
}
|
}
|
||||||
|
@ -784,7 +784,7 @@ abstract class RetriableStream<ReqT> implements ClientStream {
|
||||||
State substreamClosed(Substream substream) {
|
State substreamClosed(Substream substream) {
|
||||||
substream.closed = true;
|
substream.closed = true;
|
||||||
if (this.drainedSubstreams.contains(substream)) {
|
if (this.drainedSubstreams.contains(substream)) {
|
||||||
Collection<Substream> drainedSubstreams = new ArrayList<Substream>(this.drainedSubstreams);
|
Collection<Substream> drainedSubstreams = new ArrayList<>(this.drainedSubstreams);
|
||||||
drainedSubstreams.remove(substream);
|
drainedSubstreams.remove(substream);
|
||||||
drainedSubstreams = Collections.unmodifiableCollection(drainedSubstreams);
|
drainedSubstreams = Collections.unmodifiableCollection(drainedSubstreams);
|
||||||
return new State(buffer, drainedSubstreams, winningSubstream, cancelled, passThrough);
|
return new State(buffer, drainedSubstreams, winningSubstream, cancelled, passThrough);
|
||||||
|
|
|
@ -139,7 +139,7 @@ public final class ServerImpl extends io.grpc.Server implements InternalInstrume
|
||||||
this.decompressorRegistry = builder.decompressorRegistry;
|
this.decompressorRegistry = builder.decompressorRegistry;
|
||||||
this.compressorRegistry = builder.compressorRegistry;
|
this.compressorRegistry = builder.compressorRegistry;
|
||||||
this.transportFilters = Collections.unmodifiableList(
|
this.transportFilters = Collections.unmodifiableList(
|
||||||
new ArrayList<ServerTransportFilter>(builder.transportFilters));
|
new ArrayList<>(builder.transportFilters));
|
||||||
this.interceptors =
|
this.interceptors =
|
||||||
builder.interceptors.toArray(new ServerInterceptor[builder.interceptors.size()]);
|
builder.interceptors.toArray(new ServerInterceptor[builder.interceptors.size()]);
|
||||||
this.handshakeTimeoutMillis = builder.handshakeTimeoutMillis;
|
this.handshakeTimeoutMillis = builder.handshakeTimeoutMillis;
|
||||||
|
@ -188,7 +188,7 @@ public final class ServerImpl extends io.grpc.Server implements InternalInstrume
|
||||||
List<ServerServiceDefinition> registryServices = registry.getServices();
|
List<ServerServiceDefinition> registryServices = registry.getServices();
|
||||||
int servicesCount = registryServices.size() + fallbackServices.size();
|
int servicesCount = registryServices.size() + fallbackServices.size();
|
||||||
List<ServerServiceDefinition> services =
|
List<ServerServiceDefinition> services =
|
||||||
new ArrayList<ServerServiceDefinition>(servicesCount);
|
new ArrayList<>(servicesCount);
|
||||||
services.addAll(registryServices);
|
services.addAll(registryServices);
|
||||||
services.addAll(fallbackServices);
|
services.addAll(fallbackServices);
|
||||||
return Collections.unmodifiableList(services);
|
return Collections.unmodifiableList(services);
|
||||||
|
@ -241,7 +241,7 @@ public final class ServerImpl extends io.grpc.Server implements InternalInstrume
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
shutdownNowStatus = nowStatus;
|
shutdownNowStatus = nowStatus;
|
||||||
transportsCopy = new ArrayList<ServerTransport>(transports);
|
transportsCopy = new ArrayList<>(transports);
|
||||||
savedServerShutdownCallbackInvoked = serverShutdownCallbackInvoked;
|
savedServerShutdownCallbackInvoked = serverShutdownCallbackInvoked;
|
||||||
}
|
}
|
||||||
// Short-circuiting not strictly necessary, but prevents transports from needing to handle
|
// Short-circuiting not strictly necessary, but prevents transports from needing to handle
|
||||||
|
@ -343,7 +343,7 @@ public final class ServerImpl extends io.grpc.Server implements InternalInstrume
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
// transports collection can be modified during shutdown(), even if we hold the lock, due
|
// transports collection can be modified during shutdown(), even if we hold the lock, due
|
||||||
// to reentrancy.
|
// to reentrancy.
|
||||||
copiedTransports = new ArrayList<ServerTransport>(transports);
|
copiedTransports = new ArrayList<>(transports);
|
||||||
shutdownNowStatusCopy = shutdownNowStatus;
|
shutdownNowStatusCopy = shutdownNowStatus;
|
||||||
serverShutdownCallbackInvoked = true;
|
serverShutdownCallbackInvoked = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ public final class StatsTraceContext {
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public List<StreamTracer> getTracersForTest() {
|
public List<StreamTracer> getTracersForTest() {
|
||||||
return new ArrayList<StreamTracer>(Arrays.asList(tracers));
|
return new ArrayList<>(Arrays.asList(tracers));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -79,7 +79,7 @@ public final class MutableHandlerRegistry extends HandlerRegistry {
|
||||||
@Override
|
@Override
|
||||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2222")
|
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2222")
|
||||||
public List<ServerServiceDefinition> getServices() {
|
public List<ServerServiceDefinition> getServices() {
|
||||||
return Collections.unmodifiableList(new ArrayList<ServerServiceDefinition>(services.values()));
|
return Collections.unmodifiableList(new ArrayList<>(services.values()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -273,7 +273,7 @@ public final class RoundRobinLoadBalancerFactory extends LoadBalancer.Factory {
|
||||||
*/
|
*/
|
||||||
private static List<Subchannel> filterNonFailingSubchannels(
|
private static List<Subchannel> filterNonFailingSubchannels(
|
||||||
Collection<Subchannel> subchannels) {
|
Collection<Subchannel> subchannels) {
|
||||||
List<Subchannel> readySubchannels = new ArrayList<Subchannel>(subchannels.size());
|
List<Subchannel> readySubchannels = new ArrayList<>(subchannels.size());
|
||||||
for (Subchannel subchannel : subchannels) {
|
for (Subchannel subchannel : subchannels) {
|
||||||
if (isReady(subchannel)) {
|
if (isReady(subchannel)) {
|
||||||
readySubchannels.add(subchannel);
|
readySubchannels.add(subchannel);
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class ClientInterceptorsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void ordered() {
|
public void ordered() {
|
||||||
final List<String> order = new ArrayList<String>();
|
final List<String> order = new ArrayList<>();
|
||||||
channel = new Channel() {
|
channel = new Channel() {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
|
@ -172,7 +172,7 @@ public class ClientInterceptorsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void orderedForward() {
|
public void orderedForward() {
|
||||||
final List<String> order = new ArrayList<String>();
|
final List<String> order = new ArrayList<>();
|
||||||
channel = new Channel() {
|
channel = new Channel() {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
|
@ -267,7 +267,7 @@ public class ClientInterceptorsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void examineInboundHeaders() {
|
public void examineInboundHeaders() {
|
||||||
final List<Metadata> examinedHeaders = new ArrayList<Metadata>();
|
final List<Metadata> examinedHeaders = new ArrayList<>();
|
||||||
ClientInterceptor interceptor = new ClientInterceptor() {
|
ClientInterceptor interceptor = new ClientInterceptor() {
|
||||||
@Override
|
@Override
|
||||||
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(
|
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(
|
||||||
|
@ -423,8 +423,8 @@ public class ClientInterceptorsTest {
|
||||||
private boolean done;
|
private boolean done;
|
||||||
private ClientCall.Listener<Integer> listener;
|
private ClientCall.Listener<Integer> listener;
|
||||||
private Metadata headers;
|
private Metadata headers;
|
||||||
private List<Integer> requests = new ArrayList<Integer>();
|
private List<Integer> requests = new ArrayList<>();
|
||||||
private List<String> messages = new ArrayList<String>();
|
private List<String> messages = new ArrayList<>();
|
||||||
private boolean halfClosed;
|
private boolean halfClosed;
|
||||||
private Throwable cancelCause;
|
private Throwable cancelCause;
|
||||||
private String cancelMessage;
|
private String cancelMessage;
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class ContextsTest {
|
||||||
public void interceptCall_basic() {
|
public void interceptCall_basic() {
|
||||||
Context origContext = Context.current();
|
Context origContext = Context.current();
|
||||||
final Object message = new Object();
|
final Object message = new Object();
|
||||||
final List<Integer> methodCalls = new ArrayList<Integer>();
|
final List<Integer> methodCalls = new ArrayList<>();
|
||||||
final ServerCall.Listener<Object> listener = new ServerCall.Listener<Object>() {
|
final ServerCall.Listener<Object> listener = new ServerCall.Listener<Object>() {
|
||||||
@Override public void onMessage(Object messageIn) {
|
@Override public void onMessage(Object messageIn) {
|
||||||
assertSame(message, messageIn);
|
assertSame(message, messageIn);
|
||||||
|
|
|
@ -184,7 +184,7 @@ public class ServerInterceptorsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void ordered() {
|
public void ordered() {
|
||||||
final List<String> order = new ArrayList<String>();
|
final List<String> order = new ArrayList<>();
|
||||||
handler = new ServerCallHandler<String, Integer>() {
|
handler = new ServerCallHandler<String, Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public ServerCall.Listener<String> startCall(
|
public ServerCall.Listener<String> startCall(
|
||||||
|
@ -226,7 +226,7 @@ public class ServerInterceptorsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void orderedForward() {
|
public void orderedForward() {
|
||||||
final List<String> order = new ArrayList<String>();
|
final List<String> order = new ArrayList<>();
|
||||||
handler = new ServerCallHandler<String, Integer>() {
|
handler = new ServerCallHandler<String, Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public ServerCall.Listener<String> startCall(
|
public ServerCall.Listener<String> startCall(
|
||||||
|
@ -296,7 +296,7 @@ public class ServerInterceptorsTest {
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void typedMarshalledMessages() {
|
public void typedMarshalledMessages() {
|
||||||
final List<String> order = new ArrayList<String>();
|
final List<String> order = new ArrayList<>();
|
||||||
Marshaller<Holder> marshaller = new Marshaller<Holder>() {
|
Marshaller<Holder> marshaller = new Marshaller<Holder>() {
|
||||||
@Override
|
@Override
|
||||||
public InputStream stream(Holder value) {
|
public InputStream stream(Holder value) {
|
||||||
|
|
|
@ -533,7 +533,7 @@ public class DnsNameResolverTest {
|
||||||
@Test
|
@Test
|
||||||
public void maybeChooseServiceConfig_clientLanguageMatchesJava() {
|
public void maybeChooseServiceConfig_clientLanguageMatchesJava() {
|
||||||
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
||||||
List<Object> langs = new ArrayList<Object>();
|
List<Object> langs = new ArrayList<>();
|
||||||
langs.add("java");
|
langs.add("java");
|
||||||
choice.put("clientLanguage", langs);
|
choice.put("clientLanguage", langs);
|
||||||
choice.put("serviceConfig", serviceConfig);
|
choice.put("serviceConfig", serviceConfig);
|
||||||
|
@ -544,7 +544,7 @@ public class DnsNameResolverTest {
|
||||||
@Test
|
@Test
|
||||||
public void maybeChooseServiceConfig_clientLanguageDoesntMatchGo() {
|
public void maybeChooseServiceConfig_clientLanguageDoesntMatchGo() {
|
||||||
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
||||||
List<Object> langs = new ArrayList<Object>();
|
List<Object> langs = new ArrayList<>();
|
||||||
langs.add("go");
|
langs.add("go");
|
||||||
choice.put("clientLanguage", langs);
|
choice.put("clientLanguage", langs);
|
||||||
choice.put("serviceConfig", serviceConfig);
|
choice.put("serviceConfig", serviceConfig);
|
||||||
|
@ -555,7 +555,7 @@ public class DnsNameResolverTest {
|
||||||
@Test
|
@Test
|
||||||
public void maybeChooseServiceConfig_clientLanguageCaseInsensitive() {
|
public void maybeChooseServiceConfig_clientLanguageCaseInsensitive() {
|
||||||
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
||||||
List<Object> langs = new ArrayList<Object>();
|
List<Object> langs = new ArrayList<>();
|
||||||
langs.add("JAVA");
|
langs.add("JAVA");
|
||||||
choice.put("clientLanguage", langs);
|
choice.put("clientLanguage", langs);
|
||||||
choice.put("serviceConfig", serviceConfig);
|
choice.put("serviceConfig", serviceConfig);
|
||||||
|
@ -566,7 +566,7 @@ public class DnsNameResolverTest {
|
||||||
@Test
|
@Test
|
||||||
public void maybeChooseServiceConfig_clientLanguageMatchesEmtpy() {
|
public void maybeChooseServiceConfig_clientLanguageMatchesEmtpy() {
|
||||||
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
||||||
List<Object> langs = new ArrayList<Object>();
|
List<Object> langs = new ArrayList<>();
|
||||||
choice.put("clientLanguage", langs);
|
choice.put("clientLanguage", langs);
|
||||||
choice.put("serviceConfig", serviceConfig);
|
choice.put("serviceConfig", serviceConfig);
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ public class DnsNameResolverTest {
|
||||||
@Test
|
@Test
|
||||||
public void maybeChooseServiceConfig_clientLanguageMatchesMulti() {
|
public void maybeChooseServiceConfig_clientLanguageMatchesMulti() {
|
||||||
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
||||||
List<Object> langs = new ArrayList<Object>();
|
List<Object> langs = new ArrayList<>();
|
||||||
langs.add("go");
|
langs.add("go");
|
||||||
langs.add("java");
|
langs.add("java");
|
||||||
choice.put("clientLanguage", langs);
|
choice.put("clientLanguage", langs);
|
||||||
|
@ -702,7 +702,7 @@ public class DnsNameResolverTest {
|
||||||
@Test
|
@Test
|
||||||
public void maybeChooseServiceConfig_hostnameMatches() {
|
public void maybeChooseServiceConfig_hostnameMatches() {
|
||||||
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
||||||
List<Object> hosts = new ArrayList<Object>();
|
List<Object> hosts = new ArrayList<>();
|
||||||
hosts.add("localhost");
|
hosts.add("localhost");
|
||||||
choice.put("clientHostname", hosts);
|
choice.put("clientHostname", hosts);
|
||||||
choice.put("serviceConfig", serviceConfig);
|
choice.put("serviceConfig", serviceConfig);
|
||||||
|
@ -713,7 +713,7 @@ public class DnsNameResolverTest {
|
||||||
@Test
|
@Test
|
||||||
public void maybeChooseServiceConfig_hostnameDoesntMatch() {
|
public void maybeChooseServiceConfig_hostnameDoesntMatch() {
|
||||||
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
||||||
List<Object> hosts = new ArrayList<Object>();
|
List<Object> hosts = new ArrayList<>();
|
||||||
hosts.add("localhorse");
|
hosts.add("localhorse");
|
||||||
choice.put("clientHostname", hosts);
|
choice.put("clientHostname", hosts);
|
||||||
choice.put("serviceConfig", serviceConfig);
|
choice.put("serviceConfig", serviceConfig);
|
||||||
|
@ -724,7 +724,7 @@ public class DnsNameResolverTest {
|
||||||
@Test
|
@Test
|
||||||
public void maybeChooseServiceConfig_clientLanguageCaseSensitive() {
|
public void maybeChooseServiceConfig_clientLanguageCaseSensitive() {
|
||||||
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
||||||
List<Object> hosts = new ArrayList<Object>();
|
List<Object> hosts = new ArrayList<>();
|
||||||
hosts.add("LOCALHOST");
|
hosts.add("LOCALHOST");
|
||||||
choice.put("clientHostname", hosts);
|
choice.put("clientHostname", hosts);
|
||||||
choice.put("serviceConfig", serviceConfig);
|
choice.put("serviceConfig", serviceConfig);
|
||||||
|
@ -735,7 +735,7 @@ public class DnsNameResolverTest {
|
||||||
@Test
|
@Test
|
||||||
public void maybeChooseServiceConfig_hostnameMatchesEmtpy() {
|
public void maybeChooseServiceConfig_hostnameMatchesEmtpy() {
|
||||||
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
||||||
List<Object> hosts = new ArrayList<Object>();
|
List<Object> hosts = new ArrayList<>();
|
||||||
choice.put("clientHostname", hosts);
|
choice.put("clientHostname", hosts);
|
||||||
choice.put("serviceConfig", serviceConfig);
|
choice.put("serviceConfig", serviceConfig);
|
||||||
|
|
||||||
|
@ -745,7 +745,7 @@ public class DnsNameResolverTest {
|
||||||
@Test
|
@Test
|
||||||
public void maybeChooseServiceConfig_hostnameMatchesMulti() {
|
public void maybeChooseServiceConfig_hostnameMatchesMulti() {
|
||||||
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
Map<String, Object> choice = new LinkedHashMap<String, Object>();
|
||||||
List<Object> hosts = new ArrayList<Object>();
|
List<Object> hosts = new ArrayList<>();
|
||||||
hosts.add("localhorse");
|
hosts.add("localhorse");
|
||||||
hosts.add("localhost");
|
hosts.add("localhost");
|
||||||
choice.put("clientHostname", hosts);
|
choice.put("clientHostname", hosts);
|
||||||
|
@ -773,7 +773,7 @@ public class DnsNameResolverTest {
|
||||||
private byte lastByte = 0;
|
private byte lastByte = 0;
|
||||||
|
|
||||||
private List<InetAddress> createAddressList(int n) throws UnknownHostException {
|
private List<InetAddress> createAddressList(int n) throws UnknownHostException {
|
||||||
List<InetAddress> list = new ArrayList<InetAddress>(n);
|
List<InetAddress> list = new ArrayList<>(n);
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
list.add(InetAddress.getByAddress(new byte[] {127, 0, 0, ++lastByte}));
|
list.add(InetAddress.getByAddress(new byte[] {127, 0, 0, ++lastByte}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,7 +233,7 @@ public final class FakeClock {
|
||||||
* Return all due tasks.
|
* Return all due tasks.
|
||||||
*/
|
*/
|
||||||
public Collection<ScheduledTask> getDueTasks() {
|
public Collection<ScheduledTask> getDueTasks() {
|
||||||
ArrayList<ScheduledTask> result = new ArrayList<ScheduledTask>();
|
ArrayList<ScheduledTask> result = new ArrayList<>();
|
||||||
for (ScheduledTask task : tasks) {
|
for (ScheduledTask task : tasks) {
|
||||||
if (task.dueTimeNanos > currentTimeNanos) {
|
if (task.dueTimeNanos > currentTimeNanos) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -254,7 +254,7 @@ public final class FakeClock {
|
||||||
* Return all unrun tasks accepted by the given filter.
|
* Return all unrun tasks accepted by the given filter.
|
||||||
*/
|
*/
|
||||||
public Collection<ScheduledTask> getPendingTasks(TaskFilter filter) {
|
public Collection<ScheduledTask> getPendingTasks(TaskFilter filter) {
|
||||||
ArrayList<ScheduledTask> result = new ArrayList<ScheduledTask>();
|
ArrayList<ScheduledTask> result = new ArrayList<>();
|
||||||
for (ScheduledTask task : tasks) {
|
for (ScheduledTask task : tasks) {
|
||||||
if (filter.shouldAccept(task.command)) {
|
if (filter.shouldAccept(task.command)) {
|
||||||
result.add(task);
|
result.add(task);
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class JsonParserTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void emptyArray() throws IOException {
|
public void emptyArray() throws IOException {
|
||||||
assertEquals(new ArrayList<Object>(), JsonParser.parse("[]"));
|
assertEquals(new ArrayList<>(), JsonParser.parse("[]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -327,7 +327,7 @@ public class ManagedChannelImplIdlenessTest {
|
||||||
MockClientTransportInfo t0 = newTransports.poll();
|
MockClientTransportInfo t0 = newTransports.poll();
|
||||||
t0.listener.transportReady();
|
t0.listener.transportReady();
|
||||||
|
|
||||||
List<SocketAddress> changedList = new ArrayList<SocketAddress>(servers.get(0).getAddresses());
|
List<SocketAddress> changedList = new ArrayList<>(servers.get(0).getAddresses());
|
||||||
changedList.add(new FakeSocketAddress("aDifferentServer"));
|
changedList.add(new FakeSocketAddress("aDifferentServer"));
|
||||||
helper.updateSubchannelAddresses(subchannel, new EquivalentAddressGroup(changedList));
|
helper.updateSubchannelAddresses(subchannel, new EquivalentAddressGroup(changedList));
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ public class ManagedChannelImplIdlenessTest {
|
||||||
MockClientTransportInfo t0 = newTransports.poll();
|
MockClientTransportInfo t0 = newTransports.poll();
|
||||||
t0.listener.transportReady();
|
t0.listener.transportReady();
|
||||||
|
|
||||||
List<SocketAddress> changedList = new ArrayList<SocketAddress>(servers.get(0).getAddresses());
|
List<SocketAddress> changedList = new ArrayList<>(servers.get(0).getAddresses());
|
||||||
changedList.add(new FakeSocketAddress("aDifferentServer"));
|
changedList.add(new FakeSocketAddress("aDifferentServer"));
|
||||||
helper.updateOobChannelAddresses(oobChannel, new EquivalentAddressGroup(changedList));
|
helper.updateOobChannelAddresses(oobChannel, new EquivalentAddressGroup(changedList));
|
||||||
|
|
||||||
|
|
|
@ -2188,7 +2188,7 @@ public class ManagedChannelImplTest {
|
||||||
public void channelTracing_nameResolvedEvent_zeorAndNonzeroBackends() throws Exception {
|
public void channelTracing_nameResolvedEvent_zeorAndNonzeroBackends() throws Exception {
|
||||||
timer.forwardNanos(1234);
|
timer.forwardNanos(1234);
|
||||||
channelBuilder.maxTraceEvents(10);
|
channelBuilder.maxTraceEvents(10);
|
||||||
List<EquivalentAddressGroup> servers = new ArrayList<EquivalentAddressGroup>();
|
List<EquivalentAddressGroup> servers = new ArrayList<>();
|
||||||
servers.add(new EquivalentAddressGroup(socketAddress));
|
servers.add(new EquivalentAddressGroup(socketAddress));
|
||||||
FakeNameResolverFactory nameResolverFactory =
|
FakeNameResolverFactory nameResolverFactory =
|
||||||
new FakeNameResolverFactory.Builder(expectedUri).setServers(servers).build();
|
new FakeNameResolverFactory.Builder(expectedUri).setServers(servers).build();
|
||||||
|
@ -2222,7 +2222,7 @@ public class ManagedChannelImplTest {
|
||||||
public void channelTracing_serviceConfigChange() throws Exception {
|
public void channelTracing_serviceConfigChange() throws Exception {
|
||||||
timer.forwardNanos(1234);
|
timer.forwardNanos(1234);
|
||||||
channelBuilder.maxTraceEvents(10);
|
channelBuilder.maxTraceEvents(10);
|
||||||
List<EquivalentAddressGroup> servers = new ArrayList<EquivalentAddressGroup>();
|
List<EquivalentAddressGroup> servers = new ArrayList<>();
|
||||||
servers.add(new EquivalentAddressGroup(socketAddress));
|
servers.add(new EquivalentAddressGroup(socketAddress));
|
||||||
FakeNameResolverFactory nameResolverFactory =
|
FakeNameResolverFactory nameResolverFactory =
|
||||||
new FakeNameResolverFactory.Builder(expectedUri).setServers(servers).build();
|
new FakeNameResolverFactory.Builder(expectedUri).setServers(servers).build();
|
||||||
|
@ -2836,7 +2836,7 @@ public class ManagedChannelImplTest {
|
||||||
final List<EquivalentAddressGroup> servers;
|
final List<EquivalentAddressGroup> servers;
|
||||||
final boolean resolvedAtStart;
|
final boolean resolvedAtStart;
|
||||||
final Status error;
|
final Status error;
|
||||||
final ArrayList<FakeNameResolver> resolvers = new ArrayList<FakeNameResolver>();
|
final ArrayList<FakeNameResolver> resolvers = new ArrayList<>();
|
||||||
// The Attributes argument of the next invocation of listener.onAddresses(servers, attrs)
|
// The Attributes argument of the next invocation of listener.onAddresses(servers, attrs)
|
||||||
final AtomicReference<Attributes> nextResolvedAttributes =
|
final AtomicReference<Attributes> nextResolvedAttributes =
|
||||||
new AtomicReference<Attributes>(Attributes.EMPTY);
|
new AtomicReference<Attributes>(Attributes.EMPTY);
|
||||||
|
|
|
@ -57,7 +57,7 @@ public final class ManagedChannelOrphanWrapperTest {
|
||||||
|
|
||||||
// Try to capture the log output but without causing terminal noise. Adding the filter must
|
// Try to capture the log output but without causing terminal noise. Adding the filter must
|
||||||
// be done before clearing the ref or else it might be missed.
|
// be done before clearing the ref or else it might be missed.
|
||||||
final List<LogRecord> records = new ArrayList<LogRecord>(1);
|
final List<LogRecord> records = new ArrayList<>(1);
|
||||||
Logger orphanLogger = Logger.getLogger(ManagedChannelOrphanWrapper.class.getName());
|
Logger orphanLogger = Logger.getLogger(ManagedChannelOrphanWrapper.class.getName());
|
||||||
Filter oldFilter = orphanLogger.getFilter();
|
Filter oldFilter = orphanLogger.getFilter();
|
||||||
orphanLogger.setFilter(new Filter() {
|
orphanLogger.setFilter(new Filter() {
|
||||||
|
|
|
@ -745,7 +745,7 @@ public class RetriableStreamTest {
|
||||||
public void isReady_whileDraining() {
|
public void isReady_whileDraining() {
|
||||||
final AtomicReference<ClientStreamListener> sublistenerCaptor1 =
|
final AtomicReference<ClientStreamListener> sublistenerCaptor1 =
|
||||||
new AtomicReference<ClientStreamListener>();
|
new AtomicReference<ClientStreamListener>();
|
||||||
final List<Boolean> readiness = new ArrayList<Boolean>();
|
final List<Boolean> readiness = new ArrayList<>();
|
||||||
ClientStream mockStream1 =
|
ClientStream mockStream1 =
|
||||||
mock(
|
mock(
|
||||||
ClientStream.class,
|
ClientStream.class,
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class SerializeReentrantCallsDirectExecutorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test public void reentrantCallsShouldBeSerialized() {
|
@Test public void reentrantCallsShouldBeSerialized() {
|
||||||
final List<Integer> callOrder = new ArrayList<Integer>(4);
|
final List<Integer> callOrder = new ArrayList<>(4);
|
||||||
executor.execute(new Runnable() {
|
executor.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -105,7 +105,7 @@ public class SerializeReentrantCallsDirectExecutorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void executeCanBeRepeated() {
|
public void executeCanBeRepeated() {
|
||||||
final List<Integer> executes = new ArrayList<Integer>();
|
final List<Integer> executes = new ArrayList<>();
|
||||||
executor.execute(new Runnable() {
|
executor.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.junit.runners.JUnit4;
|
||||||
public class SerializingExecutorTest {
|
public class SerializingExecutorTest {
|
||||||
private SingleExecutor singleExecutor = new SingleExecutor();
|
private SingleExecutor singleExecutor = new SingleExecutor();
|
||||||
private SerializingExecutor executor = new SerializingExecutor(singleExecutor);
|
private SerializingExecutor executor = new SerializingExecutor(singleExecutor);
|
||||||
private List<Integer> runs = new ArrayList<Integer>();
|
private List<Integer> runs = new ArrayList<>();
|
||||||
|
|
||||||
private class AddToRuns implements Runnable {
|
private class AddToRuns implements Runnable {
|
||||||
private final int val;
|
private final int val;
|
||||||
|
|
|
@ -675,7 +675,7 @@ public class RoundRobinLoadBalancerTest {
|
||||||
assertEquals(sc2, loadBalancer.getStickinessMapForTest().get("my-sticky-value").value);
|
assertEquals(sc2, loadBalancer.getStickinessMapForTest().get("my-sticky-value").value);
|
||||||
|
|
||||||
// shutdown channel via name resolver change
|
// shutdown channel via name resolver change
|
||||||
List<EquivalentAddressGroup> newServers = new ArrayList<EquivalentAddressGroup>(servers);
|
List<EquivalentAddressGroup> newServers = new ArrayList<>(servers);
|
||||||
newServers.remove(sc2.getAddresses());
|
newServers.remove(sc2.getAddresses());
|
||||||
|
|
||||||
loadBalancer.handleResolvedAddressGroups(newServers, attributes);
|
loadBalancer.handleResolvedAddressGroups(newServers, attributes);
|
||||||
|
|
|
@ -51,9 +51,9 @@ public final class CronetCallOptions {
|
||||||
Collection<Object> existingAnnotations = callOptions.getOption(CRONET_ANNOTATIONS_KEY);
|
Collection<Object> existingAnnotations = callOptions.getOption(CRONET_ANNOTATIONS_KEY);
|
||||||
ArrayList<Object> newAnnotations;
|
ArrayList<Object> newAnnotations;
|
||||||
if (existingAnnotations == null) {
|
if (existingAnnotations == null) {
|
||||||
newAnnotations = new ArrayList<Object>();
|
newAnnotations = new ArrayList<>();
|
||||||
} else {
|
} else {
|
||||||
newAnnotations = new ArrayList<Object>(existingAnnotations);
|
newAnnotations = new ArrayList<>(existingAnnotations);
|
||||||
}
|
}
|
||||||
newAnnotations.add(annotation);
|
newAnnotations.add(annotation);
|
||||||
return callOptions.withOption(
|
return callOptions.withOption(
|
||||||
|
|
|
@ -504,7 +504,7 @@ class CronetClientStream extends AbstractClientStream {
|
||||||
|
|
||||||
private void reportHeaders(List<Map.Entry<String, String>> headers, boolean endOfStream) {
|
private void reportHeaders(List<Map.Entry<String, String>> headers, boolean endOfStream) {
|
||||||
// TODO(ericgribkoff): create new utility methods to eliminate all these conversions
|
// TODO(ericgribkoff): create new utility methods to eliminate all these conversions
|
||||||
List<String> headerList = new ArrayList<String>();
|
List<String> headerList = new ArrayList<>();
|
||||||
for (Map.Entry<String, String> entry : headers) {
|
for (Map.Entry<String, String> entry : headers) {
|
||||||
headerList.add(entry.getKey());
|
headerList.add(entry.getKey());
|
||||||
headerList.add(entry.getValue());
|
headerList.add(entry.getValue());
|
||||||
|
|
|
@ -188,7 +188,7 @@ class CronetClientTransport implements ConnectionClientTransport {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
// A copy is always necessary since cancel() can call finishStream() which calls
|
// A copy is always necessary since cancel() can call finishStream() which calls
|
||||||
// streams.remove()
|
// streams.remove()
|
||||||
streamsCopy = new ArrayList<CronetClientStream>(streams);
|
streamsCopy = new ArrayList<>(streams);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < streamsCopy.size(); i++) {
|
for (int i = 0; i < streamsCopy.size(); i++) {
|
||||||
// Avoid deadlock by calling into stream without lock held
|
// Avoid deadlock by calling into stream without lock held
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class SafeMethodCachingInterceptorTest {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final List<String> cacheControlDirectives = new ArrayList<String>();
|
private final List<String> cacheControlDirectives = new ArrayList<>();
|
||||||
private ServerInterceptor injectCacheControlInterceptor =
|
private ServerInterceptor injectCacheControlInterceptor =
|
||||||
new ServerInterceptor() {
|
new ServerInterceptor() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -261,7 +261,7 @@ public class RouteGuideActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
public String run(RouteGuideBlockingStub blockingStub, RouteGuideStub asyncStub)
|
public String run(RouteGuideBlockingStub blockingStub, RouteGuideStub asyncStub)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
List<Point> points = new ArrayList<Point>();
|
List<Point> points = new ArrayList<>();
|
||||||
points.add(Point.newBuilder().setLatitude(407838351).setLongitude(-746143763).build());
|
points.add(Point.newBuilder().setLatitude(407838351).setLongitude(-746143763).build());
|
||||||
points.add(Point.newBuilder().setLatitude(408122808).setLongitude(-743999179).build());
|
points.add(Point.newBuilder().setLatitude(408122808).setLongitude(-743999179).build());
|
||||||
points.add(Point.newBuilder().setLatitude(413628156).setLongitude(-749015468).build());
|
points.add(Point.newBuilder().setLatitude(413628156).setLongitude(-749015468).build());
|
||||||
|
|
|
@ -254,7 +254,7 @@ public class RouteGuideClientTest {
|
||||||
Feature.newBuilder().setLocation(point3).build();
|
Feature.newBuilder().setLocation(point3).build();
|
||||||
final List<Feature> features = Arrays.asList(
|
final List<Feature> features = Arrays.asList(
|
||||||
requestFeature1, requestFeature2, requestFeature3);
|
requestFeature1, requestFeature2, requestFeature3);
|
||||||
final List<Point> pointsDelivered = new ArrayList<Point>();
|
final List<Point> pointsDelivered = new ArrayList<>();
|
||||||
final RouteSummary fakeResponse = RouteSummary
|
final RouteSummary fakeResponse = RouteSummary
|
||||||
.newBuilder()
|
.newBuilder()
|
||||||
.setPointCount(7)
|
.setPointCount(7)
|
||||||
|
@ -357,8 +357,8 @@ public class RouteGuideClientTest {
|
||||||
public void routeChat_simpleResponse() throws Exception {
|
public void routeChat_simpleResponse() throws Exception {
|
||||||
RouteNote fakeResponse1 = RouteNote.newBuilder().setMessage("dummy msg1").build();
|
RouteNote fakeResponse1 = RouteNote.newBuilder().setMessage("dummy msg1").build();
|
||||||
RouteNote fakeResponse2 = RouteNote.newBuilder().setMessage("dummy msg2").build();
|
RouteNote fakeResponse2 = RouteNote.newBuilder().setMessage("dummy msg2").build();
|
||||||
final List<String> messagesDelivered = new ArrayList<String>();
|
final List<String> messagesDelivered = new ArrayList<>();
|
||||||
final List<Point> locationsDelivered = new ArrayList<Point>();
|
final List<Point> locationsDelivered = new ArrayList<>();
|
||||||
final AtomicReference<StreamObserver<RouteNote>> responseObserverRef =
|
final AtomicReference<StreamObserver<RouteNote>> responseObserverRef =
|
||||||
new AtomicReference<StreamObserver<RouteNote>>();
|
new AtomicReference<StreamObserver<RouteNote>>();
|
||||||
final CountDownLatch allRequestsDelivered = new CountDownLatch(1);
|
final CountDownLatch allRequestsDelivered = new CountDownLatch(1);
|
||||||
|
@ -428,7 +428,7 @@ public class RouteGuideClientTest {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void routeChat_echoResponse() throws Exception {
|
public void routeChat_echoResponse() throws Exception {
|
||||||
final List<RouteNote> notesDelivered = new ArrayList<RouteNote>();
|
final List<RouteNote> notesDelivered = new ArrayList<>();
|
||||||
|
|
||||||
// implement the fake service
|
// implement the fake service
|
||||||
RouteGuideImplBase routeChatImpl =
|
RouteGuideImplBase routeChatImpl =
|
||||||
|
@ -476,7 +476,7 @@ public class RouteGuideClientTest {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void routeChat_errorResponse() throws Exception {
|
public void routeChat_errorResponse() throws Exception {
|
||||||
final List<RouteNote> notesDelivered = new ArrayList<RouteNote>();
|
final List<RouteNote> notesDelivered = new ArrayList<>();
|
||||||
final StatusRuntimeException fakeError = new StatusRuntimeException(Status.PERMISSION_DENIED);
|
final StatusRuntimeException fakeError = new StatusRuntimeException(Status.PERMISSION_DENIED);
|
||||||
|
|
||||||
// implement the fake service
|
// implement the fake service
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class RouteGuideServerTest {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
// Generate a unique in-process server name.
|
// Generate a unique in-process server name.
|
||||||
String serverName = InProcessServerBuilder.generateName();
|
String serverName = InProcessServerBuilder.generateName();
|
||||||
features = new ArrayList<Feature>();
|
features = new ArrayList<>();
|
||||||
// Use directExecutor for both InProcessServerBuilder and InProcessChannelBuilder can reduce the
|
// Use directExecutor for both InProcessServerBuilder and InProcessChannelBuilder can reduce the
|
||||||
// usage timeouts and latches in test. But we still add timeout and latches where they would be
|
// usage timeouts and latches in test. But we still add timeout and latches where they would be
|
||||||
// needed if no directExecutor were used, just for demo purpose.
|
// needed if no directExecutor were used, just for demo purpose.
|
||||||
|
|
|
@ -87,8 +87,8 @@ class GrpclbLoadBalancer extends LoadBalancer implements InternalWithLogId {
|
||||||
public void handleResolvedAddressGroups(
|
public void handleResolvedAddressGroups(
|
||||||
List<EquivalentAddressGroup> updatedServers, Attributes attributes) {
|
List<EquivalentAddressGroup> updatedServers, Attributes attributes) {
|
||||||
// LB addresses and backend addresses are treated separately
|
// LB addresses and backend addresses are treated separately
|
||||||
List<LbAddressGroup> newLbAddressGroups = new ArrayList<LbAddressGroup>();
|
List<LbAddressGroup> newLbAddressGroups = new ArrayList<>();
|
||||||
List<EquivalentAddressGroup> newBackendServers = new ArrayList<EquivalentAddressGroup>();
|
List<EquivalentAddressGroup> newBackendServers = new ArrayList<>();
|
||||||
for (EquivalentAddressGroup server : updatedServers) {
|
for (EquivalentAddressGroup server : updatedServers) {
|
||||||
String lbAddrAuthority = server.getAttributes().get(GrpcAttributes.ATTR_LB_ADDR_AUTHORITY);
|
String lbAddrAuthority = server.getAttributes().get(GrpcAttributes.ATTR_LB_ADDR_AUTHORITY);
|
||||||
if (lbAddrAuthority != null) {
|
if (lbAddrAuthority != null) {
|
||||||
|
|
|
@ -238,8 +238,8 @@ final class GrpclbState {
|
||||||
usingFallbackBackends = true;
|
usingFallbackBackends = true;
|
||||||
logger.log(Level.INFO, "[{0}] Using fallback: {1}", new Object[] {logId, fallbackBackendList});
|
logger.log(Level.INFO, "[{0}] Using fallback: {1}", new Object[] {logId, fallbackBackendList});
|
||||||
|
|
||||||
List<DropEntry> newDropList = new ArrayList<DropEntry>();
|
List<DropEntry> newDropList = new ArrayList<>();
|
||||||
List<BackendAddressGroup> newBackendAddrList = new ArrayList<BackendAddressGroup>();
|
List<BackendAddressGroup> newBackendAddrList = new ArrayList<>();
|
||||||
for (EquivalentAddressGroup eag : fallbackBackendList) {
|
for (EquivalentAddressGroup eag : fallbackBackendList) {
|
||||||
newDropList.add(null);
|
newDropList.add(null);
|
||||||
newBackendAddrList.add(new BackendAddressGroup(eag, null));
|
newBackendAddrList.add(new BackendAddressGroup(eag, null));
|
||||||
|
@ -348,7 +348,7 @@ final class GrpclbState {
|
||||||
new Object[] {logId, newBackendAddrList, newDropList});
|
new Object[] {logId, newBackendAddrList, newDropList});
|
||||||
HashMap<EquivalentAddressGroup, Subchannel> newSubchannelMap =
|
HashMap<EquivalentAddressGroup, Subchannel> newSubchannelMap =
|
||||||
new HashMap<EquivalentAddressGroup, Subchannel>();
|
new HashMap<EquivalentAddressGroup, Subchannel>();
|
||||||
List<BackendEntry> newBackendList = new ArrayList<BackendEntry>();
|
List<BackendEntry> newBackendList = new ArrayList<>();
|
||||||
|
|
||||||
for (BackendAddressGroup backendAddr : newBackendAddrList) {
|
for (BackendAddressGroup backendAddr : newBackendAddrList) {
|
||||||
EquivalentAddressGroup eag = backendAddr.getAddresses();
|
EquivalentAddressGroup eag = backendAddr.getAddresses();
|
||||||
|
@ -572,8 +572,8 @@ final class GrpclbState {
|
||||||
balancerWorking = true;
|
balancerWorking = true;
|
||||||
// TODO(zhangkun83): handle delegate from initialResponse
|
// TODO(zhangkun83): handle delegate from initialResponse
|
||||||
ServerList serverList = response.getServerList();
|
ServerList serverList = response.getServerList();
|
||||||
List<DropEntry> newDropList = new ArrayList<DropEntry>();
|
List<DropEntry> newDropList = new ArrayList<>();
|
||||||
List<BackendAddressGroup> newBackendAddrList = new ArrayList<BackendAddressGroup>();
|
List<BackendAddressGroup> newBackendAddrList = new ArrayList<>();
|
||||||
// Construct the new collections. Create new Subchannels when necessary.
|
// Construct the new collections. Create new Subchannels when necessary.
|
||||||
for (Server server : serverList.getServersList()) {
|
for (Server server : serverList.getServersList()) {
|
||||||
String token = server.getLoadBalanceToken();
|
String token = server.getLoadBalanceToken();
|
||||||
|
@ -673,7 +673,7 @@ final class GrpclbState {
|
||||||
* changed since the last picker created.
|
* changed since the last picker created.
|
||||||
*/
|
*/
|
||||||
private void maybeUpdatePicker() {
|
private void maybeUpdatePicker() {
|
||||||
List<RoundRobinEntry> pickList = new ArrayList<RoundRobinEntry>(backendList.size());
|
List<RoundRobinEntry> pickList = new ArrayList<>(backendList.size());
|
||||||
Status error = null;
|
Status error = null;
|
||||||
boolean hasIdle = false;
|
boolean hasIdle = false;
|
||||||
for (BackendEntry entry : backendList) {
|
for (BackendEntry entry : backendList) {
|
||||||
|
@ -728,7 +728,7 @@ final class GrpclbState {
|
||||||
|
|
||||||
private LbAddressGroup flattenLbAddressGroups(List<LbAddressGroup> groupList) {
|
private LbAddressGroup flattenLbAddressGroups(List<LbAddressGroup> groupList) {
|
||||||
assert !groupList.isEmpty();
|
assert !groupList.isEmpty();
|
||||||
List<EquivalentAddressGroup> eags = new ArrayList<EquivalentAddressGroup>(groupList.size());
|
List<EquivalentAddressGroup> eags = new ArrayList<>(groupList.size());
|
||||||
String authority = groupList.get(0).getAuthority();
|
String authority = groupList.get(0).getAuthority();
|
||||||
for (LbAddressGroup group : groupList) {
|
for (LbAddressGroup group : groupList) {
|
||||||
if (!authority.equals(group.getAuthority())) {
|
if (!authority.equals(group.getAuthority())) {
|
||||||
|
@ -758,7 +758,7 @@ final class GrpclbState {
|
||||||
*/
|
*/
|
||||||
private static EquivalentAddressGroup flattenEquivalentAddressGroup(
|
private static EquivalentAddressGroup flattenEquivalentAddressGroup(
|
||||||
List<EquivalentAddressGroup> groupList, Attributes attrs) {
|
List<EquivalentAddressGroup> groupList, Attributes attrs) {
|
||||||
List<SocketAddress> addrs = new ArrayList<SocketAddress>();
|
List<SocketAddress> addrs = new ArrayList<>();
|
||||||
for (EquivalentAddressGroup group : groupList) {
|
for (EquivalentAddressGroup group : groupList) {
|
||||||
addrs.addAll(group.getAddresses());
|
addrs.addAll(group.getAddresses());
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class CachedSubchannelPoolTest {
|
||||||
private final Helper helper = mock(Helper.class);
|
private final Helper helper = mock(Helper.class);
|
||||||
private final FakeClock clock = new FakeClock();
|
private final FakeClock clock = new FakeClock();
|
||||||
private final CachedSubchannelPool pool = new CachedSubchannelPool();
|
private final CachedSubchannelPool pool = new CachedSubchannelPool();
|
||||||
private final ArrayList<Subchannel> mockSubchannels = new ArrayList<Subchannel>();
|
private final ArrayList<Subchannel> mockSubchannels = new ArrayList<>();
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
|
|
|
@ -150,9 +150,9 @@ public class GrpclbLoadBalancerTest {
|
||||||
new LinkedList<StreamObserver<LoadBalanceRequest>>();
|
new LinkedList<StreamObserver<LoadBalanceRequest>>();
|
||||||
private final LinkedList<Subchannel> mockSubchannels = new LinkedList<Subchannel>();
|
private final LinkedList<Subchannel> mockSubchannels = new LinkedList<Subchannel>();
|
||||||
private final LinkedList<ManagedChannel> fakeOobChannels = new LinkedList<ManagedChannel>();
|
private final LinkedList<ManagedChannel> fakeOobChannels = new LinkedList<ManagedChannel>();
|
||||||
private final ArrayList<Subchannel> subchannelTracker = new ArrayList<Subchannel>();
|
private final ArrayList<Subchannel> subchannelTracker = new ArrayList<>();
|
||||||
private final ArrayList<ManagedChannel> oobChannelTracker = new ArrayList<ManagedChannel>();
|
private final ArrayList<ManagedChannel> oobChannelTracker = new ArrayList<>();
|
||||||
private final ArrayList<String> failingLbAuthorities = new ArrayList<String>();
|
private final ArrayList<String> failingLbAuthorities = new ArrayList<>();
|
||||||
private final TimeProvider timeProvider = new TimeProvider() {
|
private final TimeProvider timeProvider = new TimeProvider() {
|
||||||
@Override
|
@Override
|
||||||
public long currentTimeNanos() {
|
public long currentTimeNanos() {
|
||||||
|
@ -1305,8 +1305,8 @@ public class GrpclbLoadBalancerTest {
|
||||||
|
|
||||||
private List<Subchannel> fallbackTestVerifyUseOfBalancerBackendLists(
|
private List<Subchannel> fallbackTestVerifyUseOfBalancerBackendLists(
|
||||||
InOrder inOrder, List<ServerEntry> servers) {
|
InOrder inOrder, List<ServerEntry> servers) {
|
||||||
ArrayList<EquivalentAddressGroup> addrs = new ArrayList<EquivalentAddressGroup>();
|
ArrayList<EquivalentAddressGroup> addrs = new ArrayList<>();
|
||||||
ArrayList<String> tokens = new ArrayList<String>();
|
ArrayList<String> tokens = new ArrayList<>();
|
||||||
for (ServerEntry server : servers) {
|
for (ServerEntry server : servers) {
|
||||||
addrs.add(new EquivalentAddressGroup(server.addr, LB_BACKEND_ATTRS));
|
addrs.add(new EquivalentAddressGroup(server.addr, LB_BACKEND_ATTRS));
|
||||||
tokens.add(server.token);
|
tokens.add(server.token);
|
||||||
|
@ -1327,7 +1327,7 @@ public class GrpclbLoadBalancerTest {
|
||||||
assertThat(picker.dropList).containsExactlyElementsIn(Collections.nCopies(addrs.size(), null));
|
assertThat(picker.dropList).containsExactlyElementsIn(Collections.nCopies(addrs.size(), null));
|
||||||
assertThat(picker.pickList).containsExactly(GrpclbState.BUFFER_ENTRY);
|
assertThat(picker.pickList).containsExactly(GrpclbState.BUFFER_ENTRY);
|
||||||
assertEquals(addrs.size(), mockSubchannels.size());
|
assertEquals(addrs.size(), mockSubchannels.size());
|
||||||
ArrayList<Subchannel> subchannels = new ArrayList<Subchannel>(mockSubchannels);
|
ArrayList<Subchannel> subchannels = new ArrayList<>(mockSubchannels);
|
||||||
mockSubchannels.clear();
|
mockSubchannels.clear();
|
||||||
for (Subchannel subchannel : subchannels) {
|
for (Subchannel subchannel : subchannels) {
|
||||||
deliverSubchannelState(subchannel, ConnectivityStateInfo.forNonError(CONNECTING));
|
deliverSubchannelState(subchannel, ConnectivityStateInfo.forNonError(CONNECTING));
|
||||||
|
@ -1337,7 +1337,7 @@ public class GrpclbLoadBalancerTest {
|
||||||
inOrder.verify(helper, never())
|
inOrder.verify(helper, never())
|
||||||
.updateBalancingState(any(ConnectivityState.class), any(SubchannelPicker.class));
|
.updateBalancingState(any(ConnectivityState.class), any(SubchannelPicker.class));
|
||||||
|
|
||||||
ArrayList<BackendEntry> pickList = new ArrayList<BackendEntry>();
|
ArrayList<BackendEntry> pickList = new ArrayList<>();
|
||||||
for (int i = 0; i < addrs.size(); i++) {
|
for (int i = 0; i < addrs.size(); i++) {
|
||||||
Subchannel subchannel = subchannels.get(i);
|
Subchannel subchannel = subchannels.get(i);
|
||||||
BackendEntry backend;
|
BackendEntry backend;
|
||||||
|
@ -1521,7 +1521,7 @@ public class GrpclbLoadBalancerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<EquivalentAddressGroup> createResolvedServerAddresses(boolean ... isLb) {
|
private static List<EquivalentAddressGroup> createResolvedServerAddresses(boolean ... isLb) {
|
||||||
ArrayList<EquivalentAddressGroup> list = new ArrayList<EquivalentAddressGroup>();
|
ArrayList<EquivalentAddressGroup> list = new ArrayList<>();
|
||||||
for (int i = 0; i < isLb.length; i++) {
|
for (int i = 0; i < isLb.length; i++) {
|
||||||
SocketAddress addr = new FakeSocketAddress("fake-address-" + i);
|
SocketAddress addr = new FakeSocketAddress("fake-address-" + i);
|
||||||
EquivalentAddressGroup eag =
|
EquivalentAddressGroup eag =
|
||||||
|
|
|
@ -824,7 +824,7 @@ public abstract class AbstractInteropTest {
|
||||||
|
|
||||||
final int numRequests = 10;
|
final int numRequests = 10;
|
||||||
List<StreamingOutputCallRequest> requests =
|
List<StreamingOutputCallRequest> requests =
|
||||||
new ArrayList<StreamingOutputCallRequest>(numRequests);
|
new ArrayList<>(numRequests);
|
||||||
for (int ix = numRequests; ix > 0; --ix) {
|
for (int ix = numRequests; ix > 0; --ix) {
|
||||||
requests.add(request);
|
requests.add(request);
|
||||||
requestStream.onNext(request);
|
requestStream.onNext(request);
|
||||||
|
@ -863,7 +863,7 @@ public abstract class AbstractInteropTest {
|
||||||
|
|
||||||
final int numRequests = 10;
|
final int numRequests = 10;
|
||||||
List<StreamingOutputCallRequest> requests =
|
List<StreamingOutputCallRequest> requests =
|
||||||
new ArrayList<StreamingOutputCallRequest>(numRequests);
|
new ArrayList<>(numRequests);
|
||||||
for (int ix = numRequests; ix > 0; --ix) {
|
for (int ix = numRequests; ix > 0; --ix) {
|
||||||
requests.add(request);
|
requests.add(request);
|
||||||
requestStream.onNext(request);
|
requestStream.onNext(request);
|
||||||
|
@ -1030,7 +1030,7 @@ public abstract class AbstractInteropTest {
|
||||||
|
|
||||||
final int numRequests = 10;
|
final int numRequests = 10;
|
||||||
List<StreamingOutputCallRequest> requests =
|
List<StreamingOutputCallRequest> requests =
|
||||||
new ArrayList<StreamingOutputCallRequest>(numRequests);
|
new ArrayList<>(numRequests);
|
||||||
|
|
||||||
for (int ix = numRequests; ix > 0; --ix) {
|
for (int ix = numRequests; ix > 0; --ix) {
|
||||||
requests.add(request);
|
requests.add(request);
|
||||||
|
|
|
@ -282,7 +282,7 @@ public final class Http2Client {
|
||||||
|
|
||||||
private class RstStreamObserver implements StreamObserver<SimpleResponse> {
|
private class RstStreamObserver implements StreamObserver<SimpleResponse> {
|
||||||
private final CountDownLatch latch = new CountDownLatch(1);
|
private final CountDownLatch latch = new CountDownLatch(1);
|
||||||
private final List<SimpleResponse> responses = new ArrayList<SimpleResponse>();
|
private final List<SimpleResponse> responses = new ArrayList<>();
|
||||||
private Throwable error;
|
private Throwable error;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class StressTestClient {
|
||||||
|
|
||||||
private List<InetSocketAddress> addresses =
|
private List<InetSocketAddress> addresses =
|
||||||
singletonList(new InetSocketAddress("localhost", 8080));
|
singletonList(new InetSocketAddress("localhost", 8080));
|
||||||
private List<TestCaseWeightPair> testCaseWeightPairs = new ArrayList<TestCaseWeightPair>();
|
private List<TestCaseWeightPair> testCaseWeightPairs = new ArrayList<>();
|
||||||
|
|
||||||
private String serverHostOverride;
|
private String serverHostOverride;
|
||||||
private boolean useTls = false;
|
private boolean useTls = false;
|
||||||
|
@ -118,7 +118,7 @@ public class StressTestClient {
|
||||||
*/
|
*/
|
||||||
private final List<ListenableFuture<?>> workerFutures =
|
private final List<ListenableFuture<?>> workerFutures =
|
||||||
new ArrayList<ListenableFuture<?>>();
|
new ArrayList<ListenableFuture<?>>();
|
||||||
private final List<ManagedChannel> channels = new ArrayList<ManagedChannel>();
|
private final List<ManagedChannel> channels = new ArrayList<>();
|
||||||
private ListeningExecutorService threadpool;
|
private ListeningExecutorService threadpool;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@ -291,7 +291,7 @@ public class StressTestClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<InetSocketAddress> parseServerAddresses(String addressesStr) {
|
private List<InetSocketAddress> parseServerAddresses(String addressesStr) {
|
||||||
List<InetSocketAddress> addresses = new ArrayList<InetSocketAddress>();
|
List<InetSocketAddress> addresses = new ArrayList<>();
|
||||||
|
|
||||||
for (List<String> namePort : parseCommaSeparatedTuples(addressesStr)) {
|
for (List<String> namePort : parseCommaSeparatedTuples(addressesStr)) {
|
||||||
InetAddress address;
|
InetAddress address;
|
||||||
|
@ -313,7 +313,7 @@ public class StressTestClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<TestCaseWeightPair> parseTestCases(String testCasesStr) {
|
private static List<TestCaseWeightPair> parseTestCases(String testCasesStr) {
|
||||||
List<TestCaseWeightPair> testCaseWeightPairs = new ArrayList<TestCaseWeightPair>();
|
List<TestCaseWeightPair> testCaseWeightPairs = new ArrayList<>();
|
||||||
|
|
||||||
for (List<String> nameWeight : parseCommaSeparatedTuples(testCasesStr)) {
|
for (List<String> nameWeight : parseCommaSeparatedTuples(testCasesStr)) {
|
||||||
TestCases testCase = TestCases.fromString(nameWeight.get(0));
|
TestCases testCase = TestCases.fromString(nameWeight.get(0));
|
||||||
|
@ -355,7 +355,7 @@ public class StressTestClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String serverAddressesToString(List<InetSocketAddress> addresses) {
|
private static String serverAddressesToString(List<InetSocketAddress> addresses) {
|
||||||
List<String> tmp = new ArrayList<String>();
|
List<String> tmp = new ArrayList<>();
|
||||||
for (InetSocketAddress address : addresses) {
|
for (InetSocketAddress address : addresses) {
|
||||||
URI uri;
|
URI uri;
|
||||||
try {
|
try {
|
||||||
|
@ -541,7 +541,7 @@ public class StressTestClient {
|
||||||
Preconditions.checkNotNull(testCaseWeightPairs, "testCaseWeightPairs");
|
Preconditions.checkNotNull(testCaseWeightPairs, "testCaseWeightPairs");
|
||||||
Preconditions.checkArgument(testCaseWeightPairs.size() > 0);
|
Preconditions.checkArgument(testCaseWeightPairs.size() > 0);
|
||||||
|
|
||||||
List<TestCases> testCases = new ArrayList<TestCases>();
|
List<TestCases> testCases = new ArrayList<>();
|
||||||
for (TestCaseWeightPair testCaseWeightPair : testCaseWeightPairs) {
|
for (TestCaseWeightPair testCaseWeightPair : testCaseWeightPairs) {
|
||||||
for (int i = 0; i < testCaseWeightPair.weight; i++) {
|
for (int i = 0; i < testCaseWeightPair.weight; i++) {
|
||||||
testCases.add(testCaseWeightPair.testCase);
|
testCases.add(testCaseWeightPair.testCase);
|
||||||
|
|
|
@ -132,7 +132,7 @@ class GrpcHttp2HeadersUtils {
|
||||||
@Override
|
@Override
|
||||||
public List<CharSequence> getAll(CharSequence csName) {
|
public List<CharSequence> getAll(CharSequence csName) {
|
||||||
AsciiString name = requireAsciiString(csName);
|
AsciiString name = requireAsciiString(csName);
|
||||||
List<CharSequence> returnValues = new ArrayList<CharSequence>(4);
|
List<CharSequence> returnValues = new ArrayList<>(4);
|
||||||
for (int i = 0; i < namesAndValuesIdx; i += 2) {
|
for (int i = 0; i < namesAndValuesIdx; i += 2) {
|
||||||
if (equals(name, namesAndValues[i])) {
|
if (equals(name, namesAndValues[i])) {
|
||||||
returnValues.add(values[i / 2]);
|
returnValues.add(values[i / 2]);
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class NettyClientTransportTest {
|
||||||
@Mock
|
@Mock
|
||||||
private ManagedClientTransport.Listener clientTransportListener;
|
private ManagedClientTransport.Listener clientTransportListener;
|
||||||
|
|
||||||
private final List<NettyClientTransport> transports = new ArrayList<NettyClientTransport>();
|
private final List<NettyClientTransport> transports = new ArrayList<>();
|
||||||
private final NioEventLoopGroup group = new NioEventLoopGroup(1);
|
private final NioEventLoopGroup group = new NioEventLoopGroup(1);
|
||||||
private final EchoServerListener serverListener = new EchoServerListener();
|
private final EchoServerListener serverListener = new EchoServerListener();
|
||||||
private final InternalChannelz channelz = new InternalChannelz();
|
private final InternalChannelz channelz = new InternalChannelz();
|
||||||
|
@ -236,7 +236,7 @@ public class NettyClientTransportTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a single RPC on each transport.
|
// Send a single RPC on each transport.
|
||||||
final List<Rpc> rpcs = new ArrayList<Rpc>(transports.size());
|
final List<Rpc> rpcs = new ArrayList<>(transports.size());
|
||||||
for (NettyClientTransport transport : transports) {
|
for (NettyClientTransport transport : transports) {
|
||||||
rpcs.add(new Rpc(transport).halfClose());
|
rpcs.add(new Rpc(transport).halfClose());
|
||||||
}
|
}
|
||||||
|
@ -750,7 +750,7 @@ public class NettyClientTransportTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class EchoServerListener implements ServerListener {
|
private static final class EchoServerListener implements ServerListener {
|
||||||
final List<NettyServerTransport> transports = new ArrayList<NettyServerTransport>();
|
final List<NettyServerTransport> transports = new ArrayList<>();
|
||||||
final List<EchoServerStreamListener> streamListeners =
|
final List<EchoServerStreamListener> streamListeners =
|
||||||
Collections.synchronizedList(new ArrayList<EchoServerStreamListener>());
|
Collections.synchronizedList(new ArrayList<EchoServerStreamListener>());
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Headers {
|
||||||
headers.discardAll(GrpcUtil.USER_AGENT_KEY);
|
headers.discardAll(GrpcUtil.USER_AGENT_KEY);
|
||||||
|
|
||||||
// 7 is the number of explicit add calls below.
|
// 7 is the number of explicit add calls below.
|
||||||
List<Header> okhttpHeaders = new ArrayList<Header>(7 + InternalMetadata.headerCount(headers));
|
List<Header> okhttpHeaders = new ArrayList<>(7 + InternalMetadata.headerCount(headers));
|
||||||
|
|
||||||
// Set GRPC-specific headers.
|
// Set GRPC-specific headers.
|
||||||
okhttpHeaders.add(SCHEME_HEADER);
|
okhttpHeaders.add(SCHEME_HEADER);
|
||||||
|
|
|
@ -1938,7 +1938,7 @@ public class OkHttpClientTransportTest {
|
||||||
Metadata trailers;
|
Metadata trailers;
|
||||||
RpcProgress rpcProgress;
|
RpcProgress rpcProgress;
|
||||||
CountDownLatch closed = new CountDownLatch(1);
|
CountDownLatch closed = new CountDownLatch(1);
|
||||||
ArrayList<String> messages = new ArrayList<String>();
|
ArrayList<String> messages = new ArrayList<>();
|
||||||
boolean onReadyCalled;
|
boolean onReadyCalled;
|
||||||
|
|
||||||
MockStreamListener() {
|
MockStreamListener() {
|
||||||
|
|
|
@ -123,14 +123,14 @@ public final class OkHostnameVerifier implements HostnameVerifier {
|
||||||
public static List<String> allSubjectAltNames(X509Certificate certificate) {
|
public static List<String> allSubjectAltNames(X509Certificate certificate) {
|
||||||
List<String> altIpaNames = getSubjectAltNames(certificate, ALT_IPA_NAME);
|
List<String> altIpaNames = getSubjectAltNames(certificate, ALT_IPA_NAME);
|
||||||
List<String> altDnsNames = getSubjectAltNames(certificate, ALT_DNS_NAME);
|
List<String> altDnsNames = getSubjectAltNames(certificate, ALT_DNS_NAME);
|
||||||
List<String> result = new ArrayList<String>(altIpaNames.size() + altDnsNames.size());
|
List<String> result = new ArrayList<>(altIpaNames.size() + altDnsNames.size());
|
||||||
result.addAll(altIpaNames);
|
result.addAll(altIpaNames);
|
||||||
result.addAll(altDnsNames);
|
result.addAll(altDnsNames);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<String> getSubjectAltNames(X509Certificate certificate, int type) {
|
private static List<String> getSubjectAltNames(X509Certificate certificate, int type) {
|
||||||
List<String> result = new ArrayList<String>();
|
List<String> result = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
Collection<?> subjectAltNames = certificate.getSubjectAlternativeNames();
|
Collection<?> subjectAltNames = certificate.getSubjectAlternativeNames();
|
||||||
if (subjectAltNames == null) {
|
if (subjectAltNames == null) {
|
||||||
|
|
|
@ -449,7 +449,7 @@ public class Platform {
|
||||||
public void configureTlsExtensions(
|
public void configureTlsExtensions(
|
||||||
SSLSocket sslSocket, String hostname, List<Protocol> protocols) {
|
SSLSocket sslSocket, String hostname, List<Protocol> protocols) {
|
||||||
SSLParameters parameters = sslSocket.getSSLParameters();
|
SSLParameters parameters = sslSocket.getSSLParameters();
|
||||||
List<String> names = new ArrayList<String>(protocols.size());
|
List<String> names = new ArrayList<>(protocols.size());
|
||||||
for (Protocol protocol : protocols) {
|
for (Protocol protocol : protocols) {
|
||||||
if (protocol == Protocol.HTTP_1_0) continue; // No HTTP/1.0 for ALPN.
|
if (protocol == Protocol.HTTP_1_0) continue; // No HTTP/1.0 for ALPN.
|
||||||
names.add(protocol.toString());
|
names.add(protocol.toString());
|
||||||
|
@ -505,7 +505,7 @@ public class Platform {
|
||||||
|
|
||||||
@Override public void configureTlsExtensions(
|
@Override public void configureTlsExtensions(
|
||||||
SSLSocket sslSocket, String hostname, List<Protocol> protocols) {
|
SSLSocket sslSocket, String hostname, List<Protocol> protocols) {
|
||||||
List<String> names = new ArrayList<String>(protocols.size());
|
List<String> names = new ArrayList<>(protocols.size());
|
||||||
for (int i = 0, size = protocols.size(); i < size; i++) {
|
for (int i = 0, size = protocols.size(); i < size; i++) {
|
||||||
Protocol protocol = protocols.get(i);
|
Protocol protocol = protocols.get(i);
|
||||||
if (protocol == Protocol.HTTP_1_0) continue; // No HTTP/1.0 for ALPN.
|
if (protocol == Protocol.HTTP_1_0) continue; // No HTTP/1.0 for ALPN.
|
||||||
|
|
|
@ -212,7 +212,7 @@ public final class Util {
|
||||||
|
|
||||||
/** Returns an immutable copy of {@code list}. */
|
/** Returns an immutable copy of {@code list}. */
|
||||||
public static <T> List<T> immutableList(List<T> list) {
|
public static <T> List<T> immutableList(List<T> list) {
|
||||||
return Collections.unmodifiableList(new ArrayList<T>(list));
|
return Collections.unmodifiableList(new ArrayList<>(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns an immutable list containing {@code elements}. */
|
/** Returns an immutable list containing {@code elements}. */
|
||||||
|
@ -250,7 +250,7 @@ public final class Util {
|
||||||
* {@code second}. The returned elements are in the same order as in {@code first}.
|
* {@code second}. The returned elements are in the same order as in {@code first}.
|
||||||
*/
|
*/
|
||||||
private static <T> List<T> intersect(T[] first, T[] second) {
|
private static <T> List<T> intersect(T[] first, T[] second) {
|
||||||
List<T> result = new ArrayList<T>();
|
List<T> result = new ArrayList<>();
|
||||||
for (T a : first) {
|
for (T a : first) {
|
||||||
for (T b : second) {
|
for (T b : second) {
|
||||||
if (a.equals(b)) {
|
if (a.equals(b)) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ import static org.junit.Assert.fail;
|
||||||
public class HpackTest {
|
public class HpackTest {
|
||||||
|
|
||||||
private static List<Header> headerEntries(String... elements) {
|
private static List<Header> headerEntries(String... elements) {
|
||||||
List<Header> result = new ArrayList<Header>(elements.length / 2);
|
List<Header> result = new ArrayList<>(elements.length / 2);
|
||||||
for (int i = 0; i < elements.length; i += 2) {
|
for (int i = 0; i < elements.length; i += 2) {
|
||||||
result.add(new Header(elements[i], elements[i + 1]));
|
result.add(new Header(elements[i], elements[i + 1]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,7 +323,7 @@ final class ChannelzProtoUtil {
|
||||||
|
|
||||||
static List<SocketOption> toSocketOptionsList(InternalChannelz.SocketOptions options) {
|
static List<SocketOption> toSocketOptionsList(InternalChannelz.SocketOptions options) {
|
||||||
Preconditions.checkNotNull(options);
|
Preconditions.checkNotNull(options);
|
||||||
List<SocketOption> ret = new ArrayList<SocketOption>();
|
List<SocketOption> ret = new ArrayList<>();
|
||||||
if (options.lingerSeconds != null) {
|
if (options.lingerSeconds != null) {
|
||||||
ret.add(toSocketOptionLinger(options.lingerSeconds));
|
ret.add(toSocketOptionLinger(options.lingerSeconds));
|
||||||
}
|
}
|
||||||
|
@ -379,7 +379,7 @@ final class ChannelzProtoUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<ChannelTraceEvent> toChannelTraceEvents(List<Event> events) {
|
private static List<ChannelTraceEvent> toChannelTraceEvents(List<Event> events) {
|
||||||
List<ChannelTraceEvent> channelTraceEvents = new ArrayList<ChannelTraceEvent>();
|
List<ChannelTraceEvent> channelTraceEvents = new ArrayList<>();
|
||||||
for (Event event : events) {
|
for (Event event : events) {
|
||||||
ChannelTraceEvent.Builder builder = ChannelTraceEvent.newBuilder()
|
ChannelTraceEvent.Builder builder = ChannelTraceEvent.newBuilder()
|
||||||
.setDescription(event.description)
|
.setDescription(event.description)
|
||||||
|
|
|
@ -589,7 +589,7 @@ public class ProtoReflectionServiceTest {
|
||||||
private static class FlowControlClientResponseObserver
|
private static class FlowControlClientResponseObserver
|
||||||
implements ClientResponseObserver<ServerReflectionRequest, ServerReflectionResponse> {
|
implements ClientResponseObserver<ServerReflectionRequest, ServerReflectionResponse> {
|
||||||
private final List<ServerReflectionResponse> responses =
|
private final List<ServerReflectionResponse> responses =
|
||||||
new ArrayList<ServerReflectionResponse>();
|
new ArrayList<>();
|
||||||
private boolean onCompleteCalled = false;
|
private boolean onCompleteCalled = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -146,7 +146,7 @@ public class BinaryLogProviderTest {
|
||||||
};
|
};
|
||||||
Channel wChannel = binlogProvider.wrapChannel(channel);
|
Channel wChannel = binlogProvider.wrapChannel(channel);
|
||||||
ClientCall<String, Integer> clientCall = wChannel.newCall(method, CallOptions.DEFAULT);
|
ClientCall<String, Integer> clientCall = wChannel.newCall(method, CallOptions.DEFAULT);
|
||||||
final List<Integer> observedResponse = new ArrayList<Integer>();
|
final List<Integer> observedResponse = new ArrayList<>();
|
||||||
clientCall.start(
|
clientCall.start(
|
||||||
new NoopClientCall.NoopClientCallListener<Integer>() {
|
new NoopClientCall.NoopClientCallListener<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -224,7 +224,7 @@ public class BinaryLogProviderTest {
|
||||||
@Test
|
@Test
|
||||||
public void wrapMethodDefinition_handler() throws Exception {
|
public void wrapMethodDefinition_handler() throws Exception {
|
||||||
// The request as seen by the user supplied server code
|
// The request as seen by the user supplied server code
|
||||||
final List<String> observedRequest = new ArrayList<String>();
|
final List<String> observedRequest = new ArrayList<>();
|
||||||
final AtomicReference<ServerCall<String, Integer>> serverCall =
|
final AtomicReference<ServerCall<String, Integer>> serverCall =
|
||||||
new AtomicReference<ServerCall<String, Integer>>();
|
new AtomicReference<ServerCall<String, Integer>>();
|
||||||
ServerMethodDefinition<String, Integer> methodDef =
|
ServerMethodDefinition<String, Integer> methodDef =
|
||||||
|
@ -244,7 +244,7 @@ public class BinaryLogProviderTest {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ServerMethodDefinition<?, ?> wDef = binlogProvider.wrapMethodDefinition(methodDef);
|
ServerMethodDefinition<?, ?> wDef = binlogProvider.wrapMethodDefinition(methodDef);
|
||||||
List<Object> serializedResp = new ArrayList<Object>();
|
List<Object> serializedResp = new ArrayList<>();
|
||||||
ServerCall.Listener<?> wListener = startServerCallHelper(wDef, serializedResp);
|
ServerCall.Listener<?> wListener = startServerCallHelper(wDef, serializedResp);
|
||||||
|
|
||||||
String expectedRequest = "hello world";
|
String expectedRequest = "hello world";
|
||||||
|
|
|
@ -244,7 +244,7 @@ public class ClientCallsTest {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
final AtomicReference<ClientCall.Listener<String>> listener =
|
final AtomicReference<ClientCall.Listener<String>> listener =
|
||||||
new AtomicReference<ClientCall.Listener<String>>();
|
new AtomicReference<ClientCall.Listener<String>>();
|
||||||
final List<Integer> requests = new ArrayList<Integer>();
|
final List<Integer> requests = new ArrayList<>();
|
||||||
NoopClientCall<Integer, String> call = new NoopClientCall<Integer, String>() {
|
NoopClientCall<Integer, String> call = new NoopClientCall<Integer, String>() {
|
||||||
@Override
|
@Override
|
||||||
public void start(io.grpc.ClientCall.Listener<String> responseListener, Metadata headers) {
|
public void start(io.grpc.ClientCall.Listener<String> responseListener, Metadata headers) {
|
||||||
|
@ -305,7 +305,7 @@ public class ClientCallsTest {
|
||||||
};
|
};
|
||||||
final AtomicReference<ClientCall.Listener<String>> listener =
|
final AtomicReference<ClientCall.Listener<String>> listener =
|
||||||
new AtomicReference<ClientCall.Listener<String>>();
|
new AtomicReference<ClientCall.Listener<String>>();
|
||||||
final List<Integer> requests = new ArrayList<Integer>();
|
final List<Integer> requests = new ArrayList<>();
|
||||||
NoopClientCall<Integer, String> call = new NoopClientCall<Integer, String>() {
|
NoopClientCall<Integer, String> call = new NoopClientCall<Integer, String>() {
|
||||||
@Override
|
@Override
|
||||||
public void start(io.grpc.ClientCall.Listener<String> responseListener, Metadata headers) {
|
public void start(io.grpc.ClientCall.Listener<String> responseListener, Metadata headers) {
|
||||||
|
@ -351,7 +351,7 @@ public class ClientCallsTest {
|
||||||
};
|
};
|
||||||
final AtomicReference<ClientCall.Listener<String>> listener =
|
final AtomicReference<ClientCall.Listener<String>> listener =
|
||||||
new AtomicReference<ClientCall.Listener<String>>();
|
new AtomicReference<ClientCall.Listener<String>>();
|
||||||
final List<Integer> requests = new ArrayList<Integer>();
|
final List<Integer> requests = new ArrayList<>();
|
||||||
NoopClientCall<Integer, String> call = new NoopClientCall<Integer, String>() {
|
NoopClientCall<Integer, String> call = new NoopClientCall<Integer, String>() {
|
||||||
@Override
|
@Override
|
||||||
public void start(io.grpc.ClientCall.Listener<String> responseListener, Metadata headers) {
|
public void start(io.grpc.ClientCall.Listener<String> responseListener, Metadata headers) {
|
||||||
|
@ -407,7 +407,7 @@ public class ClientCallsTest {
|
||||||
final ClientCall<Integer, Integer> clientCall = channel.newCall(STREAMING_METHOD,
|
final ClientCall<Integer, Integer> clientCall = channel.newCall(STREAMING_METHOD,
|
||||||
CallOptions.DEFAULT);
|
CallOptions.DEFAULT);
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
final List<Object> receivedMessages = new ArrayList<Object>(6);
|
final List<Object> receivedMessages = new ArrayList<>(6);
|
||||||
|
|
||||||
ClientResponseObserver<Integer, Integer> responseObserver =
|
ClientResponseObserver<Integer, Integer> responseObserver =
|
||||||
new ClientResponseObserver<Integer, Integer>() {
|
new ClientResponseObserver<Integer, Integer>() {
|
||||||
|
@ -449,7 +449,7 @@ public class ClientCallsTest {
|
||||||
@Test
|
@Test
|
||||||
public void inprocessTransportOutboundFlowControl() throws Exception {
|
public void inprocessTransportOutboundFlowControl() throws Exception {
|
||||||
final Semaphore semaphore = new Semaphore(0);
|
final Semaphore semaphore = new Semaphore(0);
|
||||||
final List<Object> receivedMessages = new ArrayList<Object>(6);
|
final List<Object> receivedMessages = new ArrayList<>(6);
|
||||||
final SettableFuture<ServerCallStreamObserver<Integer>> observerFuture
|
final SettableFuture<ServerCallStreamObserver<Integer>> observerFuture
|
||||||
= SettableFuture.create();
|
= SettableFuture.create();
|
||||||
ServerServiceDefinition service = ServerServiceDefinition.builder(
|
ServerServiceDefinition service = ServerServiceDefinition.builder(
|
||||||
|
|
|
@ -461,8 +461,8 @@ public class ServerCallsTest {
|
||||||
|
|
||||||
private static class ServerCallRecorder extends ServerCall<Integer, Integer> {
|
private static class ServerCallRecorder extends ServerCall<Integer, Integer> {
|
||||||
private final MethodDescriptor<Integer, Integer> methodDescriptor;
|
private final MethodDescriptor<Integer, Integer> methodDescriptor;
|
||||||
private final List<Integer> requestCalls = new ArrayList<Integer>();
|
private final List<Integer> requestCalls = new ArrayList<>();
|
||||||
private final List<Integer> responses = new ArrayList<Integer>();
|
private final List<Integer> responses = new ArrayList<>();
|
||||||
private Metadata headers;
|
private Metadata headers;
|
||||||
private Metadata trailers;
|
private Metadata trailers;
|
||||||
private Status status;
|
private Status status;
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class TestUtils {
|
||||||
} catch (NoSuchAlgorithmException ex) {
|
} catch (NoSuchAlgorithmException ex) {
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
}
|
}
|
||||||
List<String> ciphersMinusGcm = new ArrayList<String>();
|
List<String> ciphersMinusGcm = new ArrayList<>();
|
||||||
for (String cipher : ciphers) {
|
for (String cipher : ciphers) {
|
||||||
// The GCM implementation in Java is _very_ slow (~1 MB/s)
|
// The GCM implementation in Java is _very_ slow (~1 MB/s)
|
||||||
if (cipher.contains("_GCM_")) {
|
if (cipher.contains("_GCM_")) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ import org.junit.runners.model.Statement;
|
||||||
@NotThreadSafe
|
@NotThreadSafe
|
||||||
public final class GrpcCleanupRule implements TestRule {
|
public final class GrpcCleanupRule implements TestRule {
|
||||||
|
|
||||||
private final List<Resource> resources = new ArrayList<Resource>();
|
private final List<Resource> resources = new ArrayList<>();
|
||||||
private long timeoutNanos = TimeUnit.SECONDS.toNanos(10L);
|
private long timeoutNanos = TimeUnit.SECONDS.toNanos(10L);
|
||||||
private Stopwatch stopwatch = Stopwatch.createUnstarted();
|
private Stopwatch stopwatch = Stopwatch.createUnstarted();
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class TestUtils {
|
||||||
} catch (NoSuchAlgorithmException ex) {
|
} catch (NoSuchAlgorithmException ex) {
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
}
|
}
|
||||||
List<String> ciphersMinusGcm = new ArrayList<String>();
|
List<String> ciphersMinusGcm = new ArrayList<>();
|
||||||
for (String cipher : ciphers) {
|
for (String cipher : ciphers) {
|
||||||
// The GCM implementation in Java is _very_ slow (~1 MB/s)
|
// The GCM implementation in Java is _very_ slow (~1 MB/s)
|
||||||
if (cipher.contains("_GCM_")) {
|
if (cipher.contains("_GCM_")) {
|
||||||
|
|
Loading…
Reference in New Issue