GridGain™ 2.0.3
Java API Specification

org.gridgain.grid
Class GridConfigurationAdapter

java.lang.Object
  extended by org.gridgain.grid.GridConfigurationAdapter
All Implemented Interfaces:
GridConfiguration

@Apache20LicenseCompatible
public class GridConfigurationAdapter
extends Object
implements GridConfiguration

Adapter for GridConfiguration interface. Use it to add custom configuration for grid. Note that you should only set values that differ from defaults, as grid will automatically pick default values for all values that are not set.



See Also:

  Documentation
  Email Support
  Online Forums
  Issue Tracking

Author:   2005-2008 Copyright © GridGain Systems. All Rights Reserved. ver. 2.0.3

 

Constructor Summary
GridConfigurationAdapter()
          Creates valid grid configuration with all default values.
GridConfigurationAdapter(GridConfiguration cfg)
          Creates grid configuration by coping all configuration properties from given configuration.
 
Method Summary
 GridCheckpointSpi getCheckpointSpi()
          Should return fully configured checkpoint SPI implementation.
 GridCollisionSpi getCollisionSpi()
          Should return fully configured collision SPI implementation.
 GridCommunicationSpi getCommunicationSpi()
          Should return fully configured SPI communication implementation.
 GridDeploymentSpi getDeploymentSpi()
          Should return fully configured deployment SPI implementation.
 GridDiscoverySpi getDiscoverySpi()
          Should return fully configured discovery SPI implementation.
 long getDiscoveryStartupDelay()
          This value is used to expire messages from waiting list whenever node discovery discrepancies happen.
 GridEventStorageSpi getEventStorageSpi()
          Should return fully configured event SPI implementation.
 ExecutorService getExecutorService()
          Should return an instance of fully configured thread pool to be used in grid.
 GridFailoverSpi getFailoverSpi()
          Should return fully configured failover SPI implementation.
 String getGridGainHome()
          Should return GridGain installation home folder.
 GridLogger getGridLogger()
          Should return an instance of logger to use in grid.
 String getGridName()
          Gets optional grid name.
 GridLoadBalancingSpi getLoadBalancingSpi()
          Should return fully configured load balancing SPI implementation.
 MBeanServer getMBeanServer()
          Should return MBean server instance.
 long getMetricsExpireTime()
          Elapsed time in milliseconds after which metrics are considered expired.
 int getMetricsHistorySize()
          Number of metrics to keep in memory to calculate totals and averages.
 GridLocalMetricsSpi getMetricsSpi()
          Should return fully configured metrics SPI implementation.
 UUID getNodeId()
          Unique identifier for this node within grid.
 List<String> getP2PLocalClassPathExclude()
          Should return list of packages from the system classpath that need to be peer-to-peer loaded from task originating node. '*' is supported at the end of the package name which means that all sub-packages and their classes are included like in Java package import clause.
 GridTopologySpi getTopologySpi()
          Should return fully configured topology SPI implementation.
 GridTracingSpi getTracingSpi()
          Should return fully configured tracing SPI implementation.
 Map<String,? extends Serializable> getUserAttributes()
          Should return any user-defined attributes to be added to this node.
 boolean isPeerClassLoadingEnabled()
          Returns true if peer class loading is enabled, false otherwise.
 void setCheckpointSpi(GridCheckpointSpi cpSpi)
          Sets fully configured instance of GridCheckpointSpi.
 void setCollisionSpi(GridCollisionSpi colSpi)
          Sets fully configured instance of GridCollisionSpi.
 void setCommunicationSpi(GridCommunicationSpi commSpi)
          Sets fully configured instance of GridCommunicationSpi.
 void setDeploymentSpi(GridDeploymentSpi deploySpi)
          Sets fully configured instance of GridDeploymentSpi.
 void setDiscoverySpi(GridDiscoverySpi discoSpi)
          Sets fully configured instance of GridDiscoverySpi.
 void setDiscoveryStartupDelay(long discoStartupDelay)
          For full explanation of this property refer to GridConfigurationAdapter.getDiscoveryStartupDelay() method.
 void setEventStorageSpi(GridEventStorageSpi evtSpi)
          Sets fully configured instance of GridEventStorageSpi.
 void setExecutorService(ExecutorService execSvc)
          Sets thread pool to use within grid.
 void setFailoverSpi(GridFailoverSpi failSpi)
          Sets fully configured instance of GridFailoverSpi.
 void setGridGainHome(String ggHome)
          Sets GridGain installation folder.
 void setGridLogger(GridLogger log)
          Sets logger to use within grid.
 void setGridName(String gridName)
          Sets grid name.
 void setLoadBalancingSpi(GridLoadBalancingSpi loadBalancingSpi)
          Sets fully configured instance of GridLoadBalancingSpi.
 void setMBeanServer(MBeanServer mbeanServer)
          Sets initialized and started MBean server.
 void setMetricsExpireTime(long metricsExpireTime)
          Sets time in milliseconds after which a certain metric value is considered expired.
 void setMetricsHistorySize(int metricsHistorySize)
          Sets number of metrics kept in history to compute totals and averages.
 void setMetricsSpi(GridLocalMetricsSpi metricsSpi)
          Sets fully configured instance of GridLocalMetricsSpi.
 void setNodeId(UUID nodeId)
          Sets unique identifier for local node.
 void setP2PLocalClassPathExclude(List<String> localClassPathExclude)
          Sets list of packages in a system class path that should be to P2P loaded even if they exist locally.
 void setPeerClassLoadingEnabled(boolean isPeerClsLoadingEnabled)
          Enables/disables peer class loading.
 void setTopologySpi(GridTopologySpi topSpi)
          Sets fully configured instance of GridTopologySpi.
 void setTracingSpi(GridTracingSpi traceSpi)
          Sets fully configured instance of GridTracingSpi.
 void setUserAttributes(Map<String,? extends Serializable> userAttrs)
          Sets user attributes for this node.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GridConfigurationAdapter

