* java/net/PlainDatagramSocketImpl.java

(close): Use native implementation.
	(finalize): New method.

	* java/net/PlainSocketImpl.java (finalize): New method.

	* java/net/natPlainDatagramSocketImpl.cc
	(java/io/FileDescriptor.h): Don't include.
	(close): Implement method here.
	(create): Don't assign fd.

	* java/net/natPlainSocketImpl.cc
	(java/io/FileDescriptor.h): Don't include.
	(create): Don't assign fd.
	(accept): Likewise.
	(close): Synchronize.

From-SVN: r51492
This commit is contained in:
Jeff Sturm 2002-03-28 02:08:36 +00:00 committed by Jeff Sturm
parent 1b58660a9d
commit 47d0866c79
5 changed files with 73 additions and 31 deletions

View file

@ -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.
*/