Mercurial > hg > release > icedtea7-forest-2.5 > jdk
changeset 8162:8cca2c58dd9d
8065072: sun/net/www/http/HttpClient/StreamingRetry.java failed intermittently
Reviewed-by: dfuchs
author | chegar |
---|---|
date | Fri, 27 Feb 2015 09:05:41 -0800 |
parents | 9e69fb9109d1 |
children | a58b036057ef |
files | test/sun/net/www/http/HttpClient/StreamingRetry.java |
diffstat | 1 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/test/sun/net/www/http/HttpClient/StreamingRetry.java Wed Jan 28 18:47:45 2015 +0000 +++ b/test/sun/net/www/http/HttpClient/StreamingRetry.java Fri Feb 27 09:05:41 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,23 +36,24 @@ public class StreamingRetry implements Runnable { static final int ACCEPT_TIMEOUT = 20 * 1000; // 20 seconds - ServerSocket ss; + volatile ServerSocket ss; - public static void main(String[] args) throws IOException { + public static void main(String[] args) throws Exception { (new StreamingRetry()).instanceMain(); } - void instanceMain() throws IOException { + void instanceMain() throws Exception { test(); if (failed > 0) throw new RuntimeException("Some tests failed"); } - void test() throws IOException { + void test(String method) throws Exception { ss = new ServerSocket(0); ss.setSoTimeout(ACCEPT_TIMEOUT); int port = ss.getLocalPort(); - (new Thread(this)).start(); + Thread otherThread = new Thread(this); + otherThread.start(); try { URL url = new URL("http://localhost:" + port + "/"); @@ -68,6 +69,7 @@ //expected.printStackTrace(); } finally { ss.close(); + otherThread.join(); } }