public GridConfigurationAdapter()
Creates valid grid configuration with all default values.


GridConfigurationAdapter

public GridConfigurationAdapter(GridConfiguration cfg)
Creates grid configuration by coping all configuration properties from given configuration.

Parameters:
cfg - Grid configuration to copy from.
Method Detail

getGridName

public String getGridName()
Gets optional grid name. Returns null if non-default grid name was not provided.

Specified by:
getGridName in interface GridConfiguration
Returns:
Optional grid name. Can be null, which is default grid name, if non-default grid name was not provided.

setGridName

public void setGridName(String gridName)
Sets grid name. Note that null is a default grid name.

Parameters:
gridName - Grid name to set. Can be null, which is default grid name.

getUserAttributes

public Map<String,? extends Serializable> getUserAttributes()
Should return any user-defined attributes to be added to this node. These attributes can then be accessed on nodes by calling GridNode.getAttribute(String) or GridNode.getAttributes() methods.

Note that grid will add all System properties and environment properties to grid node attributes also. SPI's may also add node attributes that are used for SPI implementation.

NOTE: attributes names starting with org.gridgain are reserved for internal use.

Specified by:
getUserAttributes in interface GridConfiguration
Returns:
User defined attributes for this node.

setUserAttributes

public void setUserAttributes(Map<String,? extends Serializable> userAttrs)
Sets user attributes for this node.

Parameters:
userAttrs - User attributes for this node.
See Also:
GridConfiguration.getUserAttributes()

getGridLogger

public GridLogger getGridLogger()
Should return an instance of logger to use in grid. If not provided, default value will be used. See GridFactory for information on default configuration.

Specified by:
getGridLogger in interface GridConfiguration
Returns:
Logger to use in grid.

setGridLogger

public void setGridLogger(GridLogger log)
Sets logger to use within grid.

Parameters:
log - Logger to use within grid.
See Also:
GridConfiguration.getGridLogger()

getExecutorService

public ExecutorService getExecutorService()
Should return an instance of fully configured thread pool to be used in grid. If not provided, default value will be used. See GridFactory for information on default configuration.

Specified by:
getExecutorService in interface GridConfiguration
Returns:
Thread pool implementation to be used in grid.

setExecutorService

