< prev index next >

src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java

Print this page




  45     int timeout = 0;
  46     boolean connected = false;
  47     private int trafficClass = 0;
  48     protected InetAddress connectedAddress = null;
  49     private int connectedPort = -1;
  50 
  51     private static final String os = AccessController.doPrivileged(
  52         new sun.security.action.GetPropertyAction("os.name")
  53     );
  54 
  55     /**
  56      * flag set if the native connect() call not to be used
  57      */
  58     private final static boolean connectDisabled = os.contains("OS X");
  59 
  60     /**
  61      * Load net library into runtime.
  62      */
  63     static {
  64         java.security.AccessController.doPrivileged(
  65             new java.security.PrivilegedAction<Void>() {
  66                 public Void run() {
  67                     System.loadLibrary("net");
  68                     return null;
  69                 }
  70             });
  71         init();
  72     }
  73 
  74     /**
  75      * Creates a datagram socket
  76      */
  77     protected synchronized void create() throws SocketException {
  78         ResourceManager.beforeUdpCreate();
  79         fd = new FileDescriptor();
  80         try {
  81             datagramSocketCreate();
  82         } catch (SocketException ioe) {
  83             ResourceManager.afterUdpClose();
  84             fd = null;
  85             throw ioe;




  45     int timeout = 0;
  46     boolean connected = false;
  47     private int trafficClass = 0;
  48     protected InetAddress connectedAddress = null;
  49     private int connectedPort = -1;
  50 
  51     private static final String os = AccessController.doPrivileged(
  52         new sun.security.action.GetPropertyAction("os.name")
  53     );
  54 
  55     /**
  56      * flag set if the native connect() call not to be used
  57      */
  58     private final static boolean connectDisabled = os.contains("OS X");
  59 
  60     /**
  61      * Load net library into runtime.
  62      */
  63     static {
  64         java.security.AccessController.doPrivileged(
  65             new java.security.PrivilegedAction<>() {
  66                 public Void run() {
  67                     System.loadLibrary("net");
  68                     return null;
  69                 }
  70             });
  71         init();
  72     }
  73 
  74     /**
  75      * Creates a datagram socket
  76      */
  77     protected synchronized void create() throws SocketException {
  78         ResourceManager.beforeUdpCreate();
  79         fd = new FileDescriptor();
  80         try {
  81             datagramSocketCreate();
  82         } catch (SocketException ioe) {
  83             ResourceManager.afterUdpClose();
  84             fd = null;
  85             throw ioe;


< prev index next >