Remove deprecated enableKeepAlive API from transports

As mentioned in 5188[1], the default used with the enableKeepAlive API
conflicted with the default server enforcement. Instead of fixing it,
remove it. These APIs were deprecated in v1.3.0 in April 2017.

1. https://github.com/grpc/grpc-java/issues/5188#issuecomment-482269303
This commit is contained in:
Eric Anderson 2019-05-28 08:58:51 -07:00
parent 77a512551f
commit 2cbc540cb3
3 changed files with 0 additions and 65 deletions

View File

@ -204,11 +204,6 @@ public final class GrpcUtil {
private static final String IMPLEMENTATION_VERSION = "1.22.0-SNAPSHOT"; // CURRENT_GRPC_VERSION
/**
* The default delay in nanos before we send a keepalive.
*/
public static final long DEFAULT_KEEPALIVE_TIME_NANOS = TimeUnit.MINUTES.toNanos(1);
/**
* The default timeout in nanos for a keepalive ping request.
*/

View File

@ -20,7 +20,6 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import static io.grpc.internal.GrpcUtil.DEFAULT_KEEPALIVE_TIMEOUT_NANOS;
import static io.grpc.internal.GrpcUtil.DEFAULT_KEEPALIVE_TIME_NANOS;
import static io.grpc.internal.GrpcUtil.KEEPALIVE_TIME_NANOS_DISABLED;
import com.google.common.annotations.VisibleForTesting;
@ -318,34 +317,6 @@ public final class NettyChannelBuilder
return this;
}
/**
* Enable keepalive with default delay and timeout.
*
* @deprecated Please use {@link #keepAliveTime} and {@link #keepAliveTimeout} instead
*/
@Deprecated
public final NettyChannelBuilder enableKeepAlive(boolean enable) {
if (enable) {
return keepAliveTime(DEFAULT_KEEPALIVE_TIME_NANOS, TimeUnit.NANOSECONDS);
}
return keepAliveTime(KEEPALIVE_TIME_NANOS_DISABLED, TimeUnit.NANOSECONDS);
}
/**
* Enable keepalive with custom delay and timeout.
*
* @deprecated Please use {@link #keepAliveTime} and {@link #keepAliveTimeout} instead
*/
@Deprecated
public final NettyChannelBuilder enableKeepAlive(boolean enable, long keepAliveTime,
TimeUnit delayUnit, long keepAliveTimeout, TimeUnit timeoutUnit) {
if (enable) {
return keepAliveTime(keepAliveTime, delayUnit)
.keepAliveTimeout(keepAliveTimeout, timeoutUnit);
}
return keepAliveTime(KEEPALIVE_TIME_NANOS_DISABLED, TimeUnit.NANOSECONDS);
}
/**
* {@inheritDoc}
*

View File

@ -18,7 +18,6 @@ package io.grpc.okhttp;
import static com.google.common.base.Preconditions.checkNotNull;
import static io.grpc.internal.GrpcUtil.DEFAULT_KEEPALIVE_TIMEOUT_NANOS;
import static io.grpc.internal.GrpcUtil.DEFAULT_KEEPALIVE_TIME_NANOS;
import static io.grpc.internal.GrpcUtil.KEEPALIVE_TIME_NANOS_DISABLED;
import com.google.common.annotations.VisibleForTesting;
@ -198,36 +197,6 @@ public class OkHttpChannelBuilder extends
return this;
}
/**
* Enable keepalive with default delay and timeout.
*
* @deprecated Use {@link #keepAliveTime} instead
*/
@Deprecated
public final OkHttpChannelBuilder enableKeepAlive(boolean enable) {
if (enable) {
return keepAliveTime(DEFAULT_KEEPALIVE_TIME_NANOS, TimeUnit.NANOSECONDS);
} else {
return keepAliveTime(KEEPALIVE_TIME_NANOS_DISABLED, TimeUnit.NANOSECONDS);
}
}
/**
* Enable keepalive with custom delay and timeout.
*
* @deprecated Use {@link #keepAliveTime} and {@link #keepAliveTimeout} instead
*/
@Deprecated
public final OkHttpChannelBuilder enableKeepAlive(boolean enable, long keepAliveTime,
TimeUnit delayUnit, long keepAliveTimeout, TimeUnit timeoutUnit) {
if (enable) {
return keepAliveTime(keepAliveTime, delayUnit)
.keepAliveTimeout(keepAliveTimeout, timeoutUnit);
} else {
return keepAliveTime(KEEPALIVE_TIME_NANOS_DISABLED, TimeUnit.NANOSECONDS);
}
}
/**
* {@inheritDoc}
*