FileDocCategorySizeDatePackage
RmiStubRegistryHandler.javaAPI DocGlassfish v2 API6235Wed Aug 01 11:37:58 BST 2007com.sun.enterprise.admin.jmx.remote.server.rmi

RmiStubRegistryHandler

public class RmiStubRegistryHandler extends Object
A package-private class that deals with the RMI registry in the VM. This RMI registry is used as the naming service to find the rmi stub.
author
kedar
since
Sun Java System Application Server 8.1

Fields Summary
private static com.sun.enterprise.admin.jmx.remote.IStringManager
sm
private final Logger
logger
Constructors Summary
RmiStubRegistryHandler(int port, boolean secureRegistry, Logger logger, RMIServerSocketFactory rmiregssf)
Starts the RMI registry at the given port. If the security flag is false an in-process "insecure" rmi registry will be created. If the flag is true, an attempt will be made if the registry could be made secure. Running on JDK 1.4.x has a limitation of not being able to create multiple registries in the same VM.

    
                                                                   
          
             
        if (logger == null)
            throw new IllegalArgumentException("Internal: Null logger");
        this.logger = logger;
        if (secureRegistry) {
            throw new UnsupportedOperationException("Yet to be implemented");
        }
        else {
            startInsecureRegistry(port, rmiregssf);
        }
    
Methods Summary
private voidlogBindings(java.rmi.registry.Registry r, int port)

        try {
            final String[] bs = r.list();
            logger.fine("Initial Bindings in RmiRegistry at port: [" + port + "] :");
            for (int i = 0 ; i < bs.length ; i++) {
                logger.fine("JMX Connector RMI Registry binding: " + bs[i]);
            }
        }
        catch(final Exception e) {
            e.printStackTrace();
            //squelching this exception is okay, as only logging is affected.
        }
    
private voidstartInsecureRegistry(int port, java.rmi.server.RMIServerSocketFactory rmiregssf)

        try {
            final Registry r = LocateRegistry.createRegistry(port, 
                RMISocketFactory.getDefaultSocketFactory(), rmiregssf);
            logBindings(r, port);
        }
        catch (final Exception e) {
            final String msg = sm.getString("no.port.msg", new Integer(port));
            throw new RuntimeException(e);
        }