geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject [26/51] [abbrv] geronimo-yoko git commit: Further rmi-impl refactoring
Date Sun, 19 Feb 2017 01:49:43 GMT
Further rmi-impl refactoring


Project: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/repo
Commit: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/commit/431478f4
Tree: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/tree/431478f4
Diff: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/diff/431478f4

Branch: refs/heads/master
Commit: 431478f4ade5881047fa62d17a86fb0ded692a7f
Parents: be541a6
Author: Neil GM Richards <neil_richards@uk.ibm.com>
Authored: Sat Mar 26 18:57:01 2016 +0000
Committer: Neil GM Richards <neil_richards@uk.ibm.com>
Committed: Sat Mar 26 18:57:01 2016 +0000

----------------------------------------------------------------------
 .../yoko/rmi/impl/AbstractObjectDescriptor.java |  48 ++-
 .../org/apache/yoko/rmi/impl/AnyDescriptor.java |  32 +-
 .../apache/yoko/rmi/impl/ArrayDescriptor.java   | 328 +++++++++++--------
 .../yoko/rmi/impl/ClassBaseDescriptor.java      |  48 +--
 .../yoko/rmi/impl/ClassDescDescriptor.java      |  13 +-
 .../apache/yoko/rmi/impl/ClassDescriptor.java   |  14 +-
 .../yoko/rmi/impl/DateValueDescriptor.java      |   1 -
 .../apache/yoko/rmi/impl/EnumDescriptor.java    |   3 -
 .../yoko/rmi/impl/EnumSubclassDescriptor.java   |  13 +-
 .../yoko/rmi/impl/ExceptionDescriptor.java      |   4 +-
 .../apache/yoko/rmi/impl/FVDEnumDescriptor.java |   2 +-
 .../rmi/impl/FVDEnumSubclassDescriptor.java     |   2 +-
 .../yoko/rmi/impl/FVDValueDescriptor.java       |  27 +-
 .../yoko/rmi/impl/IDLEntityDescriptor.java      | 205 +++++-------
 .../apache/yoko/rmi/impl/MethodDescriptor.java  |   4 +-
 .../org/apache/yoko/rmi/impl/ModelElement.java  |  16 +-
 .../yoko/rmi/impl/PortableRemoteObjectImpl.java |   2 +-
 .../org/apache/yoko/rmi/impl/RMIServant.java    |   4 +-
 .../java/org/apache/yoko/rmi/impl/RMIStub.java  |   3 +-
 .../apache/yoko/rmi/impl/RMIStubDescriptor.java |  11 +-
 .../apache/yoko/rmi/impl/RMIStubHandler.java    |   2 +-
 .../yoko/rmi/impl/RemoteClassDescriptor.java    |  16 +-
 .../apache/yoko/rmi/impl/RemoteDescriptor.java  |  95 +++---
 .../rmi/impl/RemoteInterfaceDescriptor.java     |   7 +-
 .../apache/yoko/rmi/impl/SimpleDescriptor.java  |  15 +-
 .../apache/yoko/rmi/impl/StringDescriptor.java  |  45 +--
 .../apache/yoko/rmi/impl/TypeDescriptor.java    | 147 ++++-----
 .../apache/yoko/rmi/impl/TypeRepository.java    |  35 +-
 .../java/org/apache/yoko/rmi/impl/UtilImpl.java |   4 +-
 .../apache/yoko/rmi/impl/ValueDescriptor.java   |  60 ++--
 .../apache/yoko/rmi/impl/ValueHandlerImpl.java  |   2 +-
 31 files changed, 570 insertions(+), 638 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/AbstractObjectDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/AbstractObjectDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/AbstractObjectDescriptor.java