public void setExecutorService(ExecutorService execSvc)
Sets thread pool to use within grid.

Parameters:
execSvc - Thread pool to use within grid.
See Also:
GridConfiguration.getExecutorService()

getGridGainHome

public String getGridGainHome()
Should return GridGain installation home folder. If not provided, the system will check GRIDGAIN_HOME system property and environment variable in that order. If GRIDGAIN_HOME still could not be obtained, then grid will not start and exception will be thrown.

Specified by:
getGridGainHome in interface GridConfiguration
Returns:
GridGain installation home or null to make the system attempt to infer it automatically.

setGridGainHome

public void setGridGainHome(String ggHome)
Sets GridGain installation folder.

Parameters:
ggHome - GridGain installation folder.
See Also:
GridConfiguration.getGridGainHome()

getMBeanServer

public MBeanServer getMBeanServer()
Should return MBean server instance. If not provided, the system will use default platform MBean server.

Specified by:
getMBeanServer in interface GridConfiguration
Returns:
MBean server instance or null to make the system create a default one.
See Also:
ManagementFactory.getPlatformMBeanServer()

setMBeanServer

public void setMBeanServer(MBeanServer mbeanServer)
Sets initialized and started MBean server.

Parameters:
mbeanServer - Initialized and started MBean server.

getNodeId

public UUID getNodeId()
Unique identifier for this node within grid. If not provided, default value will be used. See GridFactory for information on default configuration.

Specified by:
getNodeId in interface GridConfiguration
Returns:
Unique identifier for this node within grid.

setNodeId

public void setNodeId(UUID nodeId)
Sets unique identifier for local node.

Parameters:
nodeId - Unique identifier for local node.
See Also:
GridConfiguration.getNodeId()

isPeerClassLoadingEnabled

public boolean isPeerClassLoadingEnabled()
Returns true if peer class loading is enabled, false otherwise. Default value is true.

When peer class loading is enabled and task is not deployed on local node, local node will try to load classes from the node that initiated task execution. This way, a task can be physically deployed only on one node and then internally penetrate to all other nodes.

See GridTask documentation for more information about task deployment.

Specified by:
isPeerClassLoadingEnabled in interface GridConfiguration
Returns:
true if peer class loading is enabled, false otherwise.

setPeerClassLoadingEnabled

public void setPeerClassLoadingEnabled(boolean isPeerClsLoadingEnabled)
Enables/disables peer class loading.

Parameters:
isPeerClsLoadingEnabled - true if peer class loading is enabled, false otherwise.

getEventStorageSpi

public GridEventStorageSpi getEventStorageSpi()
Should return fully configured event SPI implementation. If not provided, default implementation will be used. See GridFactory for information on default configuration.

Specified by:
getEventStorageSpi in interface GridConfiguration
Returns:
Grid event SPI implementation or null to use default implementation.

setEventStorageSpi

public void setEventStorageSpi(GridEventStorageSpi evtSpi)
Sets fully configured instance of GridEventStorageSpi.

Parameters:
evtSpi - Fully configured instance of GridEventStorageSpi.
See Also:
GridConfiguration.getEventStorageSpi()

getDiscoverySpi

public GridDiscoverySpi getDiscoverySpi()
Should return fully configured discovery SPI implementation. If not provided, default implementation will be used. See GridFactory for information on default configuration.

Specified by:
getDiscoverySpi in interface GridConfiguration
Returns:
Grid discovery SPI implementation or null to use default implementation.

setDiscoverySpi

public void setDiscoverySpi(GridDiscoverySpi discoSpi)
Sets fully configured instance of GridDiscoverySpi.

Parameters:
discoSpi - Fully configured instance of GridDiscoverySpi.
See Also:
GridConfiguration.getDiscoverySpi()

getCommunicationSpi

public GridCommunicationSpi getCommunicationSpi()
Should return fully configured SPI communication implementation. If not provided, default implementation will be used. See GridFactory for information on default configuration.

Specified by:
getCommunicationSpi in interface GridConfiguration
Returns:
Grid communication SPI implementation or null to use default implementation.

setCommunicationSpi

