org.ow2.jonas.discovery.internal
Class MulticastDiscoveryServiceImpl

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.ow2.jonas.lib.reconfig.ReconfigEmitter
          extended by org.ow2.jonas.lib.service.AbsServiceImpl
              extended by org.ow2.jonas.discovery.base.BaseDiscovery
                  extended by org.ow2.jonas.discovery.internal.MulticastDiscoveryServiceImpl
All Implemented Interfaces:
NotificationBroadcaster, NotificationEmitter, DiscoveryServiceImplMBean, DiscoveryService, MulticastDiscoveryServiceImplMBean, Service

public class MulticastDiscoveryServiceImpl
extends BaseDiscovery
implements MulticastDiscoveryServiceImplMBean

The discovery service creates and starts at least a DiscoveryManager which is a MBean that multi-casts discovery information to all the servers who joined the discovery multicast group.

The discovery service may also create a Enroller and a DiscoveryClient, and in this case the current server becomes a discovery server.

Discovery information contains information allowing to remotely manage a server in the group.

Discovery multicast group is a group of servers which can be managed remotely by a discovery server.

Discovery server is the server in the group who detains the discovery information concerning all the servers in the group.

Author:
Adriana Danes

Field Summary
 
Fields inherited from class org.ow2.jonas.discovery.base.BaseDiscovery
urlsList
 
Fields inherited from class org.ow2.jonas.lib.reconfig.ReconfigEmitter
RECONFIG_TYPE, SAVE_RECONFIG_TYPE
 
Constructor Summary
MulticastDiscoveryServiceImpl()
           
 
Method Summary
protected  void doStart()
          Start the discovery service.
protected  void doStop()
          Stop the discovery service.
 DiscEvent getDiscEvent(String serverName, String domainName, String[] connectorURLs, String state)
          Create a 'fake' DiscEvent object containing info to establish a JMX connection with a new server in the domain.
 String getDiscoveryAddress()
           
 ObjectName getDiscoveryClient()
          Gets the MBean of disovery client.
 ObjectName getDiscoveryManager()
          Gets the MBean of disovery manager.
 String getDiscoveryPort()
           
 String getDiscoveryProtocolVersion()
           
 String getDiscoveryTtl()
           
 ObjectName getEnroller()
          Gets the MBean of the enroller.
 int getGreetingPort()
          Gets the greeting listening port.
 String getJonasName()
           
 String getListeningIp()
           
 int getListeningPort()
           
 MBeanServer getMbeanServer()
           
 String getMulticastAddress()
           
 String getMulticastPort()
           
 ObjectName getMyOn()
           
 String getServerId()
           
 int getSourcePort()
          Gets the discovery source port.
 String[] getUrls()
           
 ArrayList getUrlsList()
           
 void setDomainName(String domainName)
           
 void setGreetingPort(int port)
          sets the greeting listening port.
 void setJonasName(String jonasName)
           
 void setListeningIp(String listeningIp)
           
 void setListeningPort(int listeningPort)
           
 void setMbeanServer(MBeanServer mbeanServer)
           
 void setMulticastAddress(String address)
           
 void setMulticastPort(int port)
           
 void setMyOn(ObjectName myOn)
           
 void setServerId(String serverId)
           
 void setSourcePort(int sourcePort)
          sets discovery source port.
 void setUrls(String[] urls)
           
 void setUrlsList(ArrayList urlsList)
           
 void startDiscoveryMaster()
          Management operation allowing to make the current server become a master if its not already.
 
Methods inherited from class org.ow2.jonas.discovery.base.BaseDiscovery
getGreetingTimeout, getIsDiscoveryMaster, getJmxService, getTtl, setGreetingTimeout, setJmxService, setMaster, setTtl
 
Methods inherited from class org.ow2.jonas.lib.service.AbsServiceImpl
convertToList, doInit, getDomainName, getJonasServerName, getName, getServerProperties, init, isStarted, setName, setServerProperties, start, stop, throwRequirementException, toString
 
Methods inherited from class org.ow2.jonas.lib.reconfig.ReconfigEmitter
initLogger, sendReconfigNotification, sendSaveNotification
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ow2.jonas.discovery.base.DiscoveryServiceImplMBean
getDomainName, getGreetingTimeout, getIsDiscoveryMaster, getTtl, setGreetingTimeout, setMaster, setTtl, start, stop
 
Methods inherited from interface org.ow2.jonas.service.Service
getName, init, isStarted, setName, start, stop
 

Constructor Detail

MulticastDiscoveryServiceImpl

public MulticastDiscoveryServiceImpl()
Method Detail

getDiscoveryAddress

public String getDiscoveryAddress()
Returns:
the multicast group IP address used by the discovery service

getDiscoveryPort

public String getDiscoveryPort()
Returns:
the multicast group port number used by the discovery service

setMulticastAddress

public void setMulticastAddress(String address)
Parameters:
address - the multicast group IP address used by the discovery service.Used on injection

setMulticastPort

public void setMulticastPort(int port)
Parameters:
port - multi-cast group port number. Used on injection

startDiscoveryMaster

public void startDiscoveryMaster()
                          throws JMException
Management operation allowing to make the current server become a master if its not already.

Specified by:
startDiscoveryMaster in interface DiscoveryServiceImplMBean
Throws:
JMException - a JMX exception occurred when trying to make current server a discovery master

doStart

protected void doStart()
                throws ServiceException
Start the discovery service.

Specified by:
doStart in class AbsServiceImpl
Throws:
ServiceException - An error occurred when starting the service

doStop

protected void doStop()
               throws ServiceException
Stop the discovery service.

Specified by:
doStop in class AbsServiceImpl
Throws:
ServiceException - service stopping failed

getDiscEvent

public DiscEvent getDiscEvent(String serverName,
                              String domainName,
                              String[] connectorURLs,
                              String state)
Create a 'fake' DiscEvent object containing info to establish a JMX connection with a new server in the domain.

Parameters:
serverName - the OBJECT_NAME of the server MBean corresponding to the server to connect
domainName - the JOnAS server's domain name
connectorURLs - the urls of the connector server of the server to connect
state - the state of the server (RUNNING in case the DiscEvent is used to add a server; could be STOPPING if the DiscEvent is used to remove a server)
Returns:
a new DiscEvent object

getDiscoveryProtocolVersion

public String getDiscoveryProtocolVersion()
Specified by:
getDiscoveryProtocolVersion in interface DiscoveryServiceImplMBean
Returns:
the discovery protocol version number

getDiscoveryTtl

public String getDiscoveryTtl()
Specified by:
getDiscoveryTtl in interface DiscoveryServiceImplMBean
Returns:
Returns the discovery Time to live
See Also:
DiscoveryServiceImplMBean.getDiscoveryTtl()

getDiscoveryClient

public ObjectName getDiscoveryClient()
Description copied from interface: MulticastDiscoveryServiceImplMBean
Gets the MBean of disovery client.

Specified by:
getDiscoveryClient in interface MulticastDiscoveryServiceImplMBean
Returns:

getDiscoveryManager

public ObjectName getDiscoveryManager()
                               throws MalformedObjectNameException
Description copied from interface: MulticastDiscoveryServiceImplMBean
Gets the MBean of disovery manager.

Specified by:
getDiscoveryManager in interface MulticastDiscoveryServiceImplMBean
Returns:
Throws:
MalformedObjectNameException

getEnroller

public ObjectName getEnroller()
                       throws MalformedObjectNameException
Description copied from interface: MulticastDiscoveryServiceImplMBean
Gets the MBean of the enroller.

Specified by:
getEnroller in interface MulticastDiscoveryServiceImplMBean
Returns:
Throws:
MalformedObjectNameException

getListeningIp

public String getListeningIp()
Specified by:
getListeningIp in interface DiscoveryServiceImplMBean
Specified by:
getListeningIp in class BaseDiscovery
Returns:
the listeningIp

getListeningPort

public int getListeningPort()
Specified by:
getListeningPort in interface DiscoveryServiceImplMBean
Specified by:
getListeningPort in class BaseDiscovery
Returns:
the listeningPort

getSourcePort

public int getSourcePort()
Description copied from interface: MulticastDiscoveryServiceImplMBean
Gets the discovery source port.

Specified by:
getSourcePort in interface MulticastDiscoveryServiceImplMBean
Returns:
the sourcePort

setListeningIp

public void setListeningIp(String listeningIp)
Specified by:
setListeningIp in interface DiscoveryServiceImplMBean
Specified by:
setListeningIp in class BaseDiscovery
Parameters:
listeningIp - the listeningIp to set

setListeningPort

public void setListeningPort(int listeningPort)
Specified by:
setListeningPort in interface DiscoveryServiceImplMBean
Specified by:
setListeningPort in class BaseDiscovery
Parameters:
listeningPort - the listeningPort to set

setSourcePort

public void setSourcePort(int sourcePort)
Description copied from interface: MulticastDiscoveryServiceImplMBean
sets discovery source port.

Specified by:
setSourcePort in interface MulticastDiscoveryServiceImplMBean
Parameters:
sourcePort - the sourcePort to set

setUrlsList

public void setUrlsList(ArrayList urlsList)
Specified by:
setUrlsList in interface DiscoveryServiceImplMBean
Specified by:
setUrlsList in class BaseDiscovery
Parameters:
urlsList - the urlsList to set

getGreetingPort

public int getGreetingPort()
Description copied from interface: MulticastDiscoveryServiceImplMBean
Gets the greeting listening port.

Specified by:
getGreetingPort in interface MulticastDiscoveryServiceImplMBean
Returns:
the greetingListeningPort

setGreetingPort

public void setGreetingPort(int port)
Description copied from interface: MulticastDiscoveryServiceImplMBean
sets the greeting listening port.

Specified by:
setGreetingPort in interface MulticastDiscoveryServiceImplMBean
Parameters:
port - greeting port.

getUrlsList

public ArrayList getUrlsList()
Specified by:
getUrlsList in interface DiscoveryServiceImplMBean
Specified by:
getUrlsList in class BaseDiscovery
Returns:
the urlsList

getJonasName

public String getJonasName()
Specified by:
getJonasName in interface DiscoveryServiceImplMBean
Returns:
the jonasName

getMbeanServer

public MBeanServer getMbeanServer()

getMyOn

public ObjectName getMyOn()
Specified by:
getMyOn in interface DiscoveryServiceImplMBean
Returns:
the myOn

getServerId

public String getServerId()
Specified by:
getServerId in interface DiscoveryServiceImplMBean
Returns:
the serverId

getUrls

public String[] getUrls()
Specified by:
getUrls in interface DiscoveryServiceImplMBean
Returns:
the urls

setDomainName

public void setDomainName(String domainName)
Specified by:
setDomainName in interface DiscoveryServiceImplMBean
Parameters:
domainName - the domainName to set

setJonasName

public void setJonasName(String jonasName)
Specified by:
setJonasName in interface DiscoveryServiceImplMBean
Parameters:
jonasName - the jonasName to set

setMbeanServer

public void setMbeanServer(MBeanServer mbeanServer)

setMyOn

public void setMyOn(ObjectName myOn)
Specified by:
setMyOn in interface DiscoveryServiceImplMBean
Parameters:
myOn - the myOn to set

setServerId

public void setServerId(String serverId)
Specified by:
setServerId in interface DiscoveryServiceImplMBean
Parameters:
serverId - the serverId to set

setUrls

public void setUrls(String[] urls)
Specified by:
setUrls in interface DiscoveryServiceImplMBean
Parameters:
urls - the urls to set

getMulticastAddress

public String getMulticastAddress()
Specified by:
getMulticastAddress in interface DiscoveryServiceImplMBean
Returns:
the multicast group IP address used by the discovery service

getMulticastPort

public String getMulticastPort()
Specified by:
getMulticastPort in interface DiscoveryServiceImplMBean
Returns:
the multicast group port number used by the discovery service


Copyright © 2010 OW2 Consortium. All Rights Reserved.