mirror of https://github.com/grpc/grpc-java.git
android: delete deprecated API methods (#6088)
This commit is contained in:
parent
be226aa99c
commit
493af030ab
|
|
@ -37,12 +37,9 @@ import io.grpc.ManagedChannel;
|
||||||
import io.grpc.ManagedChannelBuilder;
|
import io.grpc.ManagedChannelBuilder;
|
||||||
import io.grpc.MethodDescriptor;
|
import io.grpc.MethodDescriptor;
|
||||||
import io.grpc.internal.GrpcUtil;
|
import io.grpc.internal.GrpcUtil;
|
||||||
import java.util.concurrent.Executor;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.annotation.concurrent.GuardedBy;
|
import javax.annotation.concurrent.GuardedBy;
|
||||||
import javax.net.ssl.SSLSocketFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds a {@link ManagedChannel} that, when provided with a {@link Context}, will automatically
|
* Builds a {@link ManagedChannel} that, when provided with a {@link Context}, will automatically
|
||||||
|
|
@ -139,62 +136,6 @@ public final class AndroidChannelBuilder extends ForwardingChannelBuilder<Androi
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the delegate channel builder's transportExecutor.
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link #usingBuilder(ManagedChannelBuilder)} with a pre-configured
|
|
||||||
* ManagedChannelBuilder instead.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public AndroidChannelBuilder transportExecutor(@Nullable Executor transportExecutor) {
|
|
||||||
try {
|
|
||||||
OKHTTP_CHANNEL_BUILDER_CLASS
|
|
||||||
.getMethod("transportExecutor", Executor.class)
|
|
||||||
.invoke(delegateBuilder, transportExecutor);
|
|
||||||
return this;
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException("Failed to invoke transportExecutor on delegate builder", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the delegate channel builder's sslSocketFactory.
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link #usingBuilder(ManagedChannelBuilder)} with a pre-configured
|
|
||||||
* ManagedChannelBuilder instead.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public AndroidChannelBuilder sslSocketFactory(SSLSocketFactory factory) {
|
|
||||||
try {
|
|
||||||
OKHTTP_CHANNEL_BUILDER_CLASS
|
|
||||||
.getMethod("sslSocketFactory", SSLSocketFactory.class)
|
|
||||||
.invoke(delegateBuilder, factory);
|
|
||||||
return this;
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException("Failed to invoke sslSocketFactory on delegate builder", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the delegate channel builder's scheduledExecutorService.
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link #usingBuilder(ManagedChannelBuilder)} with a pre-configured
|
|
||||||
* ManagedChannelBuilder instead.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public AndroidChannelBuilder scheduledExecutorService(
|
|
||||||
ScheduledExecutorService scheduledExecutorService) {
|
|
||||||
try {
|
|
||||||
OKHTTP_CHANNEL_BUILDER_CLASS
|
|
||||||
.getMethod("scheduledExecutorService", ScheduledExecutorService.class)
|
|
||||||
.invoke(delegateBuilder, scheduledExecutorService);
|
|
||||||
return this;
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(
|
|
||||||
"Failed to invoke scheduledExecutorService on delegate builder", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ManagedChannelBuilder<?> delegate() {
|
protected ManagedChannelBuilder<?> delegate() {
|
||||||
return delegateBuilder;
|
return delegateBuilder;
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,10 @@ import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.Executor;
|
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import javax.net.ssl.SSLSocketFactory;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
@ -100,27 +98,6 @@ public final class AndroidChannelBuilderTest {
|
||||||
assertThat(androidBuilder.delegate()).isSameInstanceAs(wrappedBuilder);
|
assertThat(androidBuilder.delegate()).isSameInstanceAs(wrappedBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void transportExecutor() {
|
|
||||||
AndroidChannelBuilder.forTarget("target")
|
|
||||||
.transportExecutor(
|
|
||||||
new Executor() {
|
|
||||||
@Override
|
|
||||||
public void execute(Runnable r) {}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void sslSocketFactory() {
|
|
||||||
AndroidChannelBuilder.forTarget("target")
|
|
||||||
.sslSocketFactory((SSLSocketFactory) SSLSocketFactory.getDefault());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void scheduledExecutorService() {
|
|
||||||
AndroidChannelBuilder.forTarget("target").scheduledExecutorService(new ScheduledExecutorImpl());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Config(sdk = 23)
|
@Config(sdk = 23)
|
||||||
public void nullContextDoesNotThrow_api23() {
|
public void nullContextDoesNotThrow_api23() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue