org.jboss.ha.jndi
Class DetachedHANamingService

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.ha.jndi.DetachedHANamingService
All Implemented Interfaces:
DetachedHANamingServiceMBean (src) , MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , Service (src) , ServiceMBean (src)
Direct Known Subclasses:
HANamingService (src)

public class DetachedHANamingService
extends ServiceMBeanSupport (src)
implements DetachedHANamingServiceMBean (src)

Management Bean for the protocol independent HA-JNDI service. This allows the naming service transport layer to be provided by a detached invoker service like JRMPInvokerHA + ProxyFactoryHA.


Field Summary
protected  java.lang.String adGroupAddress
          The autodiscovery multicast group
protected  int adGroupPort
          The autodiscovery port
protected  org.jboss.ha.jndi.DetachedHANamingService.AutomaticDiscovery autoDiscovery
          The runable task for discovery request packets
protected  int autoDiscoveryTTL
          The autodiscovery Multicast reply TTL
protected  int backlog
          The bootstrapSocket listen queue depth
protected  java.net.InetAddress bindAddress
          The interface to bind to.
protected  java.net.ServerSocket bootstrapSocket
          The jnp server socket through which the HAJNDI stub is vended
protected  java.net.InetAddress discoveryBindAddress
          The interface to bind the Multicast socket for autodiscovery to
protected  boolean discoveryDisabled
          A flag indicating if autodiscovery should be disabled
protected  javax.net.ServerSocketFactory jnpServerSocketFactory
          An optional custom server socket factory for the bootstrap lookup
protected  java.lang.String jnpServerSocketFactoryName
          The class name of the optional custom JNP server socket factory
protected  ThreadPool (src) lookupPool
          The thread pool used to handle jnp stub lookup requests
protected  java.util.Map marshalledInvocationMapping
          The mapping from the long method hash to the Naming Method
protected  HAPartition (src) partition
          The HAPartition used for the state transfer service
protected  java.lang.String partitionName
          The partition name used to lookup the HAPartition binding
protected  int port
          The jnp protocol listening port.
protected  Naming (src) stub
          The protocol stub returned to clients by the bootstrap lookup
protected  HAJNDI (src) theServer
          The Naming interface server implementation
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
DetachedHANamingService()
           
 
Method Summary
protected  void createService()
          Sub-classes should override this method to provide custum 'create' logic.
protected  HAPartition (src) findHAPartitionWithName(java.lang.String name)
           
 java.lang.String getAutoDiscoveryAddress()
          Get the auto-discovery bootstrap multicast address.
 java.lang.String getAutoDiscoveryBindAddress()
          Get the auto-discovery bootstrap multicast bind address.
 int getAutoDiscoveryGroup()
          Get the Auto-discovery multicast port
 int getAutoDiscoveryTTL()
          Get the TTL (time-to-live) for autodiscovery IP multicast packets
 int getBacklog()
          Get the accept backlog for the bootstrap server socket
 java.lang.String getBindAddress()
          Get the bootstrap IP address on which the HA-JNDI stub is made available
 boolean getDiscoveryDisabled()
          prevent autodiscovery service from starting
 java.util.Map getMethodMap()
          Expose the Naming service interface mapping as a read-only attribute
protected  Naming (src) getNamingProxy()
          Get the Naming proxy for the transport.
 java.lang.String getPartitionName()
          Get the name of the underlying partition for the cluster to use.
 int getPort()
          Get the bootstrap port on which the HA-JNDI stub is made available
 ObjectName (src) getProxyFactoryObjectName()
          Get the proxy factory service name used to create the Naming transport proxy.
