< prev index next >

test/jdk/java/util/concurrent/tck/ThreadPoolExecutorSubclassTest.java

Print this page
8190324: ThreadPoolExecutor should not specify a dependency on finalization
Reviewed-by: martin, psandoz, alanb, rriggs, dholmes


1977                 }};
1978                 futures.add(e.submit(r));
1979             }
1980             await(blockerStarted);
1981             for (Future<?> future : futures) future.cancel(false);
1982             for (Future<?> future : futures) {
1983                 try {
1984                     future.get();
1985                     shouldThrow();
1986                 } catch (CancellationException success) {}
1987                 try {
1988                     future.get(LONG_DELAY_MS, MILLISECONDS);
1989                     shouldThrow();
1990                 } catch (CancellationException success) {}
1991                 assertTrue(future.isCancelled());
1992                 assertTrue(future.isDone());
1993             }
1994         }
1995     }
1996 















1997 }


1977                 }};
1978                 futures.add(e.submit(r));
1979             }
1980             await(blockerStarted);
1981             for (Future<?> future : futures) future.cancel(false);
1982             for (Future<?> future : futures) {
1983                 try {
1984                     future.get();
1985                     shouldThrow();
1986                 } catch (CancellationException success) {}
1987                 try {
1988                     future.get(LONG_DELAY_MS, MILLISECONDS);
1989                     shouldThrow();
1990                 } catch (CancellationException success) {}
1991                 assertTrue(future.isCancelled());
1992                 assertTrue(future.isDone());
1993             }
1994         }
1995     }
1996 
1997     public void testFinalizeMethodCallsSuperFinalize() {
1998         new CustomTPE(1, 1,
1999                       LONG_DELAY_MS, MILLISECONDS,
2000                       new LinkedBlockingQueue<Runnable>()) {
2001 
2002             /**
2003              * A finalize method without "throws Throwable", that
2004              * calls super.finalize().
2005              */
2006             protected void finalize() {
2007                 super.finalize();
2008             }
2009         }.shutdown();
2010     }
2011 
2012 }
< prev index next >