123456789101112131415161718192021 |
- import java.nio.file.Files;
- import java.util.BitSet;
- import java.util.concurrent.*;
- public class tmp {
- public static void main(String[] args) throws InterruptedException {
- ThreadPoolExecutor executor = new ThreadPoolExecutor(10,
- 20,
- 60L,
- TimeUnit.SECONDS,
- new LinkedBlockingQueue<Runnable>(10),
- Executors.defaultThreadFactory(),
- new RejectedExecutionHandler() {
- @Override
- public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
- System.out.println(r.toString() + " is discard");
- }
- }
- );
- }
- }
|