< prev index next >

src/java.base/share/classes/java/util/concurrent/AbstractExecutorService.java

Print this page
8234131: Miscellaneous changes imported from jsr166 CVS 2020-12
Reviewed-by: martin

*** 52,68 **** * associated {@code RunnableFuture} that is executed and * returned. Subclasses may override the {@code newTaskFor} methods * to return {@code RunnableFuture} implementations other than * {@code FutureTask}. * ! * <p><b>Extension example</b>. Here is a sketch of a class * that customizes {@link ThreadPoolExecutor} to use * a {@code CustomTask} class instead of the default {@code FutureTask}: * <pre> {@code * public class CustomThreadPoolExecutor extends ThreadPoolExecutor { * ! * static class CustomTask<V> implements RunnableFuture<V> {...} * * protected <V> RunnableFuture<V> newTaskFor(Callable<V> c) { * return new CustomTask<V>(c); * } * protected <V> RunnableFuture<V> newTaskFor(Runnable r, V v) { --- 52,68 ---- * associated {@code RunnableFuture} that is executed and * returned. Subclasses may override the {@code newTaskFor} methods * to return {@code RunnableFuture} implementations other than * {@code FutureTask}. * ! * <p><b>Extension example.</b> Here is a sketch of a class * that customizes {@link ThreadPoolExecutor} to use * a {@code CustomTask} class instead of the default {@code FutureTask}: * <pre> {@code * public class CustomThreadPoolExecutor extends ThreadPoolExecutor { * ! * static class CustomTask<V> implements RunnableFuture<V> { ... } * * protected <V> RunnableFuture<V> newTaskFor(Callable<V> c) { * return new CustomTask<V>(c); * } * protected <V> RunnableFuture<V> newTaskFor(Runnable r, V v) {
< prev index next >