jdk/src/windows/classes/java/net/TwoStacksPlainSocketImpl.java
changeset 10708 f255532bf336
parent 10704 db5816a6e8c7
child 14342 8435a30053c1
equal deleted inserted replaced
10707:7de027b93fee 10708:f255532bf336
    24  */
    24  */
    25 package java.net;
    25 package java.net;
    26 
    26 
    27 import java.io.IOException;
    27 import java.io.IOException;
    28 import java.io.FileDescriptor;
    28 import java.io.FileDescriptor;
       
    29 import sun.net.ResourceManager;
    29 
    30 
    30 /*
    31 /*
    31  * This class defines the plain SocketImpl that is used for all
    32  * This class defines the plain SocketImpl that is used for all
    32  * Windows version lower than Vista. It adds support for IPv6 on
    33  * Windows version lower than Vista. It adds support for IPv6 on
    33  * these platforms where available.
    34  * these platforms where available.
    80      * is a stream socket (true) or an unconnected UDP socket (false).
    81      * is a stream socket (true) or an unconnected UDP socket (false).
    81      */
    82      */
    82     protected synchronized void create(boolean stream) throws IOException {
    83     protected synchronized void create(boolean stream) throws IOException {
    83         fd1 = new FileDescriptor();
    84         fd1 = new FileDescriptor();
    84         try {
    85         try {
    85             super.create();
    86             super.create(stream);
    86         } catch (IOException e) {
    87         } catch (IOException e) {
    87             fd1 = null;
    88             fd1 = null;
    88             throw e;
    89             throw e;
    89         }
    90         }
    90     }
    91     }
   123      * Closes the socket.
   124      * Closes the socket.
   124      */
   125      */
   125     protected void close() throws IOException {
   126     protected void close() throws IOException {
   126         synchronized(fdLock) {
   127         synchronized(fdLock) {
   127             if (fd != null || fd1 != null) {
   128             if (fd != null || fd1 != null) {
       
   129                 if (!stream) {
       
   130                     ResourceManager.afterUdpClose();
       
   131                 }
   128                 if (fdUseCount == 0) {
   132                 if (fdUseCount == 0) {
   129                     if (closePending) {
   133                     if (closePending) {
   130                         return;
   134                         return;
   131                     }
   135                     }
   132                     closePending = true;
   136                     closePending = true;