aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/net/PlainSocketImpl.java
diff options
context:
space:
mode:
author(no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4>2002-07-26 22:20:04 +0000
committer(no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4>2002-07-26 22:20:04 +0000
commitf320c3ac365f33ed8f571937331e47bd6fea30c1 (patch)
treec08f6bd797dfa24d348853d46c27e28d1e799194 /libjava/java/net/PlainSocketImpl.java
parent1373952868cb7ac8a23bc9f8f292cb61ef65c652 (diff)
This commit was manufactured by cvs2svn to create taggcc-3_2-branchpoint
'gcc-3_2-branchpoint'. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/tags/gcc-3_2-branchpoint@55784 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/net/PlainSocketImpl.java')
-rw-r--r--libjava/java/net/PlainSocketImpl.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/libjava/java/net/PlainSocketImpl.java b/libjava/java/net/PlainSocketImpl.java
index 81df4873850..354d652a5bf 100644
--- a/libjava/java/net/PlainSocketImpl.java
+++ b/libjava/java/net/PlainSocketImpl.java
@@ -39,11 +39,6 @@ class PlainSocketImpl extends SocketImpl
* This is used for reads and writes to/from the socket and
* to close it.
*
- * {@link SocketImpl#fd} is created from this like so:
- * <pre>
- * fd = new FileDescriptor (fnum);
- * </pre>
- *
* When the socket is closed this is reset to -1.
*/
int fnum = -1;
@@ -108,6 +103,22 @@ class PlainSocketImpl extends SocketImpl
private native void write(byte[] buffer, int offset, int count)
throws IOException;
+ protected void finalize() throws Throwable
+ {
+ synchronized (this)
+ {
+ if (fnum != -1)
+ try
+ {
+ close();
+ }
+ catch (IOException ex)
+ {
+ // ignore
+ }
+ }
+ super.finalize();
+ }
/** @return the input stream attached to the socket.
*/