protected  void initBootstrapListener()
          Bring up the bootstrap lookup port for obtaining the naming service proxy
 java.lang.Object invoke(Invocation (src)  invocation)
          Expose the Naming service via JMX to invokers.
 void setAutoDiscoveryAddress(java.lang.String adAddress)
          Set the auto-discovery bootstrap multicast address.
 void setAutoDiscoveryBindAddress(java.lang.String address)
          Set the auto-discovery bootstrap multicast bind address.
 void setAutoDiscoveryGroup(int adGroup)
          Set the Auto-discovery multicast port.
 void setAutoDiscoveryTTL(int ttl)
          Set the TTL (time-to-live) for autodiscovery IP multicast packets
 void setBacklog(int backlog)
          Set the accept backlog for the bootstrap server socket
 void setBindAddress(java.lang.String host)
          Set the bootstrap IP address on which the HA-JNDI stub is made available
 void setDiscoveryDisabled(boolean disable)
          prevent autodiscovery service from starting
 void setJNPServerSocketFactory(java.lang.String factoryClassName)
           
 void setLookupPool(BasicThreadPoolMBean (src)  poolMBean)
          Set the thread pool used for the bootstrap and autodiscovery lookups
 void setPartitionName(java.lang.String partitionName)
          Set the name of the underlying partition for the cluster to use.
 void setPort(int p)
          Set the bootstrap port on which the HA-JNDI stub is made available
 void setProxyFactoryObjectName(ObjectName (src)  proxyFactory)
          Set the proxy factory service name used to create the Naming transport proxy.
protected  void startService()
          Sub-classes should override this method to provide custum 'start' logic.
 void startService(HAPartition (src)  haPartition)
           
protected  void stopService()
          Sub-classes should override this method to provide custum 'stop' logic.
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
create, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport (src)
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ServiceMBean (src)
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service (src)
create, destroy, start, stop
 

Field Detail

bootstrapSocket

protected java.net.ServerSocket bootstrapSocket
The jnp server socket through which the HAJNDI stub is vended


theServer

protected HAJNDI (src)  theServer
The Naming interface server implementation


marshalledInvocationMapping

protected java.util.Map marshalledInvocationMapping
The mapping from the long method hash to the Naming Method


stub

protected Naming (src)  stub
The protocol stub returned to clients by the bootstrap lookup


partition

protected HAPartition (src)  partition
The HAPartition used for the state transfer service


partitionName

protected java.lang.String partitionName
The partition name used to lookup the HAPartition binding


bindAddress

protected java.net.InetAddress bindAddress
The interface to bind to. This is useful for multi-homed hosts that want control over which interfaces accept connections.


backlog

protected int backlog
The bootstrapSocket listen queue depth


port

protected int port
The jnp protocol listening port. The default is 1100, the same as the RMI registry default port.


adGroupAddress

protected java.lang.String adGroupAddress
The autodiscovery multicast group


adGroupPort

protected int adGroupPort
The autodiscovery port


discoveryBindAddress

protected java.net.InetAddress discoveryBindAddress
The interface to bind the Multicast socket for autodiscovery to


autoDiscovery

protected org.jboss.ha.jndi.DetachedHANamingService.AutomaticDiscovery autoDiscovery
The runable task for discovery request packets


discoveryDisabled

protected boolean discoveryDisabled
A flag indicating if autodiscovery should be disabled


autoDiscoveryTTL

protected int autoDiscoveryTTL
The autodiscovery Multicast reply TTL


jnpServerSocketFactory

protected javax.net.ServerSocketFactory jnpServerSocketFactory
An optional custom server socket factory for the bootstrap lookup


jnpServerSocketFactoryName

protected java.lang.String jnpServerSocketFactoryName
The class name of the optional custom JNP server socket factory


lookupPool

protected ThreadPool (src)  lookupPool
The thread pool used to handle jnp stub lookup requests

Constructor Detail

DetachedHANamingService

public DetachedHANamingService()
Method Detail

getMethodMap

public java.util.Map getMethodMap()
Expose the Naming service interface mapping as a read-only attribute

Specified by:
getMethodMap in interface DetachedHANamingServiceMBean (src)
Returns:
A Map of the Naming interface

getPartitionName

