< prev index next >

src/java.base/unix/classes/java/net/DefaultDatagramSocketImplFactory.java

Print this page




  44             if (prefix != null)
  45                 prefixImplClass = Class.forName("java.net."+prefix+"DatagramSocketImpl");
  46         } catch (Exception e) {
  47             System.err.println("Can't find class: java.net." +
  48                                 prefix +
  49                                 "DatagramSocketImpl: check impl.prefix property");
  50             //prefixImplClass = null;
  51         }
  52     }
  53 
  54     /**
  55      * Creates a new <code>DatagramSocketImpl</code> instance.
  56      *
  57      * @param   isMulticast     true if this impl if for a MutlicastSocket
  58      * @return  a new instance of a <code>DatagramSocketImpl</code>.
  59      */
  60     static DatagramSocketImpl createDatagramSocketImpl(boolean isMulticast /*unused on unix*/)
  61         throws SocketException {
  62         if (prefixImplClass != null) {
  63             try {
  64                 return (DatagramSocketImpl)prefixImplClass.newInstance();


  65             } catch (Exception e) {
  66                 throw new SocketException("can't instantiate DatagramSocketImpl");
  67             }
  68         } else {
  69             return new java.net.PlainDatagramSocketImpl();
  70         }
  71     }
  72 }


  44             if (prefix != null)
  45                 prefixImplClass = Class.forName("java.net."+prefix+"DatagramSocketImpl");
  46         } catch (Exception e) {
  47             System.err.println("Can't find class: java.net." +
  48                                 prefix +
  49                                 "DatagramSocketImpl: check impl.prefix property");
  50             //prefixImplClass = null;
  51         }
  52     }
  53 
  54     /**
  55      * Creates a new <code>DatagramSocketImpl</code> instance.
  56      *
  57      * @param   isMulticast     true if this impl if for a MutlicastSocket
  58      * @return  a new instance of a <code>DatagramSocketImpl</code>.
  59      */
  60     static DatagramSocketImpl createDatagramSocketImpl(boolean isMulticast /*unused on unix*/)
  61         throws SocketException {
  62         if (prefixImplClass != null) {
  63             try {
  64                 @SuppressWarnings("deprecation")
  65                 DatagramSocketImpl result = (DatagramSocketImpl)prefixImplClass.newInstance();
  66                 return result;
  67             } catch (Exception e) {
  68                 throw new SocketException("can't instantiate DatagramSocketImpl");
  69             }
  70         } else {
  71             return new java.net.PlainDatagramSocketImpl();
  72         }
  73     }
  74 }
< prev index next >