public void setCommunicationSpi(GridCommunicationSpi commSpi)
Sets fully configured instance of GridCommunicationSpi.

Parameters:
commSpi - Fully configured instance of GridCommunicationSpi.
See Also:
GridConfiguration.getCommunicationSpi()

getDeploymentSpi

public GridDeploymentSpi getDeploymentSpi()
Should return fully configured deployment SPI implementation. If not provided, default implementation will be used. See GridFactory for information on default configuration.

Specified by:
getDeploymentSpi in interface GridConfiguration
Returns:
Grid deployment SPI implementation or null to use default implementation.

setDeploymentSpi

public void setDeploymentSpi(GridDeploymentSpi deploySpi)
Sets fully configured instance of GridDeploymentSpi.

Parameters:
deploySpi - Fully configured instance of GridDeploymentSpi.
See Also:
GridConfiguration.getDeploymentSpi()

getCheckpointSpi

public GridCheckpointSpi getCheckpointSpi()
Should return fully configured checkpoint SPI implementation. If not provided, default implementation will be used. See GridFactory for information on default configuration.

Specified by:
getCheckpointSpi in interface GridConfiguration
Returns:
Grid checkpoint SPI implementation or null to use default implementation.

setCheckpointSpi

public void setCheckpointSpi(GridCheckpointSpi cpSpi)
Sets fully configured instance of GridCheckpointSpi.

Parameters:
cpSpi - Fully configured instance of GridCheckpointSpi.
See Also:
GridConfiguration.getCheckpointSpi()

getTracingSpi

public GridTracingSpi getTracingSpi()
Should return fully configured tracing SPI implementation. If not provided, returns null. Note that tracing SPI is optional. If not provided - no tracing will be configured (i.e. there is no default tracing SPI implementation).

Specified by:
getTracingSpi in interface GridConfiguration
Returns:
Grid tracing SPI implementation or null to not use tracing.

setTracingSpi

public void setTracingSpi(GridTracingSpi traceSpi)
Sets fully configured instance of GridTracingSpi.

Parameters:
traceSpi - Fully configured instance of GridTracingSpi or null if no SPI provided.
See Also:
GridConfiguration.getTracingSpi()

getCollisionSpi

public GridCollisionSpi getCollisionSpi()
Should return fully configured collision SPI implementation. If not provided, default implementation will be used. See GridFactory for information on default configuration.

Specified by:
getCollisionSpi in interface GridConfiguration
Returns:
Grid collision SPI implementation or null to use default implementation.

setCollisionSpi

public void setCollisionSpi(GridCollisionSpi colSpi)
Sets fully configured instance of GridCollisionSpi.

Parameters:
colSpi - Fully configured instance of GridCollisionSpi or null if no SPI provided.
See Also:
GridConfiguration.getCollisionSpi()

getFailoverSpi

public GridFailoverSpi getFailoverSpi()
Should return fully configured failover SPI implementation. If not provided, default implementation will be used. See GridFactory for information on default configuration.

Specified by:
getFailoverSpi in interface GridConfiguration
Returns:
Grid failover SPI implementation or null to use default implementation.

setFailoverSpi

public void setFailoverSpi(GridFailoverSpi failSpi)
Sets fully configured instance of GridFailoverSpi.

Parameters:
failSpi - Fully configured instance of GridFailoverSpi or null if no SPI provided.
See Also:
GridConfiguration.getFailoverSpi()

getTopologySpi

public GridTopologySpi getTopologySpi()
Should return fully configured topology SPI implementation. If not provided, default implementation will be used. See GridFactory for information on default configuration.

Specified by:
getTopologySpi in interface GridConfiguration
Returns:
Grid topology SPI implementation or null to use default implementation.

setTopologySpi

public void setTopologySpi(GridTopologySpi topSpi)
Sets fully configured instance of GridTopologySpi.

Parameters:
topSpi - Fully configured instance of GridTopologySpi or null if no SPI provided.
See Also:
GridConfiguration.getTopologySpi()

getMetricsSpi

public GridLocalMetricsSpi getMetricsSpi()
Should return fully configured metrics SPI implementation. If not provided, default implementation will be used. See GridFactory for information on default configuration.

