Created
September 4, 2015 09:33
-
-
Save jsyeo/831bd1e23bb3839aeeb7 to your computer and use it in GitHub Desktop.
Callable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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