Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. public interface Callback {
  2. void call(MessageAndMetadata message);
  3. }
  4.  
  5. Executor executor = Executors.newCachedThreadPool();
  6. final Callback<byte[], byte[]> callback = new MyCallback();
  7. while (it.hasNext()) {
  8. final MessageAndMetadata message = it.next();
  9. executor.submit(new Runnable() {
  10. public void run() {
  11. callback.call(message);
  12. }
  13. });
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement