FileDocCategorySizeDatePackage
HANamingService.javaAPI DocJBoss 4.2.14998Fri Jul 13 20:52:36 BST 2007org.jboss.ha.jndi

HANamingService

public class HANamingService extends DetachedHANamingService implements HANamingServiceMBean
Management Bean for HA-JNDI service for the legacy version that is coupled to the RMI/JRMP protocol. The DetachedHANamingService should be used with the approriate detached invoker service.
author
Bill Burke
author
Sacha Labourey
author
Scott.Stark@jboss.org
version
$Revision: 57188 $

Fields Summary
protected RMIClientSocketFactory
clientSocketFactory
An optional custom client socket factory
protected RMIServerSocketFactory
serverSocketFactory
An optional custom server socket factory
protected String
clientSocketFactoryName
The class name of the optional custom client socket factory
protected String
serverSocketFactoryName
The class name of the optional custom server socket factory
protected String
loadBalancePolicy
The class name of the load balancing policy
protected int
rmiPort
The RMI port on which the Naming implementation will be exported. The default is 0 which means use any available port.
org.jboss.ha.framework.server.HARMIServerImpl
rmiserver
Constructors Summary
public HANamingService()


   // Public --------------------------------------------------------

    
   
      // for JMX
   
Methods Summary
public java.lang.StringgetClientSocketFactory()

      return serverSocketFactoryName;
   
public java.lang.StringgetLoadBalancePolicy()

      return loadBalancePolicy;
   
protected org.jnp.interfaces.NaminggetNamingProxy()

      Class clazz;
      LoadBalancePolicy policy;
      
      rmiserver = new HARMIServerImpl(partition, "HAJNDI", Naming.class,
         theServer, rmiPort, clientSocketFactory, serverSocketFactory, bindAddress);
         
      ClassLoader cl = Thread.currentThread().getContextClassLoader();
      clazz = cl.loadClass(loadBalancePolicy);
      policy = (LoadBalancePolicy)clazz.newInstance();
   
      Naming proxy = (Naming) rmiserver.createHAStub(policy);
      return proxy;
   
public intgetRmiPort()

      return rmiPort;
   
public java.lang.StringgetServerSocketFactory()

      return serverSocketFactoryName;
   
public voidsetClientSocketFactory(java.lang.String factoryClassName)

      this.clientSocketFactoryName = factoryClassName;
      ClassLoader loader = Thread.currentThread().getContextClassLoader();
      Class clazz = loader.loadClass(clientSocketFactoryName);
      clientSocketFactory = (RMIClientSocketFactory) clazz.newInstance();
   
public voidsetLoadBalancePolicy(java.lang.String policyClassName)

      loadBalancePolicy = policyClassName;
   
public voidsetRmiPort(int p)

      rmiPort = p;
   
public voidsetServerSocketFactory(java.lang.String factoryClassName)

      this.serverSocketFactoryName = factoryClassName;
      ClassLoader loader = Thread.currentThread().getContextClassLoader();
      Class clazz = loader.loadClass(serverSocketFactoryName);
      serverSocketFactory = (RMIServerSocketFactory) clazz.newInstance();
   
protected voidstopService()

      super.stopService();
      // Unexport server
      log.debug("destroy ha rmiserver");
      this.rmiserver.destroy ();