GridGain™ 2.1.0
Java API Specification

org.gridgain.grid
Interface GridConfiguration

All Known Implementing Classes:
GridConfigurationAdapter

@Apache20LicenseCompatible
public interface GridConfiguration

This interface defines grid runtime configuration. This configuration is passed to GridFactory.start(GridConfiguration) method. It defines all configuration parameters required to start a grid instance. Usually, a special class called "loader" will create an instance of this interface and call GridFactory.start(GridConfiguration) method to initialize GridGain instance.

Note, that absolutely every configuration property in GridConfiguration is optional. Once can simply create new instance of GridConfigurationAdapter, for example, and pass it to GridFactory.start(GridConfiguration) to start grid with default configuration. See GridFactory documentation for information about default configuration properties used and more information on how to start grid.

For more information about grid configuration and startup refer to GridFactory documentation which includes description and default values for every configuration property.



See Also:

  Documentation
  Email Support
  Online Forums
  Issue Tracking

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

 

Field Summary
static GridDeploymentMode DFLT_DEPLOYMENT_MODE
          Default deployment mode (value is GridDeploymentMode.PRIVATE).
static long DFLT_DISCOVERY_STARTUP_DELAY
          Default discovery startup delay in milliseconds (value is 60,000ms).
static long DFLT_METRICS_EXPIRE_TIME
          Default metrics expire time.
static int DFLT_METRICS_HISTORY_SIZE
          Default metrics history size (value is 10000).
static boolean DFLT_PEER_CLASS_LOADING_ENABLED
          Default flag for peer class loading.
static int DFLT_PEER_CLASS_LOADING_MISSED_RESROUCES_CACHE_SIZE
          Default cache size for missed resources.
static long DFLT_PEER_CLASS_LOADING_TIMEOUT
          Default maximum peer class loading timeout in milliseconds (value is 2,000ms).
 
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.
 GridDeploymentMode getDeploymentMode()
          Gets deployment mode for deploying tasks and other classes on this node.
 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 name of this grid instance.
 Collection<? extends GridLifecycleBean> getLifecycleBeans()
          Returns a collection of life-cycle beans.
 GridLoadBalancingSpi[] getLoadBalancingSpi()
          Should return fully configured load balancing SPI implementation.
 GridMarshaller getMarshaller()
          Should return an instance of marshaller to use in grid.
 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.
 ExecutorService getPeerClassLoadingExecutorService()
          Should return an instance of fully configured executor service which is in charge of peer class loading requests/responses.
 int getPeerClassLoadingMissedResourcesCacheSize()
          Returns missed resources cache size.
 long getPeerClassLoadingTimeout()
          Maximum timeout in milliseconds to wait for class-loading responses from remote nodes.
 ExecutorService getSystemExecutorService()
          Should return an instance of fully configured executor service that is in charge of processing GridTaskSession requests and user messages sent via Grid.sendMessage(GridNode, Serializable) method.
 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.
 

Field Detail

DFLT_PEER_CLASS_LOADING_ENABLED

static final boolean DFLT_PEER_CLASS_LOADING_ENABLED
Default flag for peer class loading. By default the value is true which means that peer class loading is enabled.

See Also:
Constant Field Values

DFLT_METRICS_HISTORY_SIZE

static final int DFLT_METRICS_HISTORY_SIZE
Default metrics history size (value is 10000).

See Also:
Constant Field Values

DFLT_METRICS_EXPIRE_TIME

static final long DFLT_METRICS_EXPIRE_TIME
Default metrics expire time. The value is Long.MAX_VALUE which means that metrics never expire.

See Also:
Constant Field Values

DFLT_PEER_CLASS_LOADING_TIMEOUT

static final long DFLT_PEER_CLASS_LOADING_TIMEOUT
Default maximum peer class loading timeout in milliseconds (value is 2,000ms).

See Also:
Constant Field Values

DFLT_DISCOVERY_STARTUP_DELAY

static final long DFLT_DISCOVERY_STARTUP_DELAY
Default discovery startup delay in milliseconds (value is 60,000ms).

See Also:
Constant Field Values

DFLT_DEPLOYMENT_MODE

static final GridDeploymentMode DFLT_DEPLOYMENT_MODE
Default deployment mode (value is GridDeploymentMode.PRIVATE).


DFLT_PEER_CLASS_LOADING_MISSED_RESROUCES_CACHE_SIZE

static final int DFLT_PEER_CLASS_LOADING_MISSED_RESROUCES_CACHE_SIZE
Default cache size for missed resources.

See Also:
Constant Field Values
Method Detail

getGridName

String getGridName()
Gets optional name of this grid instance. If name is not provides, null will be used as a default name for the grid instance.

Returns:
Grid name. Can be null which is default if non-default name was not provided.

