3535/*
3636 * @test
3737 * @summary Test drainTo failing due to c.add throwing
38+ * @library /test/lib
3839 */
3940
4041import java .util .ArrayList ;
5051import java .util .concurrent .RunnableScheduledFuture ;
5152import java .util .concurrent .ScheduledThreadPoolExecutor ;
5253import java .util .concurrent .TimeUnit ;
54+ import jdk .test .lib .Utils ;
5355
5456@ SuppressWarnings ({"unchecked" , "rawtypes" })
5557public class DrainToFails {
58+ static final long LONG_DELAY_MS = Utils .adjustTimeout (10_000 );
5659 final int CAPACITY = 10 ;
5760 final int SMALL = 2 ;
5861
@@ -169,7 +172,7 @@ void testBounded(final BlockingQueue q) throws Throwable {
169172 fail ("should throw" );
170173 } catch (IllegalStateException success ) {
171174 for (Thread putter : putters ) {
172- putter .join (2000L );
175+ putter .join (LONG_DELAY_MS );
173176 check (! putter .isAlive ());
174177 }
175178 assertContentsInOrder (q2 , 2 , 3 );
@@ -183,11 +186,10 @@ void testBounded(final BlockingQueue q) throws Throwable {
183186 }
184187 }
185188
186- Runnable putter (final BlockingQueue q , final int elt ) {
187- return new Runnable () {
188- public void run () {
189- try { q .put (elt ); }
190- catch (Throwable t ) { unexpected (t ); }}};
189+ Runnable putter (BlockingQueue q , int elt ) {
190+ return () -> {
191+ try { q .put (elt ); }
192+ catch (Throwable t ) { unexpected (t ); }};
191193 }
192194
193195 void assertContentsInOrder (Iterable it , Object ... contents ) {
0 commit comments