Specified by:
getMetricsSpi in interface GridConfiguration
Returns:
Grid metrics SPI implementation or null to use default implementation.

setMetricsSpi

public void setMetricsSpi(GridLocalMetricsSpi metricsSpi)
Sets fully configured instance of GridLocalMetricsSpi.

Parameters:
metricsSpi - Fully configured instance of GridLocalMetricsSpi or null if no SPI provided.
See Also:
GridConfiguration.getMetricsSpi()

getLoadBalancingSpi

public GridLoadBalancingSpi getLoadBalancingSpi()
Should return fully configured load balancing SPI implementation. If not provided, default implementation will be used. See GridFactory for information on default configuration.

Specified by:
getLoadBalancingSpi in interface GridConfiguration
Returns:
Grid load balancing SPI implementation or null to use default implementation.

setLoadBalancingSpi

public void setLoadBalancingSpi(GridLoadBalancingSpi loadBalancingSpi)
Sets fully configured instance of GridLoadBalancingSpi.

Parameters:
loadBalancingSpi - Fully configured instance of GridLoadBalancingSpi or null if no SPI provided.
See Also:
GridConfiguration.getLoadBalancingSpi()

getP2PLocalClassPathExclude

public List<String> getP2PLocalClassPathExclude()
Should return list of packages from the system classpath that need to be peer-to-peer loaded from task originating node. '*' is supported at the end of the package name which means that all sub-packages and their classes are included like in Java package import clause.

Specified by:
getP2PLocalClassPathExclude in interface GridConfiguration
Returns:
List of peer-to-peer loaded package names.

setP2PLocalClassPathExclude

public void setP2PLocalClassPathExclude(List<String> localClassPathExclude)
Sets list of packages in a system class path that should be to P2P loaded even if they exist locally.

Parameters:
localClassPathExclude - List of P2P loaded packages. Package name supports '*' at the end like in package import clause.

getMetricsHistorySize

public int getMetricsHistorySize()
Number of metrics to keep in memory to calculate totals and averages. If not provided (value is 0), then default of 10,000 is used.

Specified by:
getMetricsHistorySize in interface GridConfiguration
Returns:
Metrics history size.

setMetricsHistorySize

public void setMetricsHistorySize(int metricsHistorySize)
Sets number of metrics kept in history to compute totals and averages. If not explicitly set, then default value is 10,000.

Parameters:
metricsHistorySize - Number of metrics kept in history to use for metric totals and averages calculations.

getMetricsExpireTime

public long getMetricsExpireTime()
Elapsed time in milliseconds after which metrics are considered expired. If not provided (value is 0), then the default value is Long.MAX_VALUE.

Specified by:
getMetricsExpireTime in interface GridConfiguration
Returns:
Metrics expire time.

getDiscoveryStartupDelay

public long getDiscoveryStartupDelay()
This value is used to expire messages from waiting list whenever node discovery discrepancies happen.

During startup, it is possible for some SPI's, such as GridMuleDiscoverySpi or GridJmsDiscoverySpi, to have a small time window when Node A has discovered Node B, but Node B has not discovered Node A yet. Such time window is usually very small, a matter of milliseconds, but certain JMS providers or some Mule messaging protocols may be very slow and hence have larger discovery delay window.

The default value of this property is 60,000ms or 1 minute which should be good enough for vast majority of configurations. However, if you do anticipate an even larger delay, you should increase this value.

Specified by:
getDiscoveryStartupDelay in interface GridConfiguration
Returns:
Time in milliseconds for when nodes can be out-of-sync.

setDiscoveryStartupDelay

public void setDiscoveryStartupDelay(long discoStartupDelay)
For full explanation of this property refer to GridConfigurationAdapter.getDiscoveryStartupDelay() method.

Parameters:
discoStartupDelay - Time in milliseconds for when nodes can be out-of-sync during startup.

setMetricsExpireTime

public void setMetricsExpireTime(long metricsExpireTime)
Sets time in milliseconds after which a certain metric value is considered expired. If not set explicitly, then default value is 600,000 milliseconds (10 min