Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface Callback {
- void call(MessageAndMetadata message);
- }
- Executor executor = Executors.newCachedThreadPool();
- final Callback<byte[], byte[]> callback = new MyCallback();
- while (it.hasNext()) {
- final MessageAndMetadata message = it.next();
- executor.submit(new Runnable() {
- public void run() {
- callback.call(message);
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement