Skip to content

Commit b0cac2f

Browse files
authored
delete PullOption (#1507)
1 parent 5614adb commit b0cac2f

File tree

4 files changed

+0
-79
lines changed

4 files changed

+0
-79
lines changed

google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/PubSub.java

-58
Original file line numberDiff line numberDiff line change
@@ -77,64 +77,6 @@ public static ListOption pageToken(String pageToken) {
7777
}
7878
}
7979

80-
/** Class for specifying options for pulling messages. */
81-
final class PullOption extends Option {
82-
83-
private static final long serialVersionUID = 4792164134340316582L;
84-
85-
enum OptionType implements Option.OptionType {
86-
EXECUTOR_FACTORY,
87-
MAX_QUEUED_CALLBACKS;
88-
89-
@SuppressWarnings("unchecked")
90-
<T> T get(Map<Option.OptionType, ?> options) {
91-
return (T) options.get(this);
92-
}
93-
94-
Integer getInteger(Map<Option.OptionType, ?> options) {
95-
return get(options);
96-
}
97-
98-
ExecutorFactory<ExecutorService> getExecutorFactory(Map<Option.OptionType, ?> options) {
99-
return get(options);
100-
}
101-
}
102-
103-
private PullOption(Option.OptionType option, Object value) {
104-
super(option, value);
105-
}
106-
107-
/**
108-
* Returns an option to specify the maximum number of messages that can be queued in the message
109-
* consumer at any time. Queued messages are already pulled messages that are either waiting to
110-
* be processed or being processed. Queued messages will have their acknowledge deadline renewed
111-
* until they are acknowledged or "nacked". If not provided, at most 100 messages can be in the
112-
* queue.
113-
*/
114-
public static PullOption maxQueuedCallbacks(int maxQueuedCallbacks) {
115-
return new PullOption(OptionType.MAX_QUEUED_CALLBACKS, maxQueuedCallbacks);
116-
}
117-
118-
/**
119-
* Returns an option to specify the executor used to execute message processor callbacks. The
120-
* executor determines the number of messages that can be processed at the same time. If not
121-
* provided, a single-threaded executor is used to execute message processor callbacks.
122-
*
123-
* <p>The {@link ExecutorFactory} object can be used to handle creation and release of the
124-
* executor, possibly reusing existing executors. {@link ExecutorFactory#get()} is called when
125-
* the message consumer is created. {@link ExecutorFactory#release(ExecutorService)} is called
126-
* when the message consumer is closed.
127-
*
128-
* <p>For the created option to be serializable, the provided executor factory should implement
129-
* {@link java.io.Serializable}.
130-
*
131-
* @param executorFactory the executor factory.
132-
*/
133-
public static PullOption executorFactory(ExecutorFactory executorFactory) {
134-
return new PullOption(OptionType.EXECUTOR_FACTORY, executorFactory);
135-
}
136-
}
137-
13880
/**
13981
* Creates a new topic.
14082
*

google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/PubSubTest.java

-14
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import com.google.cloud.GrpcServiceOptions.ExecutorFactory;
2323
import com.google.cloud.pubsub.PubSub.ListOption;
24-
import com.google.cloud.pubsub.PubSub.PullOption;
2524

2625
import org.easymock.EasyMock;
2726
import org.junit.Test;
@@ -43,17 +42,4 @@ public void testListOption() {
4342
assertEquals(PAGE_SIZE, listOption.getValue());
4443
assertEquals(ListOption.OptionType.PAGE_SIZE, listOption.getOptionType());
4544
}
46-
47-
@Test
48-
@SuppressWarnings("unchecked")
49-
public void testPullOptions() {
50-
// max queued callbacks
51-
PullOption pullOption = PullOption.maxQueuedCallbacks(MAX_QUEUED_CALLBACKS);
52-
assertEquals(MAX_QUEUED_CALLBACKS, pullOption.getValue());
53-
assertEquals(PullOption.OptionType.MAX_QUEUED_CALLBACKS, pullOption.getOptionType());
54-
ExecutorFactory executorFactory = EasyMock.createStrictMock(ExecutorFactory.class);
55-
pullOption = PullOption.executorFactory(executorFactory);
56-
assertSame(executorFactory, pullOption.getValue());
57-
assertEquals(PullOption.OptionType.EXECUTOR_FACTORY, pullOption.getOptionType());
58-
}
5945
}

google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/SerializationTest.java

-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import com.google.cloud.NoCredentials;
2222
import com.google.cloud.Restorable;
2323
import com.google.cloud.pubsub.PubSub.ListOption;
24-
import com.google.cloud.pubsub.PubSub.PullOption;
2524
import java.io.Serializable;
2625
import java.util.concurrent.ScheduledExecutorService;
2726

@@ -41,9 +40,6 @@ public class SerializationTest extends BaseSerializationTest {
4140
new Topic(PUB_SUB, new TopicInfo.BuilderImpl(TOPIC_INFO));
4241
private static final ListOption PAGE_TOKEN_OPTION = ListOption.pageToken("cursor");
4342
private static final ListOption PAGE_SIZE_OPTION = ListOption.pageSize(42);
44-
private static final PullOption MAX_QUEUED_CALLBACKS_OPTION = PullOption.maxQueuedCallbacks(42);
45-
private static final PullOption EXECUTOR_FACTORY_OPTION =
46-
PullOption.executorFactory(new TestExecutorFactory());
4743

4844
public static class TestExecutorFactory
4945
implements ExecutorFactory<ScheduledExecutorService>, Serializable {
@@ -91,8 +87,6 @@ protected Serializable[] serializableObjects() {
9187
TOPIC,
9288
PAGE_TOKEN_OPTION,
9389
PAGE_SIZE_OPTION,
94-
MAX_QUEUED_CALLBACKS_OPTION,
95-
EXECUTOR_FACTORY_OPTION
9690
};
9791
}
9892

google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/SubscriptionTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import com.google.cloud.Identity;
3131
import com.google.cloud.Policy;
3232
import com.google.cloud.Role;
33-
import com.google.cloud.pubsub.PubSub.PullOption;
3433
import com.google.common.collect.ImmutableList;
3534
import com.google.common.collect.Lists;
3635
import com.google.common.util.concurrent.Futures;

0 commit comments

Comments
 (0)