7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* @test
25 * @bug 7007609 7009618
26 * @summary Check that ZipFile objects are always collected
27 */
28
29 import java.io.*;
30 import java.util.Random;
31 import java.util.zip.*;
32 import java.util.concurrent.CountDownLatch;
33
34 public class FinalizeZipFile {
35
36 private final static CountDownLatch finalizersDone = new CountDownLatch(3);
37
38 private static class InstrumentedZipFile extends ZipFile {
39
40 public InstrumentedZipFile(File f) throws Exception {
41 super(f);
42 System.out.printf("Using %s%n", f.getPath());
43 }
44 @Override
45 protected void finalize() throws IOException {
46 System.out.printf("Killing %s%n", getName());
|
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* @test
25 * @bug 7007609 7009618
26 * @summary Check that ZipFile objects are always collected
27 * @key randomness
28 */
29
30 import java.io.*;
31 import java.util.Random;
32 import java.util.zip.*;
33 import java.util.concurrent.CountDownLatch;
34
35 public class FinalizeZipFile {
36
37 private final static CountDownLatch finalizersDone = new CountDownLatch(3);
38
39 private static class InstrumentedZipFile extends ZipFile {
40
41 public InstrumentedZipFile(File f) throws Exception {
42 super(f);
43 System.out.printf("Using %s%n", f.getPath());
44 }
45 @Override
46 protected void finalize() throws IOException {
47 System.out.printf("Killing %s%n", getName());
|