summaryrefslogtreecommitdiff
path: root/gnu/java/net/PlainSocketImpl.java
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2003-10-20 14:10:06 +0000
committerMichael Koch <konqueror@gmx.de>2003-10-20 14:10:06 +0000
commita45e544f75afe6631ff7118ddddfccae8629e96e (patch)
treeb5817518a62abc7f42242cb76e2d02283c92da45 /gnu/java/net/PlainSocketImpl.java
parentb28641e4a462be11c3f72acbf154ac2bfbcfffc0 (diff)
downloadclasspath-a45e544f75afe6631ff7118ddddfccae8629e96e.tar.gz
2003-10-20 Michael Koch <konqueror@gmx.de>
* gnu/java/net/PlainDatagramSocketImpl.java (native_fd): Made package-private. (finalize): New method. (getTTL): Call getTimeToLive. (setTTL): Call setTimeToLive. * gnu/java/net/PlainSocketImpl.java (native_fd): Made package-private. (finalize): New method.
Diffstat (limited to 'gnu/java/net/PlainSocketImpl.java')
-rw-r--r--gnu/java/net/PlainSocketImpl.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/gnu/java/net/PlainSocketImpl.java b/gnu/java/net/PlainSocketImpl.java
index 5f7924dd0..3656967c9 100644
--- a/gnu/java/net/PlainSocketImpl.java
+++ b/gnu/java/net/PlainSocketImpl.java
@@ -84,7 +84,7 @@ public final class PlainSocketImpl extends SocketImpl
*
* When the socket is closed this is reset to -1.
*/
- protected int native_fd = -1;
+ int native_fd = -1;
/**
* A cached copy of the in stream for reading from the socket.
@@ -102,6 +102,22 @@ public final class PlainSocketImpl extends SocketImpl
public PlainSocketImpl()
{
}
+
+ protected void finalize() throws Throwable
+ {
+ synchronized (this)
+ {
+ if (native_fd != -1)
+ try
+ {
+ close();
+ }
+ catch (IOException ex)
+ {
+ }
+ }
+ super.finalize();
+ }
public int getNativeFD()
{