public java.lang.String getPartitionName()
Description copied from interface: DetachedHANamingServiceMBean (src)
Get the name of the underlying partition for the cluster to use.

Specified by:
getPartitionName in interface DetachedHANamingServiceMBean (src)

setPartitionName

public void setPartitionName(java.lang.String partitionName)
Description copied from interface: DetachedHANamingServiceMBean (src)
Set the name of the underlying partition for the cluster to use.

Specified by:
setPartitionName in interface DetachedHANamingServiceMBean (src)

getProxyFactoryObjectName

public ObjectName (src)  getProxyFactoryObjectName()
Description copied from interface: DetachedHANamingServiceMBean (src)
Get the proxy factory service name used to create the Naming transport proxy.

Specified by:
getProxyFactoryObjectName in interface DetachedHANamingServiceMBean (src)

setProxyFactoryObjectName

public void setProxyFactoryObjectName(ObjectName (src)  proxyFactory)
Description copied from interface: DetachedHANamingServiceMBean (src)
Set the proxy factory service name used to create the Naming transport proxy.

Specified by:
setProxyFactoryObjectName in interface DetachedHANamingServiceMBean (src)

setPort

public void setPort(int p)
Description copied from interface: DetachedHANamingServiceMBean (src)
Set the bootstrap port on which the HA-JNDI stub is made available

Specified by:
setPort in interface DetachedHANamingServiceMBean (src)

getPort

public int getPort()
Description copied from interface: DetachedHANamingServiceMBean (src)
Get the bootstrap port on which the HA-JNDI stub is made available

Specified by:
getPort in interface DetachedHANamingServiceMBean (src)

getBindAddress

public java.lang.String getBindAddress()
Description copied from interface: DetachedHANamingServiceMBean (src)
Get the bootstrap IP address on which the HA-JNDI stub is made available

Specified by:
getBindAddress in interface DetachedHANamingServiceMBean (src)

setBindAddress

public void setBindAddress(java.lang.String host)
                    throws java.net.UnknownHostException
Description copied from interface: DetachedHANamingServiceMBean (src)
Set the bootstrap IP address on which the HA-JNDI stub is made available

Specified by:
setBindAddress in interface DetachedHANamingServiceMBean (src)
Throws:
java.net.UnknownHostException

getBacklog

public int getBacklog()
Description copied from interface: DetachedHANamingServiceMBean (src)
Get the accept backlog for the bootstrap server socket

Specified by:
getBacklog in interface DetachedHANamingServiceMBean (src)

setBacklog

public void setBacklog(int backlog)
Description copied from interface: DetachedHANamingServiceMBean (src)
Set the accept backlog for the bootstrap server socket

Specified by:
setBacklog in interface DetachedHANamingServiceMBean (src)

setDiscoveryDisabled

public void setDiscoveryDisabled(boolean disable)
Description copied from interface: DetachedHANamingServiceMBean (src)
prevent autodiscovery service from starting

Specified by:
setDiscoveryDisabled in interface DetachedHANamingServiceMBean (src)

getDiscoveryDisabled

public boolean getDiscoveryDisabled()
Description copied from interface: DetachedHANamingServiceMBean (src)
prevent autodiscovery service from starting

Specified by:
getDiscoveryDisabled in interface DetachedHANamingServiceMBean (src)

getAutoDiscoveryAddress

public java.lang.String getAutoDiscoveryAddress()
Description copied from interface: DetachedHANamingServiceMBean (src)
Get the auto-discovery bootstrap multicast address.

Specified by:
getAutoDiscoveryAddress in interface DetachedHANamingServiceMBean (src)

setAutoDiscoveryAddress

public void setAutoDiscoveryAddress(java.lang.String adAddress)
Description copied from interface: DetachedHANamingServiceMBean (src)
Set the auto-discovery bootstrap multicast address. If null or empty, no auto-discovery bootstrap socket will be created.

Specified by:
setAutoDiscoveryAddress in interface DetachedHANamingServiceMBean (src)

