// calling the listeners on each message
int numProcessingThreads = 4;
ExecutorService service = Executors.newFixedThreadPool(numProcessingThreads);
// Wrap our BasicClient with the twitter4j client
Twitter4jStatusClient t4jClient = new Twitter4jStatusClient(
client, queue, Lists.newArrayList(listener1, listener2), service);
// Establish a connection
t4jClient.connect();
for (int threads = 0; threads < numProcessingThreads; threads++) {
// This must be called once per processing thread
t4jClient.process();
}
Thread.sleep(5000);
client.stop();