getUserAttributes

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 system adds the following attributes automatically (so you don't have to add them manually):

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.

Returns:
User defined attributes for this node.

getGridLogger

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.

Returns:
Logger to use in grid.

getMarshaller

GridMarshaller getMarshaller()
Should return an instance of marshaller to use in grid. If not provided, default value will be used. See GridFactory for information on default configuration.

Returns:
Marshaller to use in grid.

getExecutorService

ExecutorService getExecutorService()
Should return an instance of fully configured thread pool to be used in grid. This executor service will be in charge of processing GridTasks and GridJobs.

If not provided, default value will be used. See GridFactory for information on default configuration.

Returns:
Thread pool implementation to be used in grid to process job execution requests and user messages sent to the node.

getSystemExecutorService

ExecutorService getSystemExecutorService()
Should return an instance of fully configured executor service that is in charge of processing GridTaskSession requests and user messages sent via Grid.sendMessage(GridNode, Serializable) method.

If not provided, default value will be used. See GridFactory for information on default configuration.

Returns:
Thread pool implementation to be used in grid for job responses and session attributes processing.

getPeerClassLoadingExecutorService

ExecutorService getPeerClassLoadingExecutorService()
Should return an instance of fully configured executor service which is in charge of peer class loading requests/responses. If you don't use P2P class loading and use GAR deployment only we would recommend to decrease the value of total threads to 1.

If not provided, default value will be used. See GridFactory for information on default configuration.

Returns:
Thread pool implementation to be used for peer class loading requests handling.

getGridGainHome

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.

Returns:
GridGain installation home or null to make the system attempt to infer it automatically.

getMBeanServer

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

Returns:
MBean server instance or null to make the system create a default one.
See Also:
ManagementFactory.getPlatformMBeanServer()

getNodeId

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

Returns:
Unique identifier for this node within grid.

isPeerClassLoadingEnabled

boolean isPeerClassLoadingEnabled()
Returns true if peer class loading is enabled, false otherwise. Default value is true specified by GridConfiguration.DFLT_PEER_CLASS_LOADING_ENABLED.

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.

Returns:
true if peer class loading is enabled, false otherwise.

getP2PLocalClassPathExclude

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.

Returns:
List of peer-to-peer loaded package names.

getMetricsHistorySize

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

Returns:
Metrics history size.

getMetricsExpireTime

long getMetricsExpireTime()
Elapsed time in milliseconds after which metrics are considered expired. If not provided (value is 0), then default value GridConfiguration.DFLT_METRICS_EXPIRE_TIME is used.

Returns:
Metrics expire time.

getPeerClassLoadingTimeout

long getPeerClassLoadingTimeout()
Maximum timeout in milliseconds to wait for class-loading responses from remote nodes. After reaching this timeout ClassNotFoundException will be thrown.

If not provided (value is 0), then default value GridConfiguration.DFLT_PEER_CLASS_LOADING_TIMEOUT is used.

Returns:
Maximum timeout for peer-class-loading requests.

getLifecycleBeans

Collection<? extends GridLifecycleBean> getLifecycleBeans()
Returns a collection of life-cycle beans. These beans will be automatically notified of grid life-cycle events. Use life-cycle beans whenever you want to perform certain logic before and after grid startup and stopping routines.

Returns:
Collection of life-cycle beans.
See Also:
GridLifecycleBean, GridLifecycleEventType

getDiscoverySpi

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

Returns:
Grid discovery SPI implementation or null to use default implementation.

getCommunicationSpi

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

Returns:
Grid communication SPI implementation or null to use default implementation.

getEventStorageSpi

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

Returns:
Grid event SPI implementation or null to use default implementation.

getCollisionSpi

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

Returns:
Grid collision SPI implementation or null to use default implementation.

getMetricsSpi

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

Returns:
Grid metrics SPI implementation or null to use default implementation.

getDeploymentSpi

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

Returns:
Grid deployment SPI implementation or null to use default implementation.

getCheckpointSpi

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

Returns:
Grid checkpoint SPI implementation or null to use default implementation.

getFailoverSpi

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

Returns:
Grid failover SPI implementation or null to use default implementation.

getTopologySpi

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

Returns:
Grid topology SPI implementation or null to use default implementation.

getLoadBalancingSpi

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.

Returns:
Grid load balancing SPI implementation or null to use default implementation.

getTracingSpi

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).

Returns:
Grid tracing SPI implementation or null to not use tracing.

getDiscoveryStartupDelay

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,000 specified by GridConfiguration.DFLT_DISCOVERY_STARTUP_DELAY. This should be good enough for vast majority of configurations. However, if you do anticipate an even larger delay, you should increase this value.

Returns:
Time in milliseconds for when nodes can be out-of-sync.

getDeploymentMode

GridDeploymentMode getDeploymentMode()
Gets deployment mode for deploying tasks and other classes on this node. Refer to GridDeploymentMode documentation for more information.

Returns:
Deployment mode.

getPeerClassLoadingMissedResourcesCacheSize

int getPeerClassLoadingMissedResourcesCacheSize()
Returns missed resources cache size. If size greater than 0, missed resources will be cached and next resource request ignored. If size is 0, then request for the resource will be sent to the remote node every time this resource is requested.

Returns:
Missed resources cache size.

GridGain™ 2.1.0
Java API Specification

GridGain™ - Grid Computing Made Simple, ver. 2.1.0.19122008
2005-2008 Copyright © GridGain Systems. All Rights Reserved.