getAutoDiscoveryGroup

public int getAutoDiscoveryGroup()
Description copied from interface: DetachedHANamingServiceMBean (src)
Get the Auto-discovery multicast port

Specified by:
getAutoDiscoveryGroup in interface DetachedHANamingServiceMBean (src)

setAutoDiscoveryGroup

public void setAutoDiscoveryGroup(int adGroup)
Description copied from interface: DetachedHANamingServiceMBean (src)
Set the Auto-discovery multicast port.

Specified by:
setAutoDiscoveryGroup in interface DetachedHANamingServiceMBean (src)

getAutoDiscoveryBindAddress

public java.lang.String getAutoDiscoveryBindAddress()
Description copied from interface: DetachedHANamingServiceMBean (src)
Get the auto-discovery bootstrap multicast bind address.

Specified by:
getAutoDiscoveryBindAddress in interface DetachedHANamingServiceMBean (src)

setAutoDiscoveryBindAddress

public void setAutoDiscoveryBindAddress(java.lang.String address)
                                 throws java.net.UnknownHostException
Description copied from interface: DetachedHANamingServiceMBean (src)
Set the auto-discovery bootstrap multicast bind address. If not specified and a BindAddress is specified, the BindAddress will be used.

Specified by:
setAutoDiscoveryBindAddress in interface DetachedHANamingServiceMBean (src)
Throws:
java.net.UnknownHostException

getAutoDiscoveryTTL

public int getAutoDiscoveryTTL()
Description copied from interface: DetachedHANamingServiceMBean (src)
Get the TTL (time-to-live) for autodiscovery IP multicast packets

Specified by:
getAutoDiscoveryTTL in interface DetachedHANamingServiceMBean (src)

setAutoDiscoveryTTL

public void setAutoDiscoveryTTL(int ttl)
Description copied from interface: DetachedHANamingServiceMBean (src)
Set the TTL (time-to-live) for autodiscovery IP multicast packets

Specified by:
setAutoDiscoveryTTL in interface DetachedHANamingServiceMBean (src)

setJNPServerSocketFactory

public void setJNPServerSocketFactory(java.lang.String factoryClassName)
                               throws java.lang.ClassNotFoundException,
                                      java.lang.InstantiationException,
                                      java.lang.IllegalAccessException
Throws:
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

setLookupPool

public void setLookupPool(BasicThreadPoolMBean (src)  poolMBean)
Description copied from interface: DetachedHANamingServiceMBean (src)
Set the thread pool used for the bootstrap and autodiscovery lookups

Specified by:
setLookupPool in interface DetachedHANamingServiceMBean (src)
Parameters:
poolMBean -

startService

public void startService(HAPartition (src)  haPartition)
                  throws java.lang.Exception
Throws:
java.lang.Exception

createService

protected void createService()
                      throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'create' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
createService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

startService

protected void startService()
                     throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'start' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
startService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

stopService

protected void stopService()
                    throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'stop' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
stopService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

invoke

public java.lang.Object invoke(Invocation (src)  invocation)
                        throws java.lang.Exception
Expose the Naming service via JMX to invokers.

Specified by:
invoke in interface DetachedHANamingServiceMBean (src)
Parameters:
invocation - A pointer to the invocation object
Returns:
Return value of method invocation.
Throws:
java.lang.Exception - Failed to invoke method.

initBootstrapListener

protected void initBootstrapListener()
Bring up the bootstrap lookup port for obtaining the naming service proxy


findHAPartitionWithName

protected HAPartition (src)  findHAPartitionWithName(java.lang.String name)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

getNamingProxy

protected Naming (src)  getNamingProxy()
                         throws java.lang.Exception
Get the Naming proxy for the transport. This version looks up the proxyFactory service Proxy attribute. Subclasses can override this to set the proxy another way.

Returns:
The Naming proxy for the protocol used with the HAJNDI service
Throws:
java.lang.Exception