diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/PubSub.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/PubSub.java index 9439e4665baf..43e558347551 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/PubSub.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/PubSub.java @@ -77,66 +77,6 @@ public static ListOption pageToken(String pageToken) { } } - /** - * Class for specifying options for pulling messages. - */ - final class PullOption extends Option { - - private static final long serialVersionUID = 4792164134340316582L; - - enum OptionType implements Option.OptionType { - EXECUTOR_FACTORY, - MAX_QUEUED_CALLBACKS; - - @SuppressWarnings("unchecked") - T get(Map options) { - return (T) options.get(this); - } - - Integer getInteger(Map options) { - return get(options); - } - - ExecutorFactory getExecutorFactory(Map options) { - return get(options); - } - } - - private PullOption(Option.OptionType option, Object value) { - super(option, value); - } - - /** - * Returns an option to specify the maximum number of messages that can be queued in the message - * consumer at any time. Queued messages are already pulled messages that are either waiting to - * be processed or being processed. Queued messages will have their acknowledge deadline renewed - * until they are acknowledged or "nacked". If not provided, at most 100 messages can be in the - * queue. - */ - public static PullOption maxQueuedCallbacks(int maxQueuedCallbacks) { - return new PullOption(OptionType.MAX_QUEUED_CALLBACKS, maxQueuedCallbacks); - } - - /** - * Returns an option to specify the executor used to execute message processor callbacks. The - * executor determines the number of messages that can be processed at the same time. If not - * provided, a single-threaded executor is used to execute message processor callbacks. - * - *

The {@link ExecutorFactory} object can be used to handle creation and release of the - * executor, possibly reusing existing executors. {@link ExecutorFactory#get()} is called when - * the message consumer is created. {@link ExecutorFactory#release(ExecutorService)} is called - * when the message consumer is closed. - * - *

For the created option to be serializable, the provided executor factory should implement - * {@link java.io.Serializable}. - * - * @param executorFactory the executor factory. - */ - public static PullOption executorFactory(ExecutorFactory executorFactory) { - return new PullOption(OptionType.EXECUTOR_FACTORY, executorFactory); - } - } - /** * Creates a new topic. * diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/Subscription.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/Subscription.java index f0f589410300..9e3c96b0ddee 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/Subscription.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/Subscription.java @@ -20,7 +20,6 @@ import com.google.cloud.GrpcServiceOptions; import com.google.cloud.Policy; -import com.google.cloud.pubsub.PubSub.PullOption; import com.google.common.base.Function; import java.io.IOException; diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/PubSubTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/PubSubTest.java index 78322f4eed95..940e35e3f7ad 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/PubSubTest.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/PubSubTest.java @@ -21,7 +21,6 @@ import com.google.cloud.GrpcServiceOptions.ExecutorFactory; import com.google.cloud.pubsub.PubSub.ListOption; -import com.google.cloud.pubsub.PubSub.PullOption; import org.easymock.EasyMock; import org.junit.Test; @@ -43,17 +42,4 @@ public void testListOption() { assertEquals(PAGE_SIZE, listOption.getValue()); assertEquals(ListOption.OptionType.PAGE_SIZE, listOption.getOptionType()); } - - @Test - @SuppressWarnings("unchecked") - public void testPullOptions() { - // max queued callbacks - PullOption pullOption = PullOption.maxQueuedCallbacks(MAX_QUEUED_CALLBACKS); - assertEquals(MAX_QUEUED_CALLBACKS, pullOption.getValue()); - assertEquals(PullOption.OptionType.MAX_QUEUED_CALLBACKS, pullOption.getOptionType()); - ExecutorFactory executorFactory = EasyMock.createStrictMock(ExecutorFactory.class); - pullOption = PullOption.executorFactory(executorFactory); - assertSame(executorFactory, pullOption.getValue()); - assertEquals(PullOption.OptionType.EXECUTOR_FACTORY, pullOption.getOptionType()); - } } diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/SerializationTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/SerializationTest.java index d22940800a29..3b8e63b7b717 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/SerializationTest.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/SerializationTest.java @@ -21,7 +21,6 @@ import com.google.cloud.NoCredentials; import com.google.cloud.Restorable; import com.google.cloud.pubsub.PubSub.ListOption; -import com.google.cloud.pubsub.PubSub.PullOption; import java.io.Serializable; import java.util.concurrent.ScheduledExecutorService; @@ -47,9 +46,6 @@ public class SerializationTest extends BaseSerializationTest { new Topic(PUB_SUB, new TopicInfo.BuilderImpl(TOPIC_INFO)); private static final ListOption PAGE_TOKEN_OPTION = ListOption.pageToken("cursor"); private static final ListOption PAGE_SIZE_OPTION = ListOption.pageSize(42); - private static final PullOption MAX_QUEUED_CALLBACKS_OPTION = PullOption.maxQueuedCallbacks(42); - private static final PullOption EXECUTOR_FACTORY_OPTION = - PullOption.executorFactory(new TestExecutorFactory()); public static class TestExecutorFactory implements ExecutorFactory, Serializable { @@ -98,8 +94,6 @@ protected Serializable[] serializableObjects() { TOPIC, PAGE_TOKEN_OPTION, PAGE_SIZE_OPTION, - MAX_QUEUED_CALLBACKS_OPTION, - EXECUTOR_FACTORY_OPTION }; } diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/SubscriptionTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/SubscriptionTest.java index 979732f9b06d..71ded75108cf 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/SubscriptionTest.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/SubscriptionTest.java @@ -30,7 +30,6 @@ import com.google.cloud.Identity; import com.google.cloud.Policy; import com.google.cloud.Role; -import com.google.cloud.pubsub.PubSub.PullOption; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.util.concurrent.Futures;