fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.concurrent.ExecutorService;
  5. import java.util.concurrent.Executors;
  6.  
  7. class Ideone {
  8. public static void main (String[] args) throws java.lang.Exception {
  9. ExecutorService service =
  10. Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
  11. for (int i = 0; i < 10; i++) {
  12. service.submit(new Worker(new Object()));
  13. }
  14. }
  15. }
  16.  
  17.  
  18. class Worker implements Runnable {
  19.  
  20. private Object factory;
  21.  
  22. public Worker(Object factory) {
  23. this.factory = factory;
  24. }
  25.  
  26. @Override
  27. public void run() {
  28. while (true) {
  29. Object o = factory.get();
  30. DataSender.send(o);
  31. }
  32. }
  33. }
  34.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:29: error: cannot find symbol
            Object o = factory.get();
                              ^
  symbol:   method get()
  location: variable factory of type Object
Main.java:30: error: cannot find symbol
            DataSender.send(o);
            ^
  symbol:   variable DataSender
  location: class Worker
2 errors
stdout
Standard output is empty