1 23 24 39 40 package com.sun.enterprise.admin.jmx.remote.server.rmi; 41 42 import java.rmi.registry.Registry ; 43 import java.rmi.registry.LocateRegistry ; 44 import java.rmi.server.RMIClientSocketFactory ; 45 import java.rmi.server.RMIServerSocketFactory ; 46 import java.util.logging.Logger ; 47 48 import com.sun.enterprise.admin.jmx.remote.IStringManager; 49 import com.sun.enterprise.admin.jmx.remote.StringManagerFactory; 50 51 57 class RmiStubRegistryHandler { 58 59 private static IStringManager sm = 60 StringManagerFactory.getServerStringManager( RmiStubRegistryHandler.class ); 61 62 private final Logger logger; 63 64 70 RmiStubRegistryHandler(final int port, final boolean secureRegistry, final Logger logger) { 71 if (logger == null) 72 throw new IllegalArgumentException ("Internal: Null logger"); 73 this.logger = logger; 74 if (secureRegistry) { 75 throw new UnsupportedOperationException ("Yet to be implemented"); 76 } 77 else { 78 startInsecureRegistry(port); 79 } 80 } 81 83 93 private void startInsecureRegistry(final int port) { 94 try { 95 final Registry r = LocateRegistry.createRegistry(port); 96 logBindings(r, port); 97 } 98 catch (final Exception e) { 99 final String msg = sm.getString("no.port.msg", new Integer (port)); 100 throw new RuntimeException (e); 101 } 102 } 103 105 114 private void logBindings(final Registry r, final int port) { 115 try { 116 final String [] bs = r.list(); 117 logger.fine("Initial Bindings in RmiRegistry at port: [" + port + "] :"); 118 for (int i = 0 ; i < bs.length ; i++) { 119 logger.fine("JMX Connector RMI Registry binding: " + bs[i]); 120 } 121 } 122 catch(final Exception e) { 123 e.printStackTrace(); 124 } 126 } 127 } | Popular Tags |