2003-12-09 Michael Koch <konqueror@gmx.de>
* java/net/DatagramSocket.java (close): Directly return if socket is closed. * java/net/ServerSocket.java (close): Directly return if socket is closed. * java/net/Socket.java (close): Directly return if socket is closed. From-SVN: r74470
This commit is contained in:
parent
25a23f3b26
commit
defd7921fd
4 changed files with 42 additions and 33 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2003-12-09 Michael Koch <konqueror@gmx.de>
|
||||||
|
|
||||||
|
* java/net/DatagramSocket.java
|
||||||
|
(close): Directly return if socket is closed.
|
||||||
|
* java/net/ServerSocket.java
|
||||||
|
(close): Directly return if socket is closed.
|
||||||
|
* java/net/Socket.java
|
||||||
|
(close): Directly return if socket is closed.
|
||||||
|
|
||||||
2003-12-09 Michael Koch <konqueror@gmx.de>
|
2003-12-09 Michael Koch <konqueror@gmx.de>
|
||||||
|
|
||||||
* gnu/java/nio/SelectorImpl.java
|
* gnu/java/nio/SelectorImpl.java
|
||||||
|
|
|
@ -216,8 +216,9 @@ public class DatagramSocket
|
||||||
*/
|
*/
|
||||||
public void close()
|
public void close()
|
||||||
{
|
{
|
||||||
if (!isClosed())
|
if (isClosed())
|
||||||
{
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getImpl().close();
|
getImpl().close();
|
||||||
|
@ -243,7 +244,6 @@ public class DatagramSocket
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method returns the remote address to which this socket is
|
* This method returns the remote address to which this socket is
|
||||||
|
|
|
@ -353,8 +353,9 @@ public class ServerSocket
|
||||||
*/
|
*/
|
||||||
public void close () throws IOException
|
public void close () throws IOException
|
||||||
{
|
{
|
||||||
if (!isClosed())
|
if (isClosed())
|
||||||
{
|
return;
|
||||||
|
|
||||||
impl.close();
|
impl.close();
|
||||||
impl = null;
|
impl = null;
|
||||||
bound = false;
|
bound = false;
|
||||||
|
@ -362,7 +363,6 @@ public class ServerSocket
|
||||||
if (getChannel() != null)
|
if (getChannel() != null)
|
||||||
getChannel().close();
|
getChannel().close();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the unique ServerSocketChannel object
|
* Returns the unique ServerSocketChannel object
|
||||||
|
|
|
@ -1003,7 +1003,7 @@ public class Socket
|
||||||
public synchronized void close () throws IOException
|
public synchronized void close () throws IOException
|
||||||
{
|
{
|
||||||
if (isClosed())
|
if (isClosed())
|
||||||
throw new SocketException("socket is closed");
|
return;
|
||||||
|
|
||||||
getImpl().close();
|
getImpl().close();
|
||||||
impl = null;
|
impl = null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue