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