Skip to content

Instantly share code, notes, and snippets.

@jsyeo
Created September 4, 2015 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsyeo/831bd1e23bb3839aeeb7 to your computer and use it in GitHub Desktop.
Save jsyeo/831bd1e23bb3839aeeb7 to your computer and use it in GitHub Desktop.
Callable
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
public class Main {
public static void main(String[] args) throws ExecutionException, InterruptedException {
// write your code here
ExecutorService executorService = Executors.newFixedThreadPool(10);
Future<Integer> future = executorService.submit(new MyCallable());
System.out.println(future.get());
executorService.shutdown();
}
static void vulnerableMethod() {
System.out.println("pwned");
}
}
class MyCallable implements Callable<Integer> {
@Override
public Integer call() throws Exception {
Main.vulnerableMethod();
return 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment