|
GridGain 2.1.0
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gridgain.grid.spi.GridSpiAdapter
org.gridgain.grid.spi.discovery.mule.GridMuleDiscoverySpi
@GridSpiInfo(author="GridGain Systems",
url="www.gridgain.org",
email="support@gridgain.com",
version="x.x")
@GridSpiMultipleInstancesSupport(value=false)
public class GridMuleDiscoverySpi
Mule implementation of GridDiscoverySpi SPI. It uses
Mule ESB implementation to discover nodes in the grid.
Mule instance may be started before SPI or instantiated during SPI start.
SPI uses UMO component which must be declared in Mule configuration file
(see GridMuleDiscoverySpi.COMPONENT_NAME). SPI receives all notifications from that
component. The component has two input endpoints for getting messages. Names
of those endpoints should be declared in component's descriptor properties
(see GridMuleDiscoverySpi.HANDSHAKE_ENDPOINT_NAME and GridMuleDiscoverySpi.HEARTBEAT_ENDPOINT_NAME).
Here is an example of Mule configuration file that could be used with this SPI:
<mule-configuration version="1.0">
<mule-environment-properties synchronous="true" embedded="true"/>
<!-- Tcp connector configuration. -->
<connector name="tcpConnector" className="org.mule.providers.tcp.TcpConnector">
<properties>
<property name="tcpProtocolClassName" value="org.mule.providers.tcp.protocols.LengthProtocol"/>
</properties>
</connector>
<!-- Multicast connector configuration. -->
<connector name="multicastConnector" className="org.mule.providers.multicast.MulticastConnector">
<properties>
<property name="loopback" value="true"/>
</properties>
</connector>
<model name="gridgain">
<mule-descriptor name="GridDiscoveryUMO"
implementation="org.gridgain.grid.spi.discovery.mule.GridMuleDiscoveryComponent"
singleton="true">
<inbound-router>
<!-- Listen for handshake data. -->
<endpoint name="handshake.id" address="tcp://localhost:11001"/>
<!-- Listen for heartbeat data. -->
<endpoint name="heartbeat.id" address="multicast://228.1.2.172:30001"/>
</inbound-router>
<properties>
<property name="handshake" value="handshake.id"/>
<property name="heartbeat" value="heartbeat.id"/>
</properties>
</mule-descriptor>
</model>
</mule-configuration>
This SPI has no mandatory parameters.
This SPI has the following optional parameters:
GridMuleDiscoverySpi.setConfigurationFile(String), GridMuleDiscoverySpi.setConfigurationUrl(URL)).
GridMuleDiscoverySpi.setComponentName(String)}).
GridMuleDiscoverySpi.setHeartbeatFrequency(long)
GridMuleDiscoverySpi.setLeaveAttempts(int)).
GridMuleDiscoverySpi.setMaxMissedHeartbeats(int))
GridMuleDiscoverySpi spi = new GridMuleDiscoverySpi();
// Override default Mule configuration file.
spi.setConfigurationFile("/my/config/path/mule.xml");
GridConfigurationAdapter cfg = new GridConfigurationAdapter();
// Override default discovery SPI.
cfg.setDiscoverySpi(spi);
// Start grid.
GridFactory.start(cfg);
<bean id="grid.custom.cfg" class="org.gridgain.grid.GridConfigurationAdapter" singleton="true">
...
<property name="discoverySpi">
<bean class="org.gridgain.grid.spi.discovery.mule.GridMuleDiscoverySpi">
<property name="configurationFile" value="/my/config/path/mule.xml"/>
</bean>
</property>
...
</bean>
Note: Mule is not shipped with GridGain. If you don't have Mule, you need to download it separately. See http://www.mulesource.com for more information. Once installed, Mule should be available on the classpath for GridGain. If you use [GRIDGAIN_HOME]/bin/gridgain.{sh|bat} script to start a grid node you can simply add Mule JARs to [GRIDGAIN_HOME]/bin/setenv.{sh|bat} scripts that's used to set up class path for the main scripts.
Note: When using Mule SPIs (communication or discovery) you cannot start
multiple GridGain instances in the same VM due to limitations of Mule. GridGain runtime
will detect this situation and prevent GridGain from starting in such case.
See GridSpiMultipleInstancesSupport for details.
For information about Spring framework visit www.springframework.org
See Also:
Documentation
Email Support
Online Forums
Issue Tracking
Author: 2005-2008 Copyright © GridGain Systems. All Rights Reserved. ver. 2.1.0
GridDiscoverySpi
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| Field Summary | |
|---|---|
static String |
COMPONENT_NAME
Name of component declared in Mule configuration (value is GridDiscoveryUMO). |
static String |
DFLT_CONFIG_FILE
Default Mule 1.x configuration path relative to GridGain installation home folder. |
static long |
DFLT_HEARTBEAT_FREQ
Default heartbeat delay (value is 3000). |
static int |
DFLT_LEAVE_ATTEMPTS
Default number of attempts to send leaving notification (value is 3). |
static int |
DFLT_MAX_MISSED_HEARTBEATS
Default number of heartbeat messages that could be missed (value is 3). |
static long |
DFLT_PING_WAIT
Default ping wait timeout. |
static String |
HANDSHAKE_ENDPOINT_NAME
Name of property where input endpoint name declared in Mule configuration for attributes handshake. |
static String |
HEARTBEAT_ENDPOINT_NAME
Name of property where input endpoint name declared in Mule configuration for heartbeats. |
| Constructor Summary | |
|---|---|
GridMuleDiscoverySpi()
|
|
| Method Summary | |
|---|---|
String |
getComponentName()
Gets name of the component registered in Mule. |
String |
getConfigurationFile()
Gets either absolute or relative to GridGain installation home folder path to Mule XML configuration file. |
protected List<String> |
getConsistentAttributeNames()
Returns back list of attributes that should be consistent for this SPI. |
String |
getHandshakeEndpointUri()
Gets component inbound endpoint URI for handshake. |
String |
getHeartbeatEndpointUri()
Gets component inbound endpoint URI for heartbeats. |
long |
getHeartbeatFrequency()
Gets delay between heartbeat requests. |
int |
getLeaveAttempts()
Gets number of attempts to notify another nodes that this one is leaving grid. |
GridNode |
getLocalNode()
Gets local node. |
int |
getMaximumMissedHeartbeats()
Gets number of heartbeat requests that could be missed before remote node is considered to be failed. |
GridNode |
getNode(UUID nodeId)
Gets node by ID. |
Map<String,Serializable> |
getNodeAttributes()
This method is called before SPI starts (before method GridSpi.spiStart(String)
is called). It allows SPI implementation to add attributes to a local
node. Kernel collects these attributes from all SPI implementations
loaded up and then passes it to discovery SPI so that they can be
exchanged with other nodes. |
int |
getRemoteNodeCount()
Gets the number of remote nodes. |
Collection<UUID> |
getRemoteNodeIds()
Gets collection of remote nodes' IDs. |
List<GridNode> |
getRemoteNodes()
Gets collection of remote nodes in grid or empty collection if no remote nodes found. |
boolean |
pingNode(UUID nodeId)
Pings the remote node to see if it's alive. |
void |
setComponentName(String umoName)
Sets name for component registered in Mule. |
void |
setConfigurationFile(String cfgFile)
Sets either absolute or relative to GridGain installation home folder path to Mule XML configuration file. |
void |
setConfigurationUrl(URL cfgUrl)
Sets URL to Mule XML configuration file. |
void |
setHeartbeatFrequency(long beatFreq)
Sets delay between heartbeat requests. |
void |
setLeaveAttempts(int leaveAttempts)
Sets number of attempts to notify another nodes that this one is leaving grid. |
void |
setListener(GridDiscoveryListener listener)
Sets a listener for discovery events. |
void |
setMaxMissedHeartbeats(int maxMissedBeats)
Sets number of heartbeat requests that could be missed before remote node is considered to be failed. |
void |
setMetricsProvider(GridDiscoveryMetricsProvider metricsProvider)
Sets discovery metrics provider. |
void |
setNodeAttributes(Map<String,Serializable> attrs)
Sets node attributes which will be distributed in grid during join process. |
void |
spiStart(String gridName)
This method is called to start SPI. |
void |
spiStop()
This method is called to stop SPI. |
String |
toString()
|
| Methods inherited from class org.gridgain.grid.spi.GridSpiAdapter |
|---|
assertParameter, configInfo, createSpiAttributeName, getAuthor, getGridGainHome, getLocalNodeId, getName, getSpiContext, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion, onContextDestroyed, onContextInitialized, registerMBean, setName, setSpiContext, startInfo, startStopwatch, stopInfo, unregisterMBean |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.gridgain.grid.spi.GridSpi |
|---|
getName, onContextDestroyed, onContextInitialized |
| Methods inherited from interface org.gridgain.grid.spi.GridSpiManagementMBean |
|---|
getAuthor, getGridGainHome, getLocalNodeId, getName, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion |
| Field Detail |
|---|
public static final String DFLT_CONFIG_FILE
public static final String COMPONENT_NAME
public static final String HANDSHAKE_ENDPOINT_NAME
public static final String HEARTBEAT_ENDPOINT_NAME
public static final long DFLT_HEARTBEAT_FREQ
public static final int DFLT_MAX_MISSED_HEARTBEATS
public static final int DFLT_LEAVE_ATTEMPTS
public static final long DFLT_PING_WAIT
| Constructor Detail |
|---|
public GridMuleDiscoverySpi()
| Method Detail |
|---|
public String getConfigurationFile()
getConfigurationFile in interface GridMuleDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setConfigurationFile(String cfgFile)
If not provided, default value is GridMuleDiscoverySpi.DFLT_CONFIG_FILE.
cfgFile - Path to Mule configuration file.@GridSpiConfiguration(optional=true) public void setConfigurationUrl(URL cfgUrl)
If not provided, default value is GridMuleDiscoverySpi.DFLT_CONFIG_FILE.
cfgUrl - URL to Mule configuration file.public String getHeartbeatEndpointUri()
getHeartbeatEndpointUri in interface GridMuleDiscoverySpiMBeanpublic String getHandshakeEndpointUri()
getHandshakeEndpointUri in interface GridMuleDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setHeartbeatFrequency(long beatFreq)
If not provided, default value is GridMuleDiscoverySpi.DFLT_HEARTBEAT_FREQ.
beatFreq - Time in milliseconds.public long getHeartbeatFrequency()
getHeartbeatFrequency in interface GridMuleDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setMaxMissedHeartbeats(int maxMissedBeats)
If not provided, default value is GridMuleDiscoverySpi.DFLT_MAX_MISSED_HEARTBEATS.
maxMissedBeats - Number of missed requests.public int getMaximumMissedHeartbeats()
getMaximumMissedHeartbeats in interface GridMuleDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setLeaveAttempts(int leaveAttempts)
If not provided, default value is GridMuleDiscoverySpi.DFLT_LEAVE_ATTEMPTS.
leaveAttempts - Number of attempts.public int getLeaveAttempts()
getLeaveAttempts in interface GridMuleDiscoverySpiMBeanpublic String getComponentName()
getComponentName in interface GridMuleDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setComponentName(String umoName)
umoName - Name for component registered in Mule.public void setNodeAttributes(Map<String,Serializable> attrs)
setNodeAttributes in interface GridDiscoverySpiattrs - Map of node attributes.public Collection<UUID> getRemoteNodeIds()
getRemoteNodeIds in interface GridMuleDiscoverySpiMBeanpublic int getRemoteNodeCount()
getRemoteNodeCount in interface GridMuleDiscoverySpiMBeanpublic List<GridNode> getRemoteNodes()
getRemoteNodes in interface GridDiscoverySpipublic GridNode getNode(UUID nodeId)
getNode in interface GridDiscoverySpinodeId - Node ID.
public GridNode getLocalNode()
getLocalNode in interface GridDiscoverySpi
public Map<String,Serializable> getNodeAttributes()
throws GridSpiException
GridSpi.spiStart(String)
is called). It allows SPI implementation to add attributes to a local
node. Kernel collects these attributes from all SPI implementations
loaded up and then passes it to discovery SPI so that they can be
exchanged with other nodes.
getNodeAttributes in interface GridSpigetNodeAttributes in class GridSpiAdapterGridSpiException - Throws in case of any error.
public void spiStart(String gridName)
throws GridSpiException
spiStart in interface GridSpiGridSpiException - Throws in case of any error during SPI start.gridName - Name of grid instance this SPI is being started for
(null for default grid).
public void spiStop()
throws GridSpiException
spiStop in interface GridSpiGridSpiException - Thrown in case of any error during SPI stop.public boolean pingNode(UUID nodeId)
pingNode in interface GridDiscoverySpinodeId - Node Id.
public void setListener(GridDiscoveryListener listener)
GridDiscoveryEventType for a set of all possible
discovery events.
setListener in interface GridDiscoverySpilistener - Listener to discovery events.public void setMetricsProvider(GridDiscoveryMetricsProvider metricsProvider)
GridDiscoveryMetricsProvider.getMetrics() method to exchange
dynamic metrics between nodes.
setMetricsProvider in interface GridDiscoverySpimetricsProvider - Provider of metrics data.protected List<String> getConsistentAttributeNames()
getConsistentAttributeNames in class GridSpiAdapterpublic String toString()
toString in class Object
|
GridGain 2.1.0
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
|
GridGain - Grid Computing Made Simple, ver. 2.1.0.19122008
2005-2008 Copyright © GridGain Systems. All Rights Reserved. |
|
|