public class ContextRoundRobinTwitterSearchAPIDataset extends AbstractTwitterSearchDataset<Context>
TwitterSearchDataset
to support multiple queries. All
attempts are made to access the Twitter API in a fair way. Each query is
handled in turn and backoffs, new results etc. are stored per query.
A round robin approach is used to fill the underlying
BlockingDroppingQueue
. Each query is given a chance to fill the
queue, then all appropriate wait times are respected and the next query is
given a chance.
Further this round robin dataset passes QueryHoldingStatus
instances
due to the variable queue.
config, logger, query, twitter
Constructor and Description |
---|
ContextRoundRobinTwitterSearchAPIDataset(List<twitter4j.Query> queries,
TwitterAPIToken token,
BlockingDroppingQueue<Context> buffer) |
Modifier and Type | Method and Description |
---|---|
twitter4j.Query |
getQuery()
Get the current query
|
void |
registerStatus(twitter4j.Query query,
twitter4j.Status status,
String json)
Handle the given incoming status and optionally
BlockingDroppingBufferedStream.register(Object)
it with the stream. |
getRandomInstance, makeConfiguration, numInstances
close, getBuffer, hasNext, next, register
filter, forEach, forEach, forEach, iterator, map, map, parallelForEach, parallelForEach, remove, transform
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
filter, forEach, forEach, forEach, map, map, parallelForEach, parallelForEach, transform
forEachRemaining, hasNext, next, remove
forEach, iterator, spliterator
public ContextRoundRobinTwitterSearchAPIDataset(List<twitter4j.Query> queries, TwitterAPIToken token, BlockingDroppingQueue<Context> buffer)
queries
- token
- buffer
- public twitter4j.Query getQuery()
AbstractTwitterSearchDataset
getQuery
in class AbstractTwitterSearchDataset<Context>
public void registerStatus(twitter4j.Query query, twitter4j.Status status, String json) throws InterruptedException
AbstractTwitterSearchDataset
BlockingDroppingBufferedStream.register(Object)
it with the stream.registerStatus
in class AbstractTwitterSearchDataset<Context>
query
- the querystatus
- the parsed Status
json
- the raw json stringInterruptedException