geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Forrest Xia <forres...@gmail.com>
Subject Questions on yoko Util class in yoko-rmi-spec should use the interface class as the key?
Date Tue, 11 Jan 2011 09:46:51 GMT
Hi,

When I debug a corba related application, I managed to trace into a piece of
yoko code like this:

public class Util {
    private static UtilDelegate delegate = null;
    private static final String defaultDelegate =
"org.apache.yoko.rmi.impl.UtilImpl";

    // To hide the default constructor we should implement empty private
constructor
    private Util() {}

    static {
        // Initialize delegate
        String delegateName = (String)AccessController.doPrivileged(new
GetSystemPropertyAction("javax.rmi.CORBA.UtilClass", defaultDelegate));
        try {

            // this is a little bit recursive, but this will use the full
default search order for locating
            // this.
            delegate = (UtilDelegate)Util.loadClass(delegateName, null,
null).newInstance();
        } catch (Throwable e) {
            org.omg.CORBA.INITIALIZE ex = new org.omg.CORBA.INITIALIZE("Can
not create Util delegate: "+delegateName);
            ex.initCause(e);
            throw ex;
        }
    }
...

According to another code in ProviderRegistryImpl$SPIRegistry(the id's value
is the delegateName variable as highlighted above), while the registry
hashmap's key is "javax.rmi.CORBA.UtilClass", that will lead CNF exception.
private synchronized BundleProviderLoader getLoader(String id) {
            // synchronize on the registry instance
            if (registry != null) {
                log.fine("registry: " + registry);
                // return the first match, if any
                List<BundleProviderLoader> list = registry.get(id);
                if (list != null && !list.isEmpty()) {
                    return list.get(0);
                }
            }
            // no match here
            return null;
        }

So my question is should we change the Util code to pass the interface class
name to load class? Please advise.

Forrest

Mime
View raw message