|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
41 | 41 | * Methods are defined final to ensure that they are not accidentally
|
42 | 42 | * overridden in SSLSocketImpl.
|
43 | 43 | *
|
| 44 | + * There used to be a finalize() implementation that sent close_notify's, but |
| 45 | + * decided that was not needed. Not closing properly is more properly an |
| 46 | + * error condition that should be avoided. Applications should close sockets |
| 47 | + * and not rely on garbage collection. |
| 48 | + * |
| 49 | + * The underlying native resources are handled by the Socket Cleaner. |
| 50 | + * |
44 | 51 | * @see javax.net.ssl.SSLSocket
|
45 | 52 | * @see SSLSocketImpl
|
46 | 53 | */
|
@@ -262,37 +269,6 @@ public boolean isOutputShutdown() {
|
262 | 269 | }
|
263 | 270 | }
|
264 | 271 |
|
265 |
| - /** |
266 |
| - * Ensures that the SSL connection is closed down as cleanly |
267 |
| - * as possible, in case the application forgets to do so. |
268 |
| - * This allows SSL connections to be implicitly reclaimed, |
269 |
| - * rather than forcing them to be explicitly reclaimed at |
270 |
| - * the penalty of prematurly killing SSL sessions. |
271 |
| - */ |
272 |
| - @Override |
273 |
| - @SuppressWarnings("removal") |
274 |
| - protected final void finalize() throws Throwable { |
275 |
| - try { |
276 |
| - close(); |
277 |
| - } catch (IOException e1) { |
278 |
| - try { |
279 |
| - if (self == this) { |
280 |
| - super.close(); |
281 |
| - } |
282 |
| - } catch (IOException e2) { |
283 |
| - // ignore |
284 |
| - } |
285 |
| - } finally { |
286 |
| - // We called close on the underlying socket above to |
287 |
| - // make doubly sure all resources got released. We |
288 |
| - // don't finalize self in the case of overlain sockets, |
289 |
| - // that's a different object which the GC will finalize |
290 |
| - // separately. |
291 |
| - |
292 |
| - super.finalize(); |
293 |
| - } |
294 |
| - } |
295 |
| - |
296 | 272 | //
|
297 | 273 | // GET ADDRESS METHODS
|
298 | 274 | //
|
|
0 commit comments