jdk/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java
changeset 8817 5351579c46a9
parent 5506 202f599c92aa
child 9035 1255eb81cc2f
equal deleted inserted replaced
8816:29f983feda95 8817:5351579c46a9
    26 
    26 
    27 import java.io.FileDescriptor;
    27 import java.io.FileDescriptor;
    28 import java.io.IOException;
    28 import java.io.IOException;
    29 import java.io.InterruptedIOException;
    29 import java.io.InterruptedIOException;
    30 import java.util.Enumeration;
    30 import java.util.Enumeration;
       
    31 import sun.net.ResourceManager;
    31 
    32 
    32 /**
    33 /**
    33  * Abstract datagram and multicast socket implementation base class.
    34  * Abstract datagram and multicast socket implementation base class.
    34  * Note: This is not a public class, so that applets cannot call
    35  * Note: This is not a public class, so that applets cannot call
    35  * into the implementation directly and hence cannot bypass the
    36  * into the implementation directly and hence cannot bypass the
    64     /**
    65     /**
    65      * Creates a datagram socket
    66      * Creates a datagram socket
    66      */
    67      */
    67     protected synchronized void create() throws SocketException {
    68     protected synchronized void create() throws SocketException {
    68         fd = new FileDescriptor();
    69         fd = new FileDescriptor();
    69         datagramSocketCreate();
    70         ResourceManager.beforeUdpCreate();
       
    71         try {
       
    72             datagramSocketCreate();
       
    73         } catch (SocketException ioe) {
       
    74             ResourceManager.afterUdpClose();
       
    75             fd = null;
       
    76             throw ioe;
       
    77         }
    70     }
    78     }
    71 
    79 
    72     /**
    80     /**
    73      * Binds a datagram socket to a local port.
    81      * Binds a datagram socket to a local port.
    74      */
    82      */
   209      * Close the socket.
   217      * Close the socket.
   210      */
   218      */
   211     protected void close() {
   219     protected void close() {
   212         if (fd != null) {
   220         if (fd != null) {
   213             datagramSocketClose();
   221             datagramSocketClose();
       
   222             ResourceManager.afterUdpClose();
   214             fd = null;
   223             fd = null;
   215         }
   224         }
   216     }
   225     }
   217 
   226 
   218     protected boolean isClosed() {
   227     protected boolean isClosed() {