src/share/classes/javax/rmi/CORBA/Stub.java

changeset 533
52ad44f9a3ec
parent 158
91006f157c46
child 553
5ca1b4c282b8
equal deleted inserted replaced
529:1c01208087b5 533:52ad44f9a3ec
59 59
60 // This can only be set at object construction time (no sync necessary). 60 // This can only be set at object construction time (no sync necessary).
61 private transient StubDelegate stubDelegate = null; 61 private transient StubDelegate stubDelegate = null;
62 private static Class stubDelegateClass = null; 62 private static Class stubDelegateClass = null;
63 private static final String StubClassKey = "javax.rmi.CORBA.StubClass"; 63 private static final String StubClassKey = "javax.rmi.CORBA.StubClass";
64 private static final String defaultStubImplName = "com.sun.corba.se.impl.javax.rmi.CORBA.StubDelegateImpl";
65 64
66 static { 65 static {
67 Object stubDelegateInstance = (Object) createDelegateIfSpecified(StubClassKey, defaultStubImplName); 66 Object stubDelegateInstance = createDelegate(StubClassKey);
68 if (stubDelegateInstance != null) 67 if (stubDelegateInstance != null)
69 stubDelegateClass = stubDelegateInstance.getClass(); 68 stubDelegateClass = stubDelegateInstance.getClass();
70
71 } 69 }
72 70
73 71
74 /** 72 /**
75 * Returns a hash code value for the object which is the same for all stubs 73 * Returns a hash code value for the object which is the same for all stubs
205 203
206 // Same code as in PortableRemoteObject. Can not be shared because they 204 // Same code as in PortableRemoteObject. Can not be shared because they
207 // are in different packages and the visibility needs to be package for 205 // are in different packages and the visibility needs to be package for
208 // security reasons. If you know a better solution how to share this code 206 // security reasons. If you know a better solution how to share this code
209 // then remove it from PortableRemoteObject. Also in Util.java 207 // then remove it from PortableRemoteObject. Also in Util.java
210 private static Object createDelegateIfSpecified(String classKey, String defaultClassName) { 208 private static Object createDelegate(String classKey) {
211 String className = (String) 209 String className = (String)
212 AccessController.doPrivileged(new GetPropertyAction(classKey)); 210 AccessController.doPrivileged(new GetPropertyAction(classKey));
213 if (className == null) { 211 if (className == null) {
214 Properties props = getORBPropertiesFile(); 212 Properties props = getORBPropertiesFile();
215 if (props != null) { 213 if (props != null) {
216 className = props.getProperty(classKey); 214 className = props.getProperty(classKey);
217 } 215 }
218 } 216 }
219 217
220 if (className == null) { 218 if (className == null) {
221 className = defaultClassName; 219 return new com.sun.corba.se.impl.javax.rmi.CORBA.StubDelegateImpl();
222 } 220 }
223 221
224 try { 222 try {
225 return loadDelegateClass(className).newInstance(); 223 return loadDelegateClass(className).newInstance();
226 } catch (ClassNotFoundException ex) { 224 } catch (ClassNotFoundException ex) {

mercurial