index 8a64c50..9c81bce 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/AbstractObjectDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/AbstractObjectDescriptor.java
@@ -18,6 +18,13 @@
 
 package org.apache.yoko.rmi.impl;
 
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+import java.io.PrintWriter;
+
 class AbstractObjectDescriptor extends ValueDescriptor {
     protected AbstractObjectDescriptor(Class type, TypeRepository repository) {
         super(type, repository);
@@ -25,54 +32,43 @@ class AbstractObjectDescriptor extends ValueDescriptor {
 
     @Override
     protected String genRepId() {
-        return String.format("IDL:%s:1.0", _java_class.getName().replace('.', '/'));
+        return String.format("IDL:%s:1.0", type.getName().replace('.', '/'));
     }
 
     /** Read an instance of this value from a CDR stream */
-    public Object read(org.omg.CORBA.portable.InputStream in) {
+    @Override
+    public Object read(InputStream in) {
         org.omg.CORBA_2_3.portable.InputStream _in = (org.omg.CORBA_2_3.portable.InputStream) in;
 
         return _in.read_abstract_interface();
     }
 
     /** Write an instance of this value to a CDR stream */
-    public void write(org.omg.CORBA.portable.OutputStream out, Object value) {
+    @Override
+    public void write(OutputStream out, Object value) {
         org.omg.CORBA_2_3.portable.OutputStream _out = (org.omg.CORBA_2_3.portable.OutputStream) out;
 
         _out.write_abstract_interface(value);
     }
 
-    /*
-     * public java.io.Serializable writeReplace (java.io.Serializable val) {
-     * return null; }
-     * 
-     * public void writeValue(org.omg.CORBA.portable.OutputStream out,
-     * java.io.Serializable value) { // skip // }
-     * 
-     * public java.io.Serializable readValue (org.omg.CORBA.portable.InputStream
-     * in, java.util.Map offsetMap) { return null; }
-     */
-
-    org.omg.CORBA.TypeCode getTypeCode() {
-        if (_type_code == null) {
-            org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
-            _type_code = orb.create_abstract_interface_tc(getRepositoryID(),
-                    _java_class.getName());
-        }
-
-        return _type_code;
+    @Override
+    protected TypeCode genTypeCode() {
+        ORB orb = ORB.init();
+        return orb.create_abstract_interface_tc(getRepositoryID(), type.getName());
     }
 
+    @Override
     public long computeHashCode() {
         return 0L;
     }
 
+    @Override
     Object copyObject(Object value, CopyState state) {
         throw new IllegalStateException("not serializable " + value.getClass().getName());
     }
 
-    void writeMarshalValue(java.io.PrintWriter pw, String outName,
-            String paramName) {
+    @Override
+    void writeMarshalValue(PrintWriter pw, String outName, String paramName) {
         pw.print("javax.rmi.CORBA.Util.writeAbstractObject(");
         pw.print(outName);
         pw.print(',');
@@ -80,9 +76,9 @@ class AbstractObjectDescriptor extends ValueDescriptor {
         pw.print(')');
     }
 
-    void writeUnmarshalValue(java.io.PrintWriter pw, String inName) {
+    @Override
+    void writeUnmarshalValue(PrintWriter pw, String inName) {
         pw.print(inName);
         pw.print(".read_abstract_interface()");
     }
-
 }

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/AnyDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/AnyDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/AnyDescriptor.java
index faabb00..aad6973 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/AnyDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/AnyDescriptor.java
@@ -18,6 +18,14 @@
 
 package org.apache.yoko.rmi.impl;
 
+import java.io.PrintWriter;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
 class AnyDescriptor extends TypeDescriptor {
     AnyDescriptor(Class type, TypeRepository rep) {
         super(type, rep);
@@ -25,30 +33,34 @@ class AnyDescriptor extends TypeDescriptor {
 
     @Override
     protected String genRepId() {
-        return String.format("IDL:%s:1.0", _java_class.getName().replace('.', '/'));
+        return String.format("IDL:%s:1.0", type.getName().replace('.', '/'));
     }
 
     /** Read an instance of this value from a CDR stream */
-    public Object read(org.omg.CORBA.portable.InputStream in) {
+    @Override
+    public Object read(InputStream in) {
         return javax.rmi.CORBA.Util.readAny(in);
     }
 
     /** Write an instance of this value to a CDR stream */
-    public void write(org.omg.CORBA.portable.OutputStream out, Object val) {
+    @Override
+    public void write(OutputStream out, Object val) {
         javax.rmi.CORBA.Util.writeAny(out, val);
     }
 
-    org.omg.CORBA.TypeCode getTypeCode() {
-        org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
-        return orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_any);
+    @Override
+    protected TypeCode genTypeCode() {
+        ORB orb = ORB.init();
+        return orb.get_primitive_tc(TCKind.tk_any);
     }
 
+    @Override
     Object copyObject(Object value, CopyState state) {
         throw new InternalError("cannot copy org.omg.CORBA.Any");
     }
 
-    void writeMarshalValue(java.io.PrintWriter pw, String outName,
-            String paramName) {
+    @Override
+    void writeMarshalValue(PrintWriter pw, String outName, String paramName) {
         pw.print("javax.rmi.CORBA.Util.writeAny(");
         pw.print(outName);
         pw.print(',');
@@ -56,10 +68,10 @@ class AnyDescriptor extends TypeDescriptor {
         pw.print(')');
     }
 
-    void writeUnmarshalValue(java.io.PrintWriter pw, String inName) {
+    @Override
+    void writeUnmarshalValue(PrintWriter pw, String inName) {
         pw.print("javax.rmi.CORBA.Util.readAny(");
         pw.print(inName);
         pw.print(")");
     }
-
 }

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ArrayDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ArrayDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ArrayDescriptor.java
index 1a5f7cb..2cedbfa 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ArrayDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ArrayDescriptor.java
@@ -18,41 +18,64 @@
 
 package org.apache.yoko.rmi.impl;
 
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.PrintWriter;
 import java.io.Serializable;
 import java.lang.reflect.Array;
+import java.rmi.Remote;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 import java.util.Map;
+import java.util.Set;
 import java.util.logging.Logger;
 
 import org.omg.CORBA.MARSHAL;
 import org.omg.CORBA.ORB;
 import org.omg.CORBA.TypeCode;
 import org.omg.CORBA.ValueMember;
+import org.omg.CORBA.portable.IndirectionException;
 import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
 
 abstract class ArrayDescriptor extends ValueDescriptor {
-    protected int order;
+    final Class elementType;
+    final Class basicType;
+    private final int order;
 
-    protected Class basicType;
+    protected ArrayDescriptor(Class type, Class elemType, TypeRepository rep) {
+        super(type, rep);
+        logger.fine("Creating an array descriptor for type " + type.getName() + " holding elements of " + elemType.getName());
+        this.elementType = elemType;
 
-    protected Class elementType;
-    // repository ID for the contained elements
-    private volatile String _elementRepid = null;
+        int order = 1;
+        Class basicType = elemType;
+        while (basicType.isArray()) {
+            basicType = basicType.getComponentType();
+            order++;
+        }
+        this.basicType = basicType;
+        this.order = order;
+    }
 
     @Override
     protected String genRepId() {
         if (elementType.isPrimitive() || elementType == Object.class)
-            return String.format("RMI:%s:%016X", _java_class.getName(), 0);
+            return String.format("RMI:%s:%016X", type.getName(), 0);
 
         TypeDescriptor desc = repo.getDescriptor(elementType);
         String elemRep = desc.getRepositoryID();
         String hash = elemRep.substring(elemRep.indexOf(':', 4));
-        return String.format("RMI:%s:%s", _java_class.getName(), hash);
+        return String.format("RMI:%s:%s", type.getName(), hash);
     }
 
+    // repository ID for the contained elements
+    private volatile String _elementRepid = null;
     private final String genElemRepId() {
         if (elementType.isPrimitive() || elementType == Object.class) {
             // use the descriptor type past the array type marker
-            return String.format("RMI:%s:%016X", _java_class.getName().substring(1), 0);
+            return String.format("RMI:%s:%016X", type.getName().substring(1), 0);
         }
         return repo.getDescriptor(elementType).getRepositoryID();
     }
@@ -62,20 +85,8 @@ abstract class ArrayDescriptor extends ValueDescriptor {
         return _elementRepid;
     }
 
-    protected ArrayDescriptor(Class type, Class elemType, TypeRepository rep) {
-        super(type, rep);
-        logger.fine("Creating an array descriptor for type " + type.getName() + " holding elements of " + elemType.getName()); 
-        this.elementType = elemType;
-
-        order = 1;
-        basicType = elemType;
-        while (basicType.isArray()) {
-            basicType = basicType.getComponentType();
-            order += 1;
-        }
-    }
-
-    public String getIDLName() {
+    @Override
+    protected final String genIDLName() {
         StringBuffer sb = new StringBuffer("org_omg_boxedRMI_");
 
         TypeDescriptor desc = repo.getDescriptor(basicType);
@@ -112,7 +123,7 @@ abstract class ArrayDescriptor extends ValueDescriptor {
     }
 
     static ArrayDescriptor get(final Class type, TypeRepository rep) {
-        logger.fine("retrieving an array descriptor for class " + type.getName()); 
+        logger.fine("retrieving an array descriptor for class " + type.getName());
         if (!type.isArray()) {
             throw new IllegalArgumentException("type is not an array");
         }
@@ -120,7 +131,6 @@ abstract class ArrayDescriptor extends ValueDescriptor {
         Class elemType = type.getComponentType();
 
         if (elemType.isPrimitive()) {
-
             if (elemType == Boolean.TYPE) {
                 return new BooleanArrayDescriptor(type, elemType, rep);
             } else if (elemType == Byte.TYPE) {
@@ -141,53 +151,51 @@ abstract class ArrayDescriptor extends ValueDescriptor {
                 throw new RuntimeException("unknown array type " + type);
             }
         }
-        if (java.io.Serializable.class.equals(elemType) || 
-                java.io.Externalizable.class.equals(elemType) || Object.class.equals(elemType)) {
+        if (Serializable.class.equals(elemType) ||
+                Externalizable.class.equals(elemType) || Object.class.equals(elemType)) {
             return new ObjectArrayDescriptor(type, elemType, rep);
-
-        } else if (java.io.Serializable.class.isAssignableFrom(elemType)) {
-            return new ValueArrayDescriptor(type, elemType, rep);
-
-        } else if (java.rmi.Remote.class.isAssignableFrom(elemType)) {
+        } else if (Remote.class.isAssignableFrom(elemType)) {
             return new RemoteArrayDescriptor(type, elemType, rep);
-
+        } else if (Serializable.class.isAssignableFrom(elemType)) {
+            return new ValueArrayDescriptor(type, elemType, rep);
         } else {
             return new AbstractObjectArrayDescriptor(type, elemType, rep);
         }
-
     }
 
     /**
      * Read an instance of this value from a CDR stream. Overridden to provide a
      * specific type
      */
-    public Object read(org.omg.CORBA.portable.InputStream in) {
+    @Override
+    public Object read(InputStream in) {
         org.omg.CORBA_2_3.portable.InputStream _in = (org.omg.CORBA_2_3.portable.InputStream) in;
-        logger.fine("Reading an array value with repository id " + getRepositoryID() + " java class is " + _java_class);
-        
-        // if we have a resolved class, read using that, otherwise fall back on the 
-        // repository id. 
-        return ((null == _java_class) ? _in.read_value(getRepositoryID()) : _in.read_value(_java_class));
+        logger.fine("Reading an array value with repository id " + getRepositoryID() + " java class is " + type);
+
+        // if we have a resolved class, read using that, otherwise fall back on the
+        // repository id.
+        return ((null == type) ? _in.read_value(getRepositoryID()) : _in.read_value(type));
     }
 
     /** Write an instance of this value to a CDR stream */
-    public void write(org.omg.CORBA.portable.OutputStream out, Object value) {
+    @Override
+    public void write(OutputStream out, Object value) {
         org.omg.CORBA_2_3.portable.OutputStream _out = (org.omg.CORBA_2_3.portable.OutputStream) out;
 
-        _out.write_value((java.io.Serializable)value, getRepositoryID());
+        _out.write_value((Serializable)value, getRepositoryID());
     }
 
-    org.omg.CORBA.ValueMember[] getValueMembers() {
+    ValueMember[] getValueMembers() {
 
         if (_value_members == null) {
 
-            _value_members = new org.omg.CORBA.ValueMember[1];
+            _value_members = new ValueMember[1];
 
             TypeDescriptor elemDesc = repo.getDescriptor(elementType);
 
             String elemRepID = elemDesc.getRepositoryID();
 
-            ORB orb = org.omg.CORBA.ORB.init();
+            ORB orb = ORB.init();
             TypeCode memberTC = orb.create_sequence_tc(0, elemDesc
                     .getTypeCode());
 
@@ -200,10 +208,23 @@ abstract class ArrayDescriptor extends ValueDescriptor {
         return _value_members;
     }
 
-    void addDependencies(java.util.Set classes) {
+    @Override
+    void addDependencies(Set classes) {
         repo.getDescriptor(basicType).addDependencies(classes);
     }
 
+    final CorbaObjectReader makeCorbaObjectReader(final InputStream in, final Map offsetMap, final Serializable obj)
+            throws IOException {
+        try {
+            return AccessController.doPrivileged(new PrivilegedExceptionAction<CorbaObjectReader>() {
+                public CorbaObjectReader run() throws IOException {
+                    return new CorbaObjectReader(in, offsetMap, obj);
+                }
+            });
+        } catch (PrivilegedActionException e) {
+            throw (IOException)e.getException();
+        }
+    }
 }
 
 class ObjectArrayDescriptor extends ArrayDescriptor {
@@ -213,15 +234,15 @@ class ObjectArrayDescriptor extends ArrayDescriptor {
         super(type, elemType, rep);
     }
 
-    public void writeValue(org.omg.CORBA.portable.OutputStream out,
-            java.io.Serializable value) {
+    @Override
+    public void writeValue(OutputStream out, Serializable value) {
         // System.out.println ("ObjectArrayDescriptor::writeValue
         // "+getRepositoryID ());
 
         Object[] arr = (Object[]) value;
         out.write_long(arr.length);
 
-        logger.finer("writing " + _java_class.getName() + " size="
+        logger.finer("writing " + type.getName() + " size="
                 + arr.length);
 
         for (int i = 0; i < arr.length; i++) {
@@ -229,8 +250,9 @@ class ObjectArrayDescriptor extends ArrayDescriptor {
         }
     }
 
-    public java.io.Serializable readValue(
-            org.omg.CORBA.portable.InputStream in, java.util.Map offsetMap,
+    @Override
+    public Serializable readValue(
+            InputStream in, Map offsetMap,
             Integer key) {
         try {
             ObjectReader reader = makeCorbaObjectReader(in, offsetMap, null);
@@ -240,7 +262,7 @@ class ObjectArrayDescriptor extends ArrayDescriptor {
 
             offsetMap.put(key, arr);
 
-            logger.fine("reading " + _java_class.getName() + " size="
+            logger.fine("reading " + type.getName() + " size="
                     + arr.length);
 
             for (int i = 0; i < length; i++) {
@@ -252,19 +274,20 @@ class ObjectArrayDescriptor extends ArrayDescriptor {
                     else {
                         logger.finer("Array item " + i + " is null"); 
                     }
-                } catch (org.omg.CORBA.portable.IndirectionException ex) {
+                } catch (IndirectionException ex) {
                     arr[i] = offsetMap.get(new Integer(ex.offset));
                     // reader.addValueBox (ex.offset, new ArrayBox (i, arr));
                 }
             }
-            return (java.io.Serializable) arr;
+            return arr;
 
-        } catch (java.io.IOException ex) {
+        } catch (IOException ex) {
             throw (MARSHAL)new MARSHAL(ex.getMessage()).initCause(ex);
         }
 
     }
 
+    @Override
     Object copyObject(Object value, CopyState state) {
         final Object[] orig = (Object[]) value;
         final Object[] result = new Object[orig.length];
@@ -287,7 +310,8 @@ class ObjectArrayDescriptor extends ArrayDescriptor {
         return result;
     }
 
-    void printFields(java.io.PrintWriter pw, java.util.Map recurse, Object val) {
+    @Override
+    void printFields(PrintWriter pw, Map recurse, Object val) {
         Object[] arr = (Object[]) val;
         TypeDescriptor desc = repo.getDescriptor(elementType);
         pw.print("length=" + arr.length + "; ");
@@ -306,11 +330,9 @@ class RemoteArrayDescriptor extends ArrayDescriptor {
         super(type, elemType, rep);
     }
 
-    public void writeValue(org.omg.CORBA.portable.OutputStream out,
-            java.io.Serializable value) {
-        // System.out.println ("RemoteArrayDescriptor::writeValue
-        // "+getRepositoryID ());
-
+    @Override
+    public void writeValue(OutputStream out,
+            Serializable value) {
         Object[] arr = (Object[]) value;
         out.write_long(arr.length);
         for (int i = 0; i < arr.length; i++) {
@@ -318,8 +340,9 @@ class RemoteArrayDescriptor extends ArrayDescriptor {
         }
     }
 
-    public java.io.Serializable readValue(
-            org.omg.CORBA.portable.InputStream in, java.util.Map offsetMap,
+    @Override
+    public Serializable readValue(
+            InputStream in, Map offsetMap,
             Integer key) {
         try {
             ObjectReader reader = makeCorbaObjectReader(in, offsetMap, null);
@@ -331,20 +354,21 @@ class RemoteArrayDescriptor extends ArrayDescriptor {
             for (int i = 0; i < length; i++) {
                 try {
                     arr[i] = reader.readRemoteObject(elementType);
-                } catch (org.omg.CORBA.portable.IndirectionException ex) {
+                } catch (IndirectionException ex) {
                     arr[i] = offsetMap.get(new Integer(ex.offset));
                     // reader.addValueBox (ex.offset, new ArrayBox (i, arr));
                 }
             }
 
-            return (java.io.Serializable) arr;
+            return arr;
 
-        } catch (java.io.IOException ex) {
+        } catch (IOException ex) {
             throw (MARSHAL)new MARSHAL(ex.getMessage()).initCause(ex);
         }
 
     }
 
+    @Override
     Object copyObject(Object value, CopyState state) {
         final Object[] orig = (Object[]) value;
         final Object[] result = (Object[]) Array.newInstance(elementType,
@@ -368,7 +392,8 @@ class RemoteArrayDescriptor extends ArrayDescriptor {
         return result;
     }
 
-    void printFields(java.io.PrintWriter pw, java.util.Map recurse, Object val) {
+    @Override
+    void printFields(PrintWriter pw, Map recurse, Object val) {
         Object[] arr = (Object[]) val;
         TypeDescriptor desc = repo.getDescriptor(elementType);
         pw.print("length=" + arr.length + "; ");
@@ -387,19 +412,19 @@ class ValueArrayDescriptor extends ArrayDescriptor {
         super(type, elemType, rep);
     }
 
-    public void writeValue(org.omg.CORBA.portable.OutputStream out,
-            java.io.Serializable value) {
-        // System.out.println ("ValueArrayDescriptor::writeValue
-        // "+getRepositoryID ());
+    @Override
+    public void writeValue(OutputStream out,
+            Serializable value) {
         Object[] arr = (Object[]) value;
         out.write_long(arr.length);
-        java.io.Serializable[] sarr = (java.io.Serializable[]) arr;
+        Serializable[] sarr = (Serializable[]) arr;
         org.omg.CORBA_2_3.portable.OutputStream _out = (org.omg.CORBA_2_3.portable.OutputStream) out;
         for (int i = 0; i < sarr.length; i++) {
             _out.write_value(sarr[i], getElementRepositoryID());
         }
     }
 
+    @Override
     public Serializable readValue(InputStream in, Map offsetMap, Integer key) {
         final int length = in.read_long();
         Object[] arr = (Object[]) Array.newInstance(elementType, length);
@@ -409,7 +434,7 @@ class ValueArrayDescriptor extends ArrayDescriptor {
         for (int i = 0; i < length; i++) {
             try {
                 arr[i] = _in.read_value(elementType);
-            } catch (org.omg.CORBA.portable.IndirectionException ex) {
+            } catch (IndirectionException ex) {
                 arr[i] = offsetMap.get(new Integer(ex.offset));
             }
         }
@@ -417,6 +442,7 @@ class ValueArrayDescriptor extends ArrayDescriptor {
         return arr;
     }
 
+    @Override
     Object copyObject(Object value, CopyState state) {
         Object[] orig = (Object[]) value;
         final Object[] result = (Object[]) Array.newInstance(value.getClass()
@@ -440,7 +466,8 @@ class ValueArrayDescriptor extends ArrayDescriptor {
         return result;
     }
 
-    void printFields(java.io.PrintWriter pw, java.util.Map recurse, Object val) {
+    @Override
+    void printFields(PrintWriter pw, Map recurse, Object val) {
         Object[] arr = (Object[]) val;
         TypeDescriptor desc = repo.getDescriptor(elementType);
         pw.print("length=" + arr.length + "; ");
@@ -459,10 +486,9 @@ class AbstractObjectArrayDescriptor extends ArrayDescriptor {
         super(type, elemType, rep);
     }
 
-    public void writeValue(org.omg.CORBA.portable.OutputStream out,
-            java.io.Serializable value) {
-        // System.out.println ("AbstractObjectArrayDescriptor::writeValue
-        // "+getRepositoryID ());
+    @Override
+    public void writeValue(OutputStream out,
+            Serializable value) {
 
         Object[] arr = (Object[]) value;
         out.write_long(arr.length);
@@ -471,8 +497,9 @@ class AbstractObjectArrayDescriptor extends ArrayDescriptor {
         }
     }
 
-    public java.io.Serializable readValue(
-            org.omg.CORBA.portable.InputStream in, java.util.Map offsetMap,
+    @Override
+    public Serializable readValue(
+            InputStream in, Map offsetMap,
             Integer key) {
         try {
             ObjectReader reader = makeCorbaObjectReader(in, offsetMap, null);
@@ -485,19 +512,20 @@ class AbstractObjectArrayDescriptor extends ArrayDescriptor {
             for (int i = 0; i < length; i++) {
                 try {
                     arr[i] = reader.readAbstractObject();
-                } catch (org.omg.CORBA.portable.IndirectionException ex) {
+                } catch (IndirectionException ex) {
                     arr[i] = offsetMap.get(new Integer(ex.offset));
                     // reader.addValueBox (ex.offset, new ArrayBox (i, arr));
                 }
             }
 
-            return (java.io.Serializable) arr;
+            return arr;
 
-        } catch (java.io.IOException ex) {
+        } catch (IOException ex) {
             throw (MARSHAL)new MARSHAL(ex.getMessage()).initCause(ex);
         }
     }
 
+    @Override
     Object copyObject(Object value, CopyState state) {
         final Object[] orig = (Object[]) value;
         final Object[] result = (Object[]) Array.newInstance(elementType,
@@ -521,7 +549,8 @@ class AbstractObjectArrayDescriptor extends ArrayDescriptor {
         return result;
     }
 
-    void printFields(java.io.PrintWriter pw, java.util.Map recurse, Object val) {
+    @Override
+    void printFields(PrintWriter pw, Map recurse, Object val) {
         Object[] arr = (Object[]) val;
         TypeDescriptor desc = repo.getDescriptor(elementType);
         pw.print("length=" + arr.length + "; ");
@@ -540,19 +569,21 @@ class BooleanArrayDescriptor extends ArrayDescriptor {
         super(type, elemType, rep);
     }
 
-    public java.io.Serializable readValue(
-            org.omg.CORBA.portable.InputStream in, java.util.Map offsetMap,
+    @Override
+    public Serializable readValue(
+            InputStream in, Map offsetMap,
             Integer key) {
         boolean[] arr = new boolean[in.read_long()];
         offsetMap.put(key, arr);
         for (int i = 0; i < arr.length; i++) {
             arr[i] = in.read_boolean();
         }
-        return (java.io.Serializable) arr;
+        return arr;
     }
 
-    public void writeValue(org.omg.CORBA.portable.OutputStream out,
-            java.io.Serializable value) {
+    @Override
+    public void writeValue(OutputStream out,
+            Serializable value) {
         boolean[] arr = (boolean[]) value;
         out.write_long(arr.length);
         for (int i = 0; i < arr.length; i++) {
@@ -560,6 +591,7 @@ class BooleanArrayDescriptor extends ArrayDescriptor {
         }
     }
 
+    @Override
     Object copyObject(Object value, CopyState state) {
         if (((boolean[]) value).length == 0)
             return value;
@@ -569,7 +601,8 @@ class BooleanArrayDescriptor extends ArrayDescriptor {
         return copy;
     }
 
-    void printFields(java.io.PrintWriter pw, java.util.Map recurse, Object val) {
+    @Override
+    void printFields(PrintWriter pw, Map recurse, Object val) {
         boolean[] arr = (boolean[]) val;
         pw.print("length=" + arr.length + "; ");
         for (int i = 0; i < arr.length; i++) {
@@ -583,34 +616,32 @@ class BooleanArrayDescriptor extends ArrayDescriptor {
 }
 
 class ByteArrayDescriptor extends ArrayDescriptor {
-
     ByteArrayDescriptor(Class type, Class elemType, TypeRepository rep) {
         super(type, elemType, rep);
     }
 
-    public java.io.Serializable readValue(
-            org.omg.CORBA.portable.InputStream in, java.util.Map offsetMap,
+    @Override
+    public Serializable readValue(
+            InputStream in, Map offsetMap,
             Integer key) {
         byte[] arr = new byte[in.read_long()];
         offsetMap.put(key, arr);
         for (int i = 0; i < arr.length; i++) {
             arr[i] = in.read_octet();
         }
-        return (java.io.Serializable) arr;
+        return arr;
     }
 
-    public void writeValue(org.omg.CORBA.portable.OutputStream out,
-            java.io.Serializable value) {
+    @Override
+    public void writeValue(OutputStream out,
+            Serializable value) {
         byte[] arr = (byte[]) value;
         out.write_long(arr.length);
 
         out.write_octet_array(arr, 0, arr.length);
-
-        // for (int i = 0; i < arr.length; i++) {
-        // out.write_octet(arr[i]);
-        // }
     }
 
+    @Override
     Object copyObject(Object value, CopyState state) {
         if (((byte[]) value).length == 0)
             return value;
@@ -620,7 +651,8 @@ class ByteArrayDescriptor extends ArrayDescriptor {
         return copy;
     }
 
-    void printFields(java.io.PrintWriter pw, java.util.Map recurse, Object val) {
+    @Override
+    void printFields(PrintWriter pw, Map recurse, Object val) {
         byte[] arr = (byte[]) val;
         pw.print("length=" + arr.length + "; ");
         for (int i = 0; i < arr.length; i++) {
@@ -637,23 +669,26 @@ class CharArrayDescriptor extends ArrayDescriptor {
         super(type, elemType, rep);
     }
 
-    public java.io.Serializable readValue(
-            org.omg.CORBA.portable.InputStream in, java.util.Map offsetMap,
+    @Override
+    public Serializable readValue(
+            InputStream in, Map offsetMap,
             Integer key) {
         int len = in.read_long();
         char[] arr = new char[len];
         offsetMap.put(key, arr);
         in.read_wchar_array(arr, 0, len);
-        return (java.io.Serializable) arr;
+        return arr;
     }
 
-    public void writeValue(org.omg.CORBA.portable.OutputStream out,
-            java.io.Serializable value) {
+    @Override
+    public void writeValue(OutputStream out,
+            Serializable value) {
         char[] arr = (char[]) value;
         out.write_long(arr.length);
         out.write_wchar_array(arr, 0, arr.length);
     }
 
+    @Override
     Object copyObject(Object value, CopyState state) {
         if (((char[]) value).length == 0)
             return value;
@@ -663,7 +698,8 @@ class CharArrayDescriptor extends ArrayDescriptor {
         return copy;
     }
 
-    void printFields(java.io.PrintWriter pw, java.util.Map recurse, Object val) {
+    @Override
+    void printFields(PrintWriter pw, Map recurse, Object val) {
         char[] arr = (char[]) val;
         pw.print("length=" + arr.length + "; ");
         for (int i = 0; i < arr.length; i++) {
@@ -680,19 +716,21 @@ class ShortArrayDescriptor extends ArrayDescriptor {
         super(type, elemType, rep);
     }
 
-    public java.io.Serializable readValue(
-            org.omg.CORBA.portable.InputStream in, java.util.Map offsetMap,
+    @Override
+    public Serializable readValue(
+            InputStream in, Map offsetMap,
             Integer key) {
         short[] arr = new short[in.read_long()];
         offsetMap.put(key, arr);
         for (int i = 0; i < arr.length; i++) {
             arr[i] = in.read_short();
         }
-        return (java.io.Serializable) arr;
+        return arr;
     }
 
-    public void writeValue(org.omg.CORBA.portable.OutputStream out,
-            java.io.Serializable value) {
+    @Override
+    public void writeValue(OutputStream out,
+            Serializable value) {
         short[] arr = (short[]) value;
         out.write_long(arr.length);
         for (int i = 0; i < arr.length; i++) {
@@ -700,6 +738,7 @@ class ShortArrayDescriptor extends ArrayDescriptor {
         }
     }
 
+    @Override
     Object copyObject(Object value, CopyState state) {
         if (((short[]) value).length == 0)
             return value;
@@ -709,7 +748,8 @@ class ShortArrayDescriptor extends ArrayDescriptor {
         return copy;
     }
 
-    void printFields(java.io.PrintWriter pw, java.util.Map recurse, Object val) {
+    @Override
+    void printFields(PrintWriter pw, Map recurse, Object val) {
         short[] arr = (short[]) val;
         pw.print("length=" + arr.length + "; ");
         for (int i = 0; i < arr.length; i++) {
@@ -726,19 +766,21 @@ class IntArrayDescriptor extends ArrayDescriptor {
         super(type, elemType, rep);
     }
 
-    public java.io.Serializable readValue(
-            org.omg.CORBA.portable.InputStream in, java.util.Map offsetMap,
+    @Override
+    public Serializable readValue(
+            InputStream in, Map offsetMap,
             Integer key) {
         int[] arr = new int[in.read_long()];
         offsetMap.put(key, arr);
         for (int i = 0; i < arr.length; i++) {
             arr[i] = in.read_long();
         }
-        return (java.io.Serializable) arr;
+        return arr;
     }
 
-    public void writeValue(org.omg.CORBA.portable.OutputStream out,
-            java.io.Serializable value) {
+    @Override
+    public void writeValue(OutputStream out,
+            Serializable value) {
         int[] arr = (int[]) value;
         out.write_long(arr.length);
         for (int i = 0; i < arr.length; i++) {
@@ -746,6 +788,7 @@ class IntArrayDescriptor extends ArrayDescriptor {
         }
     }
 
+    @Override
     Object copyObject(Object value, CopyState state) {
         if (((int[]) value).length == 0)
             return value;
@@ -755,7 +798,8 @@ class IntArrayDescriptor extends ArrayDescriptor {
         return copy;
     }
 
-    void printFields(java.io.PrintWriter pw, java.util.Map recurse, Object val) {
+    @Override
+    void printFields(PrintWriter pw, Map recurse, Object val) {
         int[] arr = (int[]) val;
         pw.print("length=" + arr.length + "; ");
         for (int i = 0; i < arr.length; i++) {
@@ -772,19 +816,21 @@ class LongArrayDescriptor extends ArrayDescriptor {
         super(type, elemType, rep);
     }
 
-    public java.io.Serializable readValue(
-            org.omg.CORBA.portable.InputStream in, java.util.Map offsetMap,
+    @Override
+    public Serializable readValue(
+            InputStream in, Map offsetMap,
             Integer key) {
         long[] arr = new long[in.read_long()];
         offsetMap.put(key, arr);
         for (int i = 0; i < arr.length; i++) {
             arr[i] = in.read_longlong();
         }
-        return (java.io.Serializable) arr;
+        return arr;
     }
 
-    public void writeValue(org.omg.CORBA.portable.OutputStream out,
-            java.io.Serializable value) {
+    @Override
+    public void writeValue(OutputStream out,
+            Serializable value) {
         long[] arr = (long[]) value;
         out.write_long(arr.length);
         for (int i = 0; i < arr.length; i++) {
@@ -792,6 +838,7 @@ class LongArrayDescriptor extends ArrayDescriptor {
         }
     }
 
+    @Override
     Object copyObject(Object value, CopyState state) {
         if (((long[]) value).length == 0)
             return value;
@@ -801,7 +848,8 @@ class LongArrayDescriptor extends ArrayDescriptor {
         return copy;
     }
 
-    void printFields(java.io.PrintWriter pw, java.util.Map recurse, Object val) {
+    @Override
+    void printFields(PrintWriter pw, Map recurse, Object val) {
         long[] arr = (long[]) val;
         pw.print("length=" + arr.length + "; ");
         for (int i = 0; i < arr.length; i++) {
@@ -819,19 +867,21 @@ class FloatArrayDescriptor extends ArrayDescriptor {
         super(type, elemType, rep);
     }
 
-    public java.io.Serializable readValue(
-            org.omg.CORBA.portable.InputStream in, java.util.Map offsetMap,
+    @Override
+    public Serializable readValue(
+            InputStream in, Map offsetMap,
             Integer key) {
         float[] arr = new float[in.read_long()];
         offsetMap.put(key, arr);
         for (int i = 0; i < arr.length; i++) {
             arr[i] = in.read_float();
         }
-        return (java.io.Serializable) arr;
+        return arr;
     }
 
-    public void writeValue(org.omg.CORBA.portable.OutputStream out,
-            java.io.Serializable value) {
+    @Override
+    public void writeValue(OutputStream out,
+            Serializable value) {
         float[] arr = (float[]) value;
         out.write_long(arr.length);
         for (int i = 0; i < arr.length; i++) {
@@ -839,6 +889,7 @@ class FloatArrayDescriptor extends ArrayDescriptor {
         }
     }
 
+    @Override
     Object copyObject(Object value, CopyState state) {
         if (((float[]) value).length == 0)
             return value;
@@ -848,7 +899,8 @@ class FloatArrayDescriptor extends ArrayDescriptor {
         return copy;
     }
 
-    void printFields(java.io.PrintWriter pw, java.util.Map recurse, Object val) {
+    @Override
+    void printFields(PrintWriter pw, Map recurse, Object val) {
         float[] arr = (float[]) val;
         pw.print("length=" + arr.length + "; ");
         for (int i = 0; i < arr.length; i++) {
@@ -865,19 +917,21 @@ class DoubleArrayDescriptor extends ArrayDescriptor {
         super(type, elemType, rep);
     }
 
-    public java.io.Serializable readValue(
-            org.omg.CORBA.portable.InputStream in, java.util.Map offsetMap,
+    @Override
+    public Serializable readValue(
+            InputStream in, Map offsetMap,
             Integer key) {
         double[] arr = new double[in.read_long()];
         offsetMap.put(key, arr);
         for (int i = 0; i < arr.length; i++) {
             arr[i] = in.read_double();
         }
-        return (java.io.Serializable) arr;
+        return arr;
     }
 
-    public void writeValue(org.omg.CORBA.portable.OutputStream out,
-            java.io.Serializable value) {
+    @Override
+    public void writeValue(OutputStream out,
+            Serializable value) {
         double[] arr = (double[]) value;
         out.write_long(arr.length);
         for (int i = 0; i < arr.length; i++) {
@@ -885,6 +939,7 @@ class DoubleArrayDescriptor extends ArrayDescriptor {
         }
     }
 
+    @Override
     Object copyObject(Object value, CopyState state) {
         if (((double[]) value).length == 0)
             return value;
@@ -894,7 +949,8 @@ class DoubleArrayDescriptor extends ArrayDescriptor {
         return copy;
     }
 
-    void printFields(java.io.PrintWriter pw, java.util.Map recurse, Object val) {
+    @Override
+    void printFields(PrintWriter pw, Map recurse, Object val) {
         double[] arr = (double[]) val;
         pw.print("length=" + arr.length + "; ");
         for (int i = 0; i < arr.length; i++) {

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ClassBaseDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ClassBaseDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ClassBaseDescriptor.java
index debb1ec..708faea 100644
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ClassBaseDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ClassBaseDescriptor.java
@@ -1,41 +1,47 @@
 package org.apache.yoko.rmi.impl;
 
+import org.omg.CORBA.MARSHAL;
+
+import javax.rmi.CORBA.ClassDesc;
 import java.lang.reflect.Field;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
-import javax.rmi.CORBA.ClassDesc;
-
-import org.omg.CORBA.MARSHAL;
-
 abstract class ClassBaseDescriptor extends ValueDescriptor {
 
     ClassBaseDescriptor(Class type, TypeRepository repository) {
         super(type, repository);
     }
 
-    @Override
-    public void init() {
-        super.init();
+    private volatile Field repidField = null;
+    private Field genRepIdField() {
+        return findField("repid");
+    }
+    final Field getRepidField() {
+        if (null == repidField) repidField = genRepIdField();
+        return repidField;
+    }
 
-        final Class<?> clz = ClassDesc.class;
+    private volatile Field cobebaseField = null;
+    private Field genCodebaseField() {
+        return findField("codebase");
+    }
+    final Field getCobebaseField() {
+        if (null == cobebaseField) cobebaseField = genCodebaseField();
+        return cobebaseField;
+    }
 
-        AccessController.doPrivileged(new PrivilegedAction<Void>() {
-            @Override
-            public Void run() {
+    private Field findField(final String fieldName) {
+        return AccessController.doPrivileged(new PrivilegedAction<Field>() {
+            public Field run() {
                 try {
-                    final Field repid_field = clz.getDeclaredField("repid");
-                    repid_field.setAccessible(true);
-                    final Field codebase_field = clz.getDeclaredField("codebase");
-                    codebase_field.setAccessible(true);
-                    init(repid_field, codebase_field);
-                } catch (NoSuchFieldException ex) {
-                    throw (MARSHAL)new MARSHAL("no such field: " + ex).initCause(ex);
+                    Field f = ClassDesc.class.getDeclaredField(fieldName);
+                    f.setAccessible(true);
+                    return f;
+                } catch (NoSuchFieldException e) {
+                    throw (MARSHAL)new MARSHAL("no such field: " + e).initCause(e);
                 }
-                return null;
             }
         });
     }
-
-    abstract void init(Field repid_field, Field codebase_field);
 }

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ClassDescDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ClassDescDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ClassDescDescriptor.java
index 1a93939..8106755 100644
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ClassDescDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ClassDescDescriptor.java
@@ -16,19 +16,10 @@ import org.omg.CORBA.MARSHAL;
 class ClassDescDescriptor extends ClassBaseDescriptor {
     private static final Logger logger = Logger.getLogger(ClassDescDescriptor.class.getName());
 
-    private Field repid_field;
-    private Field codebase_field;
-
     ClassDescDescriptor(TypeRepository repository) {
         super(ClassDesc.class, repository);
     }
 
-    @Override
-    void init(Field repid_field, Field codebase_field) {
-        this.repid_field = repid_field;
-        this.codebase_field = codebase_field;
-    }
-
     /** Read an instance of this value from a CDR stream */
     @Override
     public Serializable readResolve(final Serializable value) {
@@ -38,8 +29,8 @@ class ClassDescDescriptor extends ClassBaseDescriptor {
             public Class<?> run() {
                 String className = "<unknown>";
                 try {
-                    String repid = (String) repid_field.get(desc);
-                    String codebase = (String) codebase_field.get(desc);
+                    String repid = (String) getRepidField().get(desc);
+                    String codebase = (String) getCobebaseField().get(desc);
 
                     Class<?> result = RepIds.query(repid).codebase(codebase).toClass();
                     if (null != result) return result;

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ClassDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ClassDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ClassDescriptor.java
index d296aed..6389139 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ClassDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ClassDescriptor.java
@@ -34,20 +34,11 @@ import org.omg.CORBA.MARSHAL;
 class ClassDescriptor extends ClassBaseDescriptor {
     private static final Logger logger = Logger.getLogger(ClassDescriptor.class.getName());
 
-    private Field repid_field;
-    private Field codebase_field;
-
     ClassDescriptor(TypeRepository repository) {
         super(Class.class, repository);
     }
 
     @Override
-    void init(Field repid_field, Field codebase_field) {
-        this.repid_field = repid_field;
-        this.codebase_field = codebase_field;
-    }
-
-    @Override
     Object copyObject(Object orig, CopyState state) {
         state.put(orig, orig);
         return orig;
@@ -66,10 +57,10 @@ class ClassDescriptor extends ClassBaseDescriptor {
 
                             ValueHandler handler = Util.createValueHandler();
                             String repId = handler.getRMIRepositoryID(type);
-                            repid_field.set(desc, repId);
+                            getRepidField().set(desc, repId);
 
                             String codebase = Util.getCodebase(type);
-                            codebase_field.set(desc, codebase);
+                            getCobebaseField().set(desc, codebase);
 
                             return desc;
 
@@ -84,5 +75,4 @@ class ClassDescriptor extends ClassBaseDescriptor {
 
         return result;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/DateValueDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/DateValueDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/DateValueDescriptor.java
index bfc500c..562312e 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/DateValueDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/DateValueDescriptor.java
@@ -43,5 +43,4 @@ class DateValueDescriptor extends ValueDescriptor {
         state.put(orig, result);
         return result;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/EnumDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/EnumDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/EnumDescriptor.java
index 44e692c..84478ca 100644
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/EnumDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/EnumDescriptor.java
@@ -19,11 +19,9 @@
 package org.apache.yoko.rmi.impl;
 
 import org.apache.yoko.util.yasf.Yasf;
-import org.apache.yoko.util.yasf.YasfThreadLocal;
 
 import java.io.IOException;
 import java.io.Serializable;
-import java.util.Set;
 
 class EnumDescriptor extends ValueDescriptor {
     public EnumDescriptor(Class<?> type, TypeRepository repo) {
@@ -58,7 +56,6 @@ class EnumDescriptor extends ValueDescriptor {
 
     @Override
     protected void defaultWriteValue(ObjectWriter writer, Serializable val) throws IOException {
-        checkInit();
         if ((writer.yasfSet != null) && !!!writer.yasfSet.contains(Yasf.ENUM_FIXED)) {
             // talking to an old yoko that expects an ordinal field to be written;
             ordinalField.write(writer, val);

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/EnumSubclassDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/EnumSubclassDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/EnumSubclassDescriptor.java
index 12c34c6..9ba2f4b 100644
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/EnumSubclassDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/EnumSubclassDescriptor.java
@@ -18,14 +18,13 @@
 
 package org.apache.yoko.rmi.impl;
 
+import org.omg.CORBA.portable.IndirectionException;
+import org.omg.CORBA.portable.InputStream;
+
 import java.io.IOException;
 import java.io.Serializable;
 import java.util.Map;
 
-import org.apache.yoko.rmi.util.StringUtil;
-import org.omg.CORBA.portable.IndirectionException;
-import org.omg.CORBA.portable.InputStream;
-
 class EnumSubclassDescriptor extends ValueDescriptor {
     @SuppressWarnings("rawtypes")
     private final Class enumType;
@@ -42,12 +41,6 @@ class EnumSubclassDescriptor extends ValueDescriptor {
     }
 
     @Override
-    public final void init() {
-        super.init();
-        // Avoid doing anything that would cause the calculated classHash to change
-    }
-
-    @Override
     protected final long getSerialVersionUID() {
         return 0L;
     }

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ExceptionDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ExceptionDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ExceptionDescriptor.java
index 166a202..691a566 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ExceptionDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ExceptionDescriptor.java
@@ -26,7 +26,7 @@ class ExceptionDescriptor extends ValueDescriptor {
     private volatile String ex_repid = null;
 
     private String genExceptionRepId() {
-        String name = _java_class.getName();
+        String name = type.getName();
         final String encname;
 
         if (name.endsWith("Exception")) {
@@ -38,7 +38,7 @@ class ExceptionDescriptor extends ValueDescriptor {
         return String.format("IDL:%s:1.0", encname.replace('.', '/'));
     }
 
-    public final String getExceptionRepositoryID() {
+    final String getExceptionRepositoryID() {
         if (ex_repid == null) ex_repid = genExceptionRepId();
         return ex_repid;
     }

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/FVDEnumDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/FVDEnumDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/FVDEnumDescriptor.java
index 9c7de4f..f6e42dc 100644
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/FVDEnumDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/FVDEnumDescriptor.java
@@ -46,7 +46,7 @@ class FVDEnumDescriptor extends EnumDescriptor {
     }
 
     @Override
-    TypeCode getTypeCode() {
+    protected TypeCode genTypeCode() {
         return fvd.type;
     }
 

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/FVDEnumSubclassDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/FVDEnumSubclassDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/FVDEnumSubclassDescriptor.java
index 9d8f2c3..5b07d69 100644
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/FVDEnumSubclassDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/FVDEnumSubclassDescriptor.java
@@ -48,7 +48,7 @@ class FVDEnumSubclassDescriptor extends EnumSubclassDescriptor {
     }
 
     @Override
-    TypeCode getTypeCode() {
+    protected final TypeCode genTypeCode() {
         return fvd.type;
     }
 

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/FVDValueDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/FVDValueDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/FVDValueDescriptor.java
index ad379af..1b353be 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/FVDValueDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/FVDValueDescriptor.java
@@ -18,16 +18,15 @@
 package org.apache.yoko.rmi.impl;
 
 import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.ValueMember;
 import org.omg.CORBA.ValueDefPackage.FullValueDescription;
+import org.omg.CORBA.ValueMember;
 
 /**
  * @author krab
  */
 class FVDValueDescriptor extends ValueDescriptor {
-    FullValueDescription fvd;
-
-    String repid;
+    final FullValueDescription fvd;
+    final String repid;
 
     FVDValueDescriptor(FullValueDescription fvd, Class clazz,
             TypeRepository rep, String repid, ValueDescriptor super_desc) {
@@ -61,10 +60,10 @@ class FVDValueDescriptor extends ValueDescriptor {
         _fields = new_fields;
     }
 
-    FieldDescriptor findField(ValueMember valueMember) {
+    private FieldDescriptor findField(ValueMember valueMember) {
         FieldDescriptor result = null;
 
-        for (Class c = _java_class; c != null; c = c.getSuperclass()) {
+        for (Class c = type; c != null; c = c.getSuperclass()) {
             TypeDescriptor td = repo.getDescriptor(c);
             if (td instanceof ValueDescriptor) {
                 ValueDescriptor vd = (ValueDescriptor) td;
@@ -90,26 +89,18 @@ class FVDValueDescriptor extends ValueDescriptor {
         return repid;
     }
 
+    @Override
     org.omg.CORBA.ValueDefPackage.FullValueDescription getFullValueDescription() {
         return fvd;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.yoko.rmi.impl.TypeDescriptor#getTypeCode()
-     */
-    public TypeCode getTypeCode() {
+    @Override
+    protected final TypeCode genTypeCode() {
         return fvd.type;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.yoko.rmi.impl.TypeDescriptor#isCustomMarshalled()
-     */
+    @Override
     public boolean isCustomMarshalled() {
         return fvd.is_custom;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/IDLEntityDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/IDLEntityDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/IDLEntityDescriptor.java
index 11dc546..c7949fe 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/IDLEntityDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/IDLEntityDescriptor.java
@@ -18,111 +18,83 @@
 
 package org.apache.yoko.rmi.impl;
 
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.OutputStream;
+
+import javax.rmi.CORBA.Util;
+import java.io.Serializable;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-
-import org.omg.CORBA.MARSHAL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Map;
 
 class IDLEntityDescriptor extends ValueDescriptor {
-    Method _read_method;
-
-    Method _write_method;
-
-    Method _type_method;
-
-    boolean isAbstract = false;
-
-    boolean isCorba = false; 
+    private final boolean isCorba;
+    private final Class helperType;
 
     IDLEntityDescriptor(Class type, TypeRepository repository) {
         super(type, repository);
 
-        if (org.omg.CORBA.Object.class.isAssignableFrom(type)) {
-            isCorba = true; 
+        isCorba = org.omg.CORBA.Object.class.isAssignableFrom(type);
+        try {
+            final String helperName = type.getName() + "Helper";
+            helperType = Util.loadClass(helperName, null, type.getClassLoader());
+        } catch (ClassNotFoundException ex) {
+            throw new RuntimeException("cannot load IDL Helper class for "
+                    + type, ex);
         }
     }
 
-    public String getIDLName() {
-        return "org_omg_boxedIDL_" + super.getIDLName();
-    }
-
     @Override
-    public void init() {
-        super.init();
-
-        try {
-            final Class type = _java_class;
-            final String helperName = type.getName() + "Helper";
-            final Class helperClass = javax.rmi.CORBA.Util.loadClass(
-                    helperName, null, type.getClassLoader());
-
-            java.security.AccessController
-                    .doPrivileged(new java.security.PrivilegedAction() {
-                        public Object run() {
-
-                            try {
-                                Method _id_method = null;
-                                Method[] methods = helperClass
-                                        .getDeclaredMethods();
-                                for (int i = 0; i < methods.length; i++) {
-                                    String name = methods[i].getName();
-
-                                    if (name.equals("id"))
-                                        _id_method = methods[i];
-
-                                    else if (name.equals("read"))
-                                        _read_method = methods[i];
-
-                                    else if (name.equals("write"))
-                                        _write_method = methods[i];
-
-                                    else if (name.equals("type"))
-                                        _type_method = methods[i];
-                                }
-
-                                // _repid = (String)
-                                _id_method.invoke(null, new Object[0]);
-
-                            } catch (InvocationTargetException ex) {
-                                throw new RuntimeException(
-                                        "cannot initialize: " + ex.getCause(), ex.getCause());
-
-                            } catch (IllegalAccessException ex) {
-                                throw new RuntimeException(
-                                        "cannot initialize: " + ex, ex);
-                            }
+    protected final String genIDLName() {
+        return "org_omg_boxedIDL_" + super.genIDLName();
+    }
 
-                            return null;
-                        }
-                    });
+    private volatile Method readMethod = null;
+    private Method getReadMethod() {
+        if (null == readMethod) readMethod = genHelperMethod("write");
+        return readMethod;
+    }
 
-        } catch (ClassNotFoundException ex) {
-            throw new RuntimeException("cannot load IDL Helper class for "
-                    + _java_class, ex);
-        }
+    private volatile Method writeMethod = null;
+    private Method getWriteMethod() {
+        if (null == writeMethod) writeMethod = genHelperMethod("write");
+        return writeMethod;
     }
-    
-    @Deprecated
-    public void initIDL() {
-    	init();
+
+    private volatile Method typeMethod = null;
+    private Method getTypeMethod() {
+        if (null == typeMethod) typeMethod = genHelperMethod("type");
+        return typeMethod;
     }
 
-    /*
-     * public String getRepositoryID () { return _repid; }
-     */
+    private Method genHelperMethod(final String name) {
+        return AccessController.doPrivileged(new PrivilegedAction<Method>() {
+            @Override
+            public Method run() {
+                for (Method m: helperType.getDeclaredMethods()) {
+                    if (m.getName().equals(name)) return m;
+                }
+                throw new RuntimeException("Unable to find " + name + " method for " + helperType.getName());
+            }
+        });
+    }
 
     /** Read an instance of this value from a CDR stream */
-    public Object read(org.omg.CORBA.portable.InputStream in) {
+    @Override
+    public Object read(InputStream in) {
         org.omg.CORBA_2_3.portable.InputStream _in = (org.omg.CORBA_2_3.portable.InputStream) in;
         
         // there are two ways we need to deal with IDLEntity classes.  Ones that also implement 
         // the CORBA Object interface are actual corba objects, and must be handled that way. 
         // Other IDLEntity classes are just transmitted by value. 
         if (isCorba) {
-            return _in.read_Object(_java_class);
-        }
-        else {
-
+            return _in.read_Object(type);
+        } else {
             // we directly call read_value() on the stream here, with the explicitly specified
             // repository ID.  The input stream will handle validating the value tag for us, and eventually
             // will call our readValue() method to deserialize the object.
@@ -130,80 +102,57 @@ class IDLEntityDescriptor extends ValueDescriptor {
         }
     }
 
-    public java.io.Serializable readValue(
-            final org.omg.CORBA.portable.InputStream in,
-            final java.util.Map offsetMap, final java.lang.Integer offset) {
-        final java.io.Serializable value = (java.io.Serializable) readValue(in);
-
-        offsetMap.put(offset, value);
-
-        return value;
-    }
-
-    public Object readValue(org.omg.CORBA.portable.InputStream in) {
-        if (isAbstract) {
-            throw new MARSHAL("IDL Entity " + _java_class.getName()
-                    + " is abstract");
-        }
-
+    @Override
+    public Serializable readValue(final InputStream in, final Map offsetMap, final Integer offset) {
         try {
-            return _read_method.invoke(null, new Object[] { in });
+            Serializable value = (Serializable) getReadMethod().invoke(null, new Object[]{in});
+            offsetMap.put(offset, value);
+            return value;
         } catch (InvocationTargetException ex) {
-            throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(""+ex.getCause()).initCause(ex.getCause());
+            throw (MARSHAL)new MARSHAL(""+ex.getCause()).initCause(ex.getCause());
         } catch (IllegalAccessException ex) {
-            throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(ex.getMessage()).initCause(ex);
+            throw (MARSHAL)new MARSHAL(ex.getMessage()).initCause(ex);
         }
     }
 
     /** Write an instance of this value to a CDR stream */
-    public void write(org.omg.CORBA.portable.OutputStream out, Object val) {
+    @Override
+    public void write(OutputStream out, Object val) {
         org.omg.CORBA_2_3.portable.OutputStream _out = (org.omg.CORBA_2_3.portable.OutputStream) out;
 
         
         // there are two ways we need to deal with IDLEntity classes.  Ones that also implement 
         // the CORBA Object interface are actual corba objects, and must be handled that way. 
         // Other IDLEntity classes are just transmitted by value. 
-        if (val instanceof org.omg.CORBA.portable.ObjectImpl) {
+        if (val instanceof ObjectImpl) {
             _out.write_Object((org.omg.CORBA.Object)val); 
-        }
-        else {
+        } else {
             // we directly call write_value() on the stream here, with the explicitly specified
             // repository ID.  the output stream will handle writing the value tag for us, and eventually
             // will call our writeValue() method to serialize the object.
-            _out.write_value((java.io.Serializable)val, getRepositoryID());
+            _out.write_value((Serializable)val, getRepositoryID());
         }
-
     }
 
-    public void writeValue(org.omg.CORBA.portable.OutputStream out, java.io.Serializable val) {
-        if (isAbstract) {
-            throw new MARSHAL("IDL Entity " + _java_class.getName()
-                    + " is abstract");
-        }
-
+    @Override
+    public void writeValue(OutputStream out, Serializable val) {
         try {
-            _write_method.invoke(null, new Object[] { out, val });
+            getWriteMethod().invoke(null, new Object[] { out, val });
         } catch (InvocationTargetException ex) {
-            throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(""+ ex.getCause()).initCause(ex.getCause());
+            throw (MARSHAL)new MARSHAL(""+ ex.getCause()).initCause(ex.getCause());
         } catch (IllegalAccessException ex) {
-            throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(ex.getMessage()).initCause(ex);
+            throw (MARSHAL)new MARSHAL(ex.getMessage()).initCause(ex);
         }
     }
 
-    org.omg.CORBA.TypeCode getTypeCode() {
-        if (_type_code == null) {
-
-            try {
-                _type_code = (org.omg.CORBA.TypeCode) _type_method.invoke(null,
-                        new Object[0]);
-            } catch (InvocationTargetException ex) {
-                throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(""+ex.getCause()).initCause(ex.getCause());
-            } catch (IllegalAccessException ex) {
-                throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(ex.getMessage()).initCause(ex);
-            }
+    @Override
+    protected TypeCode genTypeCode() {
+        try {
+            return (TypeCode) getTypeMethod().invoke(null, new Object[0]);
+        } catch (InvocationTargetException ex) {
+            throw (MARSHAL)new MARSHAL(""+ex.getCause()).initCause(ex.getCause());
+        } catch (IllegalAccessException ex) {
+            throw (MARSHAL)new MARSHAL(ex.getMessage()).initCause(ex);
         }
-
-        return _type_code;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/MethodDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/MethodDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/MethodDescriptor.java
index 16f1a51..81a049b 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/MethodDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/MethodDescriptor.java
@@ -33,7 +33,7 @@ public final class MethodDescriptor extends ModelElement {
     static final Logger logger = Logger.getLogger(MethodDescriptor.class.getName());
 
     /** The refleced method object for this method */
-    java.lang.reflect.Method reflected_method;
+    final java.lang.reflect.Method reflected_method;
 
     java.lang.Object invocation_block_selector;
 
@@ -226,7 +226,7 @@ public final class MethodDescriptor extends ModelElement {
     public org.omg.CORBA.portable.OutputStream writeException(
             org.omg.CORBA.portable.ResponseHandler response, Throwable ex) {
         for (int i = 0; i < exception_types.length; i++) {
-            if (exception_types[i]._java_class.isInstance(ex)) {
+            if (exception_types[i].type.isInstance(ex)) {
                 org.omg.CORBA.portable.OutputStream out = response
                         .createExceptionReply();
                 org.omg.CORBA_2_3.portable.OutputStream out2 = (org.omg.CORBA_2_3.portable.OutputStream) out;

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ModelElement.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ModelElement.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ModelElement.java
index a3fd62e..3f37c7b 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ModelElement.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ModelElement.java
@@ -21,26 +21,18 @@ package org.apache.yoko.rmi.impl;
 abstract class ModelElement {
     final TypeRepository repo;
     final String java_name;    // the java name of the type
-    private String idl_name;   // fully resolved package name
-    private volatile boolean notInit = true;
-
     protected ModelElement(TypeRepository repo, String java_name) {
         this.repo = repo;
         this.java_name = java_name;
     }
 
     protected void init() {
-        idl_name = genIDLName();
-        notInit = false;
     }
 
+    private volatile String idlName = null;   // fully resolved package name
     protected abstract String genIDLName();
-
-    final void checkInit() {
-        if (notInit) throw new IllegalStateException("Not initialized: " + java_name);
-    }
-    public String getIDLName() {
-        checkInit();
-        return idl_name;
+    public final String getIDLName() {
+        if (null == idlName) idlName = genIDLName();
+        return idlName;
     }
 }

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/PortableRemoteObjectImpl.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/PortableRemoteObjectImpl.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/PortableRemoteObjectImpl.java
index 7de9c1a..e7ae51d 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/PortableRemoteObjectImpl.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/PortableRemoteObjectImpl.java
@@ -299,7 +299,7 @@ public class PortableRemoteObjectImpl implements PortableRemoteObjectDelegate {
         }
 
         TypeRepository repository = state.getTypeRepository();
-        RemoteDescriptor desc = (RemoteDescriptor) repository.getRemoteDescriptor(type);
+        RemoteDescriptor desc = (RemoteDescriptor) repository.getRemoteInterface(type);
 
         MethodDescriptor[] mdesc = desc.getMethods();
         MethodDescriptor[] descriptors = new MethodDescriptor[mdesc.length + 1];

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIServant.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIServant.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIServant.java
index e70afe6..7653afd 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIServant.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIServant.java
@@ -39,7 +39,7 @@ public class RMIServant extends org.omg.PortableServer.Servant implements
     byte[] _id;
 
     Class getJavaClass() {
-        return _descriptor._java_class;
+        return _descriptor.type;
     }
 
     RMIState getRMIState() {
@@ -178,7 +178,7 @@ public class RMIServant extends org.omg.PortableServer.Servant implements
             throw new IllegalArgumentException();
         }
 
-        _descriptor = _state.getTypeRepository().getRemoteDescriptor(target.getClass()).getRemoteInterface();
+        _descriptor = _state.getTypeRepository().getRemoteInterface(target.getClass()).getRemoteInterface();
 
         if (_descriptor == null) {
             throw new RuntimeException("remote classes not supported");

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIStub.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIStub.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIStub.java
index e700e06..db41e66 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIStub.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIStub.java
@@ -19,7 +19,6 @@
 package org.apache.yoko.rmi.impl;
 
 import org.apache.yoko.rmi.api.PortableRemoteObjectExt;
-import org.omg.CORBA.ORB;
 import org.omg.CORBA.SystemException;
 import org.omg.CORBA.portable.Delegate;
 import org.omg.CORBA.portable.ServantObject;
@@ -40,7 +39,7 @@ public abstract class RMIStub extends javax.rmi.CORBA.Stub {
         Class remote_interface = getClass().getInterfaces()[0];
 
         RMIState state = (RMIState) PortableRemoteObjectExt.getState();
-        Object o = state.getTypeRepository().getRemoteDescriptor(
+        Object o = state.getTypeRepository().getRemoteInterface(
                 remote_interface);
 
         _descriptor = (RemoteDescriptor) o;

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIStubDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIStubDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIStubDescriptor.java
index 4cd36cc..231981c 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIStubDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIStubDescriptor.java
@@ -18,6 +18,8 @@
 
 package org.apache.yoko.rmi.impl;
 
+import java.io.IOException;
+
 class RMIStubDescriptor extends ValueDescriptor {
     RMIStubDescriptor(Class type, TypeRepository repository) {
         super(type, repository);
@@ -25,7 +27,7 @@ class RMIStubDescriptor extends ValueDescriptor {
 
     @Override
     protected String genRepId() {
-        final Class[] ifaces = _java_class.getInterfaces();
+        final Class[] ifaces = type.getInterfaces();
         if (ifaces.length != 2 || ifaces[1] != org.apache.yoko.rmi.util.stub.Stub.class) {
             throw new RuntimeException("Unexpected RMIStub structure");
         }
@@ -41,14 +43,15 @@ class RMIStubDescriptor extends ValueDescriptor {
     // state is written. This ensures that fields in the proxy are
     // not included on the wire.
     //
+    @Override
     protected void writeValue(ObjectWriter writer, java.io.Serializable val)
-            throws java.io.IOException {
+            throws IOException {
         _super_descriptor.writeValue(writer, val);
     }
 
+    @Override
     protected void readValue(ObjectReader reader, java.io.Serializable value)
-            throws java.io.IOException {
+            throws IOException {
         _super_descriptor.readValue(reader, value);
     }
-
 }

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIStubHandler.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIStubHandler.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIStubHandler.java
index d0855be..07bb558 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIStubHandler.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RMIStubHandler.java
@@ -42,7 +42,7 @@ public class RMIStubHandler implements StubHandler, java.io.Serializable {
     static final RMIStubHandler instance = new RMIStubHandler();
 
     public Object stubWriteReplace(RMIStub stub) {
-        Class type = stub._descriptor._java_class;
+        Class type = stub._descriptor.type;
     return new org.apache.yoko.rmi.impl.RMIPersistentStub(stub, type);
     }
     

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RemoteClassDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RemoteClassDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RemoteClassDescriptor.java
index c660417..4eb3ea3 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RemoteClassDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RemoteClassDescriptor.java
@@ -18,14 +18,26 @@
 
 package org.apache.yoko.rmi.impl;
 
-class RemoteClassDescriptor extends RemoteDescriptor {
+final class RemoteClassDescriptor extends RemoteDescriptor {
 
     @Override
     protected String genRepId() {
-        return String.format("IDL:%s:1.0", _java_class.getName().replace('.', '/'));
+        return String.format("IDL:%s:1.0", type.getName().replace('.', '/'));
     }
 
     RemoteClassDescriptor(Class type, TypeRepository repository) {
         super(type, repository);
     }
+
+    @Override
+    protected RemoteInterfaceDescriptor genRemoteInterface() {
+        Class[] remotes = collect_remote_interfaces(type);
+        if (remotes.length == 0) {
+            throw new RuntimeException(type.getName()
+                    + " has no remote interfaces");
+        }
+        Class most_specific_interface = remotes[0];
+
+        return repo.getDescriptor(most_specific_interface).getRemoteInterface();
+    }
 }

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RemoteDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RemoteDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RemoteDescriptor.java
index 5e91b4b..1c8b726 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RemoteDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RemoteDescriptor.java
@@ -18,9 +18,19 @@
 
 package org.apache.yoko.rmi.impl;
 
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+import java.io.IOException;
+import java.io.PrintWriter;
 import java.lang.reflect.Method;
+import java.rmi.Remote;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.HashMap;
@@ -45,31 +55,10 @@ abstract class RemoteDescriptor extends TypeDescriptor {
 
     protected List super_descriptors;
 
-    public RemoteInterfaceDescriptor getRemoteInterface() {
-        RemoteInterfaceDescriptor result = super.getRemoteInterface();
-        if (result != null) { 
-            return result;
-        }
-
-        if (this instanceof RemoteInterfaceDescriptor) {
-            result = (RemoteInterfaceDescriptor) this;
-        } else {
-            Class[] remotes = collect_remote_interfaces(_java_class);
-            if (remotes.length == 0) {
-                throw new RuntimeException(_java_class.getName()
-                        + " has no remote interfaces");
-            }
-            Class most_specific_interface = remotes[0];
-
-            result = (RemoteInterfaceDescriptor)repo.getDescriptor(most_specific_interface);
-        }
-
-        setRemoteInterface(result);
-
-        return result;
-    }
+    @Override
+    protected abstract RemoteInterfaceDescriptor genRemoteInterface();
 
-    static final Class REMOTE_CLASS = java.rmi.Remote.class;
+    static final Class REMOTE_CLASS = Remote.class;
 
     static final Class OBJECT_CLASS = java.lang.Object.class;
 
@@ -79,7 +68,7 @@ abstract class RemoteDescriptor extends TypeDescriptor {
 
     public String[] all_interfaces() {
         if (_ids == null) {
-            Class[] ifaces = collect_remote_interfaces(_java_class);
+            Class[] ifaces = collect_remote_interfaces(type);
             int len = ifaces.length;
             String[] ids = new String[len];
             for (int i = 0; i < len; i++) {
@@ -99,7 +88,7 @@ abstract class RemoteDescriptor extends TypeDescriptor {
         }
 
         if (method_map == null) {
-            method_map = new java.util.HashMap();
+            method_map = new HashMap();
             for (int i = 0; i < operations.length; i++) {
                 method_map.put(operations[i].getIDLName(), operations[i]);
             }
@@ -110,7 +99,7 @@ abstract class RemoteDescriptor extends TypeDescriptor {
 
     void debugMethodMap() {
         if (logger.isLoggable(Level.FINER)) {
-            logger.finer("METHOD MAP FOR " + _java_class.getName());
+            logger.finer("METHOD MAP FOR " + type.getName());
 
             Iterator it = method_map.keySet().iterator();
             while (it.hasNext()) {
@@ -127,7 +116,7 @@ abstract class RemoteDescriptor extends TypeDescriptor {
         }
 
         if (refl_method_map == null) {
-            refl_method_map = new java.util.HashMap();
+            refl_method_map = new HashMap();
             for (int i = 0; i < operations.length; i++) {
                 refl_method_map.put(operations[i].getReflectedMethod(), operations[i]);
             }
@@ -165,7 +154,7 @@ abstract class RemoteDescriptor extends TypeDescriptor {
         ArrayList method_list = new ArrayList();
 
         // first step is to build the helpers for any super classes
-        Class[] supers = _java_class.getInterfaces();
+        Class[] supers = type.getInterfaces();
         super_descriptors = new ArrayList();
 
         Map all_methods = new HashMap();
@@ -234,7 +223,7 @@ abstract class RemoteDescriptor extends TypeDescriptor {
         }
 
         // init method map...
-        method_map = new java.util.HashMap();
+        method_map = new HashMap();
         for (int i = 0; i < method_list.size(); i++) {
             MethodDescriptor desc = (MethodDescriptor) method_list.get(i);
             logger.finer("Adding method " + desc.java_name + " to method map under " + desc.getIDLName());
@@ -266,7 +255,7 @@ abstract class RemoteDescriptor extends TypeDescriptor {
     Method[] getLocalMethods() {
         ArrayList result = new ArrayList();
 
-        addNonRemoteInterfaceMethods(_java_class, result);
+        addNonRemoteInterfaceMethods(type, result);
 
         Method[] out = new Method[result.size()];
         result.toArray(out);
@@ -391,27 +380,26 @@ abstract class RemoteDescriptor extends TypeDescriptor {
     }
 
     /** Read an instance of this value from a CDR stream */
-    public Object read(org.omg.CORBA.portable.InputStream in) {
-        return javax.rmi.PortableRemoteObject.narrow(in.read_Object(),
-                _java_class);
+    @Override
+    public Object read(InputStream in) {
+        return PortableRemoteObject.narrow(in.read_Object(),
+                type);
     }
 
     /** Write an instance of this value to a CDR stream */
-    public void write(org.omg.CORBA.portable.OutputStream out, Object val) {
+    @Override
+    public void write(OutputStream out, Object val) {
         javax.rmi.CORBA.Util.writeRemoteObject(out, val);
     }
 
-    org.omg.CORBA.TypeCode getTypeCode() {
-        if (_type_code == null) {
-            org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
-            return orb.create_interface_tc(getRepositoryID(), _java_class
-                    .getName());
-        }
-
-        return _type_code;
+    @Override
+    protected final TypeCode genTypeCode() {
+        ORB orb = ORB.init();
+        return orb.create_interface_tc(getRepositoryID(), type.getName());
     }
 
-    void writeMarshalValue(java.io.PrintWriter pw, String outName,
+    @Override
+    void writeMarshalValue(PrintWriter pw, String outName,
             String paramName) {
         pw.print("javax.rmi.CORBA.Util.writeRemoteObject(");
         pw.print(outName);
@@ -420,16 +408,17 @@ abstract class RemoteDescriptor extends TypeDescriptor {
         pw.print(')');
     }
 
-    void writeUnmarshalValue(java.io.PrintWriter pw, String inName) {
+    @Override
+    void writeUnmarshalValue(PrintWriter pw, String inName) {
         pw.print('(');
-        pw.print(_java_class.getName());
+        pw.print(type.getName());
         pw.print(')');
         pw.print(PortableRemoteObject.class.getName());
         pw.print(".narrow(");
         pw.print(inName);
         pw.print('.');
         pw.print("read_Object(),");
-        pw.print(_java_class.getName());
+        pw.print(type.getName());
         pw.print(".class)");
     }
 
@@ -468,9 +457,9 @@ abstract class RemoteDescriptor extends TypeDescriptor {
         return pkgname + "._" + cplain + "_Stub";
     }
 
-    void writeStubClass(java.io.PrintWriter pw) {
+    void writeStubClass(PrintWriter pw) {
 
-        Class c = _java_class;
+        Class c = type;
         String cname = c.getName();
         String fullname = stubClassName(c);
         //String stubname = fullname.substring(fullname.lastIndexOf('.') + 1);
@@ -515,7 +504,7 @@ abstract class RemoteDescriptor extends TypeDescriptor {
     }
 
     String getStubClassName() {
-        Class c = _java_class;
+        Class c = type;
         String cname = c.getName();
 
         String pkgname = null;
@@ -531,10 +520,11 @@ abstract class RemoteDescriptor extends TypeDescriptor {
         return pkgname + "." + "_" + cplain + "_Stub";
     }
 
+    @Override
     void addDependencies(Set classes) {
-        Class c = _java_class;
+        Class c = type;
 
-        if (c == java.rmi.Remote.class || classes.contains(c))
+        if (c == Remote.class || classes.contains(c))
             return;
 
         classes.add(c);
@@ -556,6 +546,7 @@ abstract class RemoteDescriptor extends TypeDescriptor {
         }
     }
 
+    @Override
     boolean copyInStub() {
         return false;
     }

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/431478f4/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RemoteInterfaceDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RemoteInterfaceDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RemoteInterfaceDescriptor.java
index 72f8e91..c75478a 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RemoteInterfaceDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/RemoteInterfaceDescriptor.java
@@ -18,8 +18,13 @@
 
 package org.apache.yoko.rmi.impl;
 
-class RemoteInterfaceDescriptor extends RemoteDescriptor {
+final class RemoteInterfaceDescriptor extends RemoteDescriptor {
     RemoteInterfaceDescriptor(Class type, TypeRepository repository) {
         super(type, repository);
     }
+
+    @Override
+    protected RemoteInterfaceDescriptor genRemoteInterface() {
+        return this;
+    }
 }


Mime
View raw message