You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2014/12/05 15:07:47 UTC

[46/52] [abbrv] incubator-ignite git commit: # Renaming

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/main/java/org/gridgain/grid/spi/eventstorage/memory/MemoryEventStorageSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/eventstorage/memory/MemoryEventStorageSpi.java b/modules/core/src/main/java/org/gridgain/grid/spi/eventstorage/memory/MemoryEventStorageSpi.java
deleted file mode 100644
index 3364320..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/eventstorage/memory/MemoryEventStorageSpi.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.eventstorage.memory;
-
-import org.apache.ignite.*;
-import org.apache.ignite.events.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.spi.*;
-import org.gridgain.grid.spi.eventstorage.*;
-import org.gridgain.grid.util.typedef.*;
-import org.gridgain.grid.util.typedef.internal.*;
-import org.jdk8.backport.*;
-
-import java.util.*;
-
-import static org.apache.ignite.events.IgniteEventType.*;
-
-/**
- * In-memory {@link org.gridgain.grid.spi.eventstorage.EventStorageSpi} implementation. All events are
- * kept in the FIFO queue. If no configuration is provided a default expiration
- * {@link #DFLT_EXPIRE_AGE_MS} and default count {@link #DFLT_EXPIRE_COUNT} will
- * be used.
- * <p>
- * It's recommended not to set huge size and unlimited TTL because this might
- * lead to consuming a lot of memory and result in {@link OutOfMemoryError}.
- * Both event expiration time and maximum queue size could be changed at
- * runtime.
- * <p>
- * <h1 class="header">Configuration</h1>
- * <h2 class="header">Mandatory</h2>
- * This SPI has no mandatory configuration parameters.
- * <h2 class="header">Optional</h2>
- * The following configuration parameters are optional:
- * <ul>
- * <li>Event queue size (see {@link #setExpireCount(long)})</li>
- * <li>Event time-to-live value (see {@link #setExpireAgeMs(long)})</li>
- * <li>{@link #setFilter(org.apache.ignite.lang.IgnitePredicate)} - Event filter that should be used for decision to accept event.</li>
- * </ul>
- * <h2 class="header">Java Example</h2>
- * GridMemoryEventStorageSpi is used by default and should be explicitly configured only
- * if some SPI configuration parameters need to be overridden. Examples below insert own
- * events queue size value that differs from default 10000.
- * <pre name="code" class="java">
- * GridMemoryEventStorageSpi = new GridMemoryEventStorageSpi();
- *
- * // Init own events size.
- * spi.setExpireCount(2000);
- *
- * GridConfiguration cfg = new GridConfiguration();
- *
- * // Override default event storage SPI.
- * cfg.setEventStorageSpi(spi);
- *
- * // Starts grid.
- * G.start(cfg);
- * </pre>
- * <h2 class="header">Spring Example</h2>
- * GridMemoryEventStorageSpi can be configured from Spring XML configuration file:
- * <pre name="code" class="xml">
- * &lt;bean id="grid.custom.cfg" class="org.gridgain.grid.GridConfiguration" singleton="true"&gt;
- *         ...
- *         &lt;property name="discoverySpi"&gt;
- *             &lt;bean class="org.gridgain.grid.spi.eventStorage.memory.GridMemoryEventStorageSpi"&gt;
- *                 &lt;property name="expireCount" value="2000"/&gt;
- *             &lt;/bean&gt;
- *         &lt;/property&gt;
- *         ...
- * &lt;/bean&gt;
- * </pre>
- * <p>
- * <img src="http://www.gridgain.com/images/spring-small.png">
- * <br>
- * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
- * @see org.gridgain.grid.spi.eventstorage.EventStorageSpi
- */
-@IgniteSpiMultipleInstancesSupport(true)
-public class MemoryEventStorageSpi extends IgniteSpiAdapter implements EventStorageSpi,
-    MemoryEventStorageSpiMBean {
-    /** Default event time to live value in milliseconds (value is {@link Long#MAX_VALUE}). */
-    public static final long DFLT_EXPIRE_AGE_MS = Long.MAX_VALUE;
-
-    /** Default expire count (value is {@code 10000}). */
-    public static final int DFLT_EXPIRE_COUNT = 10000;
-
-    /** */
-    @IgniteLoggerResource
-    private IgniteLogger log;
-
-    /** Event time-to-live value in milliseconds. */
-    private long expireAgeMs = DFLT_EXPIRE_AGE_MS;
-
-    /** Maximum queue size. */
-    private long expireCnt = DFLT_EXPIRE_COUNT;
-
-    /** Events queue. */
-    private ConcurrentLinkedDeque8<IgniteEvent> evts = new ConcurrentLinkedDeque8<>();
-
-    /** Configured event predicate filter. */
-    private IgnitePredicate<IgniteEvent> filter;
-
-    /**
-     * Gets filter for events to be recorded.
-     *
-     * @return Filter to use.
-     */
-    public IgnitePredicate<IgniteEvent> getFilter() {
-        return filter;
-    }
-
-    /**
-     * Sets filter for events to be recorded.
-     *
-     * @param filter Filter to use.
-     */
-    @IgniteSpiConfiguration(optional = true)
-    public void setFilter(IgnitePredicate<IgniteEvent> filter) {
-        this.filter = filter;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void spiStart(String gridName) throws IgniteSpiException {
-        // Start SPI start stopwatch.
-        startStopwatch();
-
-        assertParameter(expireCnt > 0, "expireCnt > 0");
-        assertParameter(expireAgeMs > 0, "expireAgeMs > 0");
-
-        // Ack parameters.
-        if (log.isDebugEnabled()) {
-            log.debug(configInfo("expireAgeMs", expireAgeMs));
-            log.debug(configInfo("expireCnt", expireCnt));
-        }
-
-        registerMBean(gridName, this, MemoryEventStorageSpiMBean.class);
-
-        // Ack ok start.
-        if (log.isDebugEnabled())
-            log.debug(startInfo());
-    }
-
-    /** {@inheritDoc} */
-    @Override public void spiStop() throws IgniteSpiException {
-        unregisterMBean();
-
-        // Reset events.
-        evts.clear();
-
-        // Ack ok stop.
-        if (log.isDebugEnabled())
-            log.debug(stopInfo());
-    }
-
-    /**
-     * Sets events expiration time. All events that exceed this value
-     * will be removed from the queue when next event comes.
-     * <p>
-     * If not provided, default value is {@link #DFLT_EXPIRE_AGE_MS}.
-     *
-     * @param expireAgeMs Expiration time in milliseconds.
-     */
-    @IgniteSpiConfiguration(optional = true)
-    public void setExpireAgeMs(long expireAgeMs) {
-        this.expireAgeMs = expireAgeMs;
-    }
-
-    /**
-     * Sets events queue size. Events will be filtered out when new request comes.
-     * <p>
-     * If not provided, default value {@link #DFLT_EXPIRE_COUNT} will be used.
-     *
-     * @param expireCnt Maximum queue size.
-     */
-    @IgniteSpiConfiguration(optional = true)
-    public void setExpireCount(long expireCnt) {
-        this.expireCnt = expireCnt;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getExpireAgeMs() {
-        return expireAgeMs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getExpireCount() {
-        return expireCnt;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getQueueSize() {
-        return evts.sizex();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void clearAll() {
-        evts.clear();
-    }
-
-    /** {@inheritDoc} */
-    @Override public <T extends IgniteEvent> Collection<T> localEvents(IgnitePredicate<T> p) {
-        A.notNull(p, "p");
-
-        cleanupQueue();
-
-        return F.retain((Collection<T>)evts, true, p);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void record(IgniteEvent evt) throws IgniteSpiException {
-        assert evt != null;
-
-        // Filter out events.
-        if (filter == null || filter.apply(evt)) {
-            cleanupQueue();
-
-            evts.add(evt);
-
-            // Make sure to filter out metrics updates to prevent log from flooding.
-            if (evt.type() != EVT_NODE_METRICS_UPDATED && log.isDebugEnabled())
-                log.debug("Event recorded: " + evt);
-        }
-    }
-
-    /**
-     * Method cleans up all events that either outnumber queue size
-     * or exceeds time-to-live value. It does none if someone else
-     * cleans up queue (lock is locked) or if there are queue readers
-     * (readersNum > 0).
-     */
-    private void cleanupQueue() {
-        long now = U.currentTimeMillis();
-
-        long queueOversize = evts.sizex() - expireCnt;
-
-        for (int i = 0; i < queueOversize && evts.sizex() > expireCnt; i++) {
-            IgniteEvent expired = evts.poll();
-
-            if (log.isDebugEnabled())
-                log.debug("Event expired by count: " + expired);
-        }
-
-        while (true) {
-            ConcurrentLinkedDeque8.Node<IgniteEvent> node = evts.peekx();
-
-            if (node == null) // Queue is empty.
-                break;
-
-            IgniteEvent evt = node.item();
-
-            if (evt == null) // Competing with another thread.
-                continue;
-
-            if (now - evt.timestamp() < expireAgeMs)
-                break;
-
-            if (evts.unlinkx(node) && log.isDebugEnabled())
-                log.debug("Event expired by age: " + node.item());
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(MemoryEventStorageSpi.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/main/java/org/gridgain/grid/spi/eventstorage/memory/MemoryEventStorageSpiMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/eventstorage/memory/MemoryEventStorageSpiMBean.java b/modules/core/src/main/java/org/gridgain/grid/spi/eventstorage/memory/MemoryEventStorageSpiMBean.java
deleted file mode 100644
index eab8a92..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/eventstorage/memory/MemoryEventStorageSpiMBean.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.eventstorage.memory;
-
-import org.apache.ignite.mbean.*;
-import org.apache.ignite.spi.*;
-
-/**
- * Management bean for {@link MemoryEventStorageSpi}.
- * Beside properties defined for every SPI bean this one gives access to:
- * <ul>
- * <li>Event expiration time (see {@link #getExpireAgeMs()})</li>
- * <li>Maximum queue size (see {@link #getExpireCount()})</li>
- * <li>Method that removes all items from queue (see {@link #clearAll()})</li>
- * </ul>
- */
-@IgniteMBeanDescription("MBean that provides access to memory event storage SPI configuration.")
-public interface MemoryEventStorageSpiMBean extends IgniteSpiManagementMBean {
-    /**
-     * Gets event time-to-live value. Implementation must guarantee
-     * that event would not be accessible if its lifetime exceeds this value.
-     *
-     * @return Event time-to-live.
-     */
-    @IgniteMBeanDescription("Event time-to-live value.")
-    public long getExpireAgeMs();
-
-    /**
-     * Gets maximum event queue size. New incoming events will oust
-     * oldest ones if queue size exceeds this limit.
-     *
-     * @return Maximum event queue size.
-     */
-    @IgniteMBeanDescription("Maximum event queue size.")
-    public long getExpireCount();
-
-    /**
-     * Gets current queue size of the event queue.
-     *
-     * @return Current queue size of the event queue.
-     */
-    @IgniteMBeanDescription("Current event queue size.")
-    public long getQueueSize();
-
-    /**
-     * Removes all events from the event queue.
-     */
-    @IgniteMBeanDescription("Removes all events from the event queue.")
-    public void clearAll();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/main/java/org/gridgain/grid/spi/eventstorage/memory/package.html
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/eventstorage/memory/package.html b/modules/core/src/main/java/org/gridgain/grid/spi/eventstorage/memory/package.html
deleted file mode 100644
index 7b8a251..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/eventstorage/memory/package.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
-    @html.file.header
-    _________        _____ __________________        _____
-    __  ____/___________(_)______  /__  ____/______ ____(_)_______
-    _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
-    / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
-    \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
--->
-<html>
-<body>
-    <!-- Package description. -->
-    Contains <b>default</b> in-memory implementation for event storage SPI.
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/main/java/org/gridgain/grid/spi/eventstorage/package.html
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/eventstorage/package.html b/modules/core/src/main/java/org/gridgain/grid/spi/eventstorage/package.html
deleted file mode 100644
index 83f8dd9..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/eventstorage/package.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
-    @html.file.header
-    _________        _____ __________________        _____
-    __  ____/___________(_)______  /__  ____/______ ____(_)_______
-    _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
-    / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
-    \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
--->
-<html>
-<body>
-    <!-- Package description. -->
-    Contains APIs for event storage SPI.
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/main/java/org/gridgain/grid/spi/failover/FailoverContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/failover/FailoverContext.java b/modules/core/src/main/java/org/gridgain/grid/spi/failover/FailoverContext.java
deleted file mode 100644
index 7db8c1c..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/failover/FailoverContext.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.failover;
-
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.compute.*;
-import org.gridgain.grid.*;
-import org.gridgain.grid.spi.loadbalancing.*;
-import java.util.*;
-
-/**
- * This interface defines a set of operations available to failover SPI
- * one a given failed job.
- */
-public interface FailoverContext {
-    /**
-     * Gets current task session.
-     *
-     * @return Grid task session.
-     */
-    public ComputeTaskSession getTaskSession();
-
-    /**
-     * Gets failed result of job execution.
-     *
-     * @return Result of a failed job.
-     */
-    public ComputeJobResult getJobResult();
-
-    /**
-     * Gets the next balanced node for failed job. Internally this method will
-     * delegate to load balancing SPI (see {@link GridLoadBalancingSpi} to
-     * determine the optimal node for execution.
-     *
-     * @param top Topology to pick balanced node from.
-     * @return The next balanced node.
-     * @throws GridException If anything failed.
-     */
-    public ClusterNode getBalancedNode(List<ClusterNode> top) throws GridException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/main/java/org/gridgain/grid/spi/failover/FailoverSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/failover/FailoverSpi.java b/modules/core/src/main/java/org/gridgain/grid/spi/failover/FailoverSpi.java
deleted file mode 100644
index 393391d..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/failover/FailoverSpi.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.failover;
-
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.spi.*;
-
-import java.util.*;
-
-/**
- * Failover SPI provides developer with ability to supply custom logic for handling
- * failed execution of a grid job. Job execution can fail for a number of reasons:
- * <ul>
- *      <li>Job execution threw an exception (runtime, assertion or error)</li>
- *      <li>Node on which job was execution left topology (crashed or stopped)</li>
- *      <li>Collision SPI on remote node cancelled a job before it got a chance to execute (job rejection).</li>
- * </ul>
- * In all cases failover SPI takes failed job (as failover context) and list of all
- * grid nodes and provides another node on which the job execution will be retried.
- * It is up to failover SPI to make sure that job is not mapped to the node it
- * failed on. The failed node can be retrieved from
- * {@link org.apache.ignite.compute.ComputeJobResult#getNode() GridFailoverContext.getJobResult().node()}
- * method.
- * <p>
- * GridGain comes with the following built-in failover SPI implementations:
- * <ul>
- *      <li>{@link org.gridgain.grid.spi.failover.never.NeverFailoverSpi}</li>
- *      <li>{@link org.gridgain.grid.spi.failover.always.AlwaysFailoverSpi}</li>
- *      <li>{@link org.gridgain.grid.spi.failover.jobstealing.JobStealingFailoverSpi}</li>
- * </ul>
- * <b>NOTE:</b> this SPI (i.e. methods in this interface) should never be used directly. SPIs provide
- * internal view on the subsystem and is used internally by GridGain kernal. In rare use cases when
- * access to a specific implementation of this SPI is required - an instance of this SPI can be obtained
- * via {@link org.apache.ignite.Ignite#configuration()} method to check its configuration properties or call other non-SPI
- * methods. Note again that calling methods from this interface on the obtained instance can lead
- * to undefined behavior and explicitly not supported.
- */
-public interface FailoverSpi extends IgniteSpi {
-    /**
-     * This method is called when method {@link org.apache.ignite.compute.ComputeTask#result(org.apache.ignite.compute.ComputeJobResult, List)} returns
-     * value {@link org.apache.ignite.compute.ComputeJobResultPolicy#FAILOVER} policy indicating that the result of
-     * job execution must be failed over. Implementation of this method should examine failover
-     * context and choose one of the grid nodes from supplied {@code topology} to retry job execution
-     * on it. For best performance it is advised that {@link FailoverContext#getBalancedNode(List)}
-     * method is used to select node for execution of failed job.
-     *
-     * @param ctx Failover context.
-     * @param top Collection of all grid nodes within task topology (may include failed node).
-     * @return New node to route this job to or {@code null} if new node cannot be picked.
-     *      If job failover fails (returns {@code null}) the whole task will be failed.
-     */
-    public ClusterNode failover(FailoverContext ctx, List<ClusterNode> top);
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/main/java/org/gridgain/grid/spi/failover/always/AlwaysFailoverSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/failover/always/AlwaysFailoverSpi.java b/modules/core/src/main/java/org/gridgain/grid/spi/failover/always/AlwaysFailoverSpi.java
deleted file mode 100644
index a33e519..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/failover/always/AlwaysFailoverSpi.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.failover.always;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.spi.*;
-import org.gridgain.grid.*;
-import org.gridgain.grid.spi.failover.*;
-import org.gridgain.grid.util.typedef.*;
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.util.*;
-
-/**
- * Failover SPI that always reroutes a failed job to another node.
- * Note, that at first an attempt will be made to reroute the failed job
- * to a node that was not part of initial split for a better chance of
- * success. If no such nodes are available, then an attempt will be made to
- * reroute the failed job to the nodes in the initial split minus the node
- * the job is failed on. If none of the above attempts succeeded, then the
- * job will not be failed over and {@code null} will be returned.
- * <p>
- * <h1 class="header">Configuration</h1>
- * This SPI is default failover SPI and does not have to be explicitly
- * configured unless configuration parameters need to be changed.
- * <h2 class="header">Mandatory</h2>
- * This SPI has no mandatory configuration parameters.
- * <h2 class="header">Optional</h2>
- * This SPI has following optional configuration parameters:
- * <ul>
- *      <li>
- *          Maximum failover attempts for a single job (see {@link #setMaximumFailoverAttempts(int)}).
- *          If maximum failover attempts is reached, then job will not be failed-over and,
- *          hence, will fail.
- *      </li>
- * </ul>
- * Here is a Java example how to configure grid with {@code GridAlwaysFailoverSpi} failover SPI.
- * <pre name="code" class="java">
- * GridAlwaysFailoverSpi spi = new GridAlwaysFailoverSpi();
- *
- * // Override maximum failover attempts.
- * spi.setMaximumFailoverAttempts(5);
- *
- * GridConfiguration cfg = new GridConfiguration();
- *
- * // Override default failover SPI.
- * cfg.setFailoverSpiSpi(spi);
- *
- * // Starts grid.
- * G.start(cfg);
- * </pre>
- * Here is an example of how to configure {@code GridAlwaysFailoverSpi} from Spring XML configuration file.
- * <pre name="code" class="xml">
- * &lt;property name="failoverSpi"&gt;
- *     &lt;bean class="org.gridgain.grid.spi.failover.always.GridAlwaysFailoverSpi"&gt;
- *         &lt;property name="maximumFailoverAttempts" value="5"/&gt;
- *     &lt;/bean&gt;
- * &lt;/property&gt;
- * </pre>
- * <p>
- * <img src="http://www.gridgain.com/images/spring-small.png">
- * <br>
- * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
- * @see org.gridgain.grid.spi.failover.FailoverSpi
- */
-@IgniteSpiMultipleInstancesSupport(true)
-@IgniteSpiConsistencyChecked(optional = true)
-public class AlwaysFailoverSpi extends IgniteSpiAdapter implements FailoverSpi, AlwaysFailoverSpiMBean {
-    /** Maximum number of attempts to execute a failed job on another node (default is {@code 5}). */
-    public static final int DFLT_MAX_FAILOVER_ATTEMPTS = 5;
-
-    /**
-     * Name of job context attribute containing all nodes a job failed on.
-     *
-     * @see org.apache.ignite.compute.ComputeJobContext
-     */
-    public static final String FAILED_NODE_LIST_ATTR = "gg:failover:failednodelist";
-
-    /** Maximum attempts attribute key should be the same on all nodes. */
-    public static final String MAX_FAILOVER_ATTEMPT_ATTR = "gg:failover:maxattempts";
-
-    /** Injected grid logger. */
-    @IgniteLoggerResource
-    private IgniteLogger log;
-
-    /** Maximum number of attempts to execute a failed job on another node. */
-    private int maxFailoverAttempts = DFLT_MAX_FAILOVER_ATTEMPTS;
-
-    /** Number of jobs that were failed over. */
-    private int totalFailoverJobs;
-
-    /** {@inheritDoc} */
-    @Override public int getMaximumFailoverAttempts() {
-        return maxFailoverAttempts;
-    }
-
-    /**
-     * Sets maximum number of attempts to execute a failed job on another node.
-     * If not specified, {@link #DFLT_MAX_FAILOVER_ATTEMPTS} value will be used.
-     *
-     * @param maxFailoverAttempts Maximum number of attempts to execute a failed job on another node.
-     */
-    @IgniteSpiConfiguration(optional = true)
-    public void setMaximumFailoverAttempts(int maxFailoverAttempts) {
-        this.maxFailoverAttempts = maxFailoverAttempts;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTotalFailoverJobsCount() {
-        return totalFailoverJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map<String, Object> getNodeAttributes() throws IgniteSpiException {
-        return F.<String, Object>asMap(createSpiAttributeName(MAX_FAILOVER_ATTEMPT_ATTR), maxFailoverAttempts);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void spiStart(String gridName) throws IgniteSpiException {
-        // Start SPI start stopwatch.
-        startStopwatch();
-
-        assertParameter(maxFailoverAttempts >= 0, "maxFailoverAttempts >= 0");
-
-        if (log.isDebugEnabled())
-            log.debug(configInfo("maximumFailoverAttempts", maxFailoverAttempts));
-
-        registerMBean(gridName, this, AlwaysFailoverSpiMBean.class);
-
-        // Ack ok start.
-        if (log.isDebugEnabled())
-            log.debug(startInfo());
-    }
-
-    /** {@inheritDoc} */
-    @Override public void spiStop() throws IgniteSpiException {
-        unregisterMBean();
-
-        // Ack ok stop.
-        if (log.isDebugEnabled())
-            log.debug(stopInfo());
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public ClusterNode failover(FailoverContext ctx, List<ClusterNode> top) {
-        assert ctx != null;
-        assert top != null;
-
-        if (log.isDebugEnabled())
-            log.debug("Received failed job result: " + ctx.getJobResult());
-
-        if (top.isEmpty()) {
-            U.warn(log, "Received empty topology for failover and is forced to fail.");
-
-            // Nowhere to failover to.
-            return null;
-        }
-
-        Collection<UUID> failedNodes = ctx.getJobResult().getJobContext().getAttribute(FAILED_NODE_LIST_ATTR);
-
-        if (failedNodes == null)
-            failedNodes = U.newHashSet(1);
-
-        Integer failoverCnt = failedNodes.size();
-
-        if (failoverCnt >= maxFailoverAttempts) {
-            U.warn(log, "Job failover failed because number of maximum failover attempts is exceeded [failedJob=" +
-                ctx.getJobResult().getJob() + ", maxFailoverAttempts=" + maxFailoverAttempts + ']');
-
-            return null;
-        }
-
-        failedNodes.add(ctx.getJobResult().getNode().id());
-
-        // Copy.
-        List<ClusterNode> newTop = new ArrayList<>(top.size());
-
-        for (ClusterNode node : top)
-            if (!failedNodes.contains(node.id()))
-                newTop.add(node);
-
-        if (newTop.isEmpty()) {
-            U.warn(log, "Received topology with only nodes that job had failed on (forced to fail) [failedNodes=" +
-                failedNodes + ']');
-
-            // Nowhere to failover to.
-            return null;
-        }
-
-        try {
-            ClusterNode node = ctx.getBalancedNode(newTop);
-
-            if (node == null)
-                U.warn(log, "Load balancer returned null node for topology: " + newTop);
-            else {
-                // Increment failover count.
-                ctx.getJobResult().getJobContext().setAttribute(FAILED_NODE_LIST_ATTR, failedNodes);
-
-                totalFailoverJobs++;
-            }
-
-            if (node != null)
-                U.warn(log, "Failed over job to a new node [newNode=" + node.id() +
-                    ", oldNode=" + ctx.getJobResult().getNode().id() +
-                    ", sesId=" + ctx.getTaskSession().getId() +
-                    ", job=" + ctx.getJobResult().getJob() +
-                    ", jobCtx=" + ctx.getJobResult().getJobContext() +
-                    ", task=" + ctx.getTaskSession().getTaskName() + ']');
-
-            return node;
-        }
-        catch (GridException e) {
-            U.error(log, "Failed to get next balanced node for failover: " + ctx, e);
-
-            return null;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected List<String> getConsistentAttributeNames() {
-        return Collections.singletonList(createSpiAttributeName(MAX_FAILOVER_ATTEMPT_ATTR));
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(AlwaysFailoverSpi.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/main/java/org/gridgain/grid/spi/failover/always/AlwaysFailoverSpiMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/failover/always/AlwaysFailoverSpiMBean.java b/modules/core/src/main/java/org/gridgain/grid/spi/failover/always/AlwaysFailoverSpiMBean.java
deleted file mode 100644
index d91be08..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/failover/always/AlwaysFailoverSpiMBean.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.failover.always;
-
-import org.apache.ignite.mbean.*;
-import org.apache.ignite.spi.*;
-
-/**
- * Management bean for {@link AlwaysFailoverSpi}.
- */
-@IgniteMBeanDescription("MBean that provides access to always failover SPI configuration.")
-public interface AlwaysFailoverSpiMBean extends IgniteSpiManagementMBean {
-    /**
-     * Gets maximum number of attempts to execute a failed job on another node.
-     * If not specified, {@link AlwaysFailoverSpi#DFLT_MAX_FAILOVER_ATTEMPTS} value will be used.
-     *
-     * @return Maximum number of attempts to execute a failed job on another node.
-     */
-    @IgniteMBeanDescription("Maximum number of attempts to execute a failed job on another node.")
-    public int getMaximumFailoverAttempts();
-
-    /**
-     * Get total number of jobs that were failed over.
-     *
-     * @return Total number of failed over jobs.
-     */
-    @IgniteMBeanDescription("Total number of jobs that were failed over.")
-    public int getTotalFailoverJobsCount();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/main/java/org/gridgain/grid/spi/failover/always/package.html
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/failover/always/package.html b/modules/core/src/main/java/org/gridgain/grid/spi/failover/always/package.html
deleted file mode 100644
index 6299303..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/failover/always/package.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
-    @html.file.header
-    _________        _____ __________________        _____
-    __  ____/___________(_)______  /__  ____/______ ____(_)_______
-    _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
-    / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
-    \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
--->
-<html>
-<body>
-    <!-- Package description. -->
-    Contains <b>default</b> "always" failover SPI.
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/main/java/org/gridgain/grid/spi/failover/jobstealing/JobStealingFailoverSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/failover/jobstealing/JobStealingFailoverSpi.java b/modules/core/src/main/java/org/gridgain/grid/spi/failover/jobstealing/JobStealingFailoverSpi.java
deleted file mode 100644
index e7e7445..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/failover/jobstealing/JobStealingFailoverSpi.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.failover.jobstealing;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.spi.*;
-import org.gridgain.grid.*;
-import org.gridgain.grid.spi.failover.*;
-import org.gridgain.grid.util.typedef.*;
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.util.*;
-
-import static org.apache.ignite.spi.collision.jobstealing.JobStealingCollisionSpi.*;
-
-/**
- * Job stealing failover SPI needs to always be used in conjunction with
- * {@link org.apache.ignite.spi.collision.jobstealing.JobStealingCollisionSpi} SPI. When {@link org.apache.ignite.spi.collision.jobstealing.JobStealingCollisionSpi}
- * receives a <b>steal</b> request and rejects jobs so they can be routed to the
- * appropriate node, it is the responsibility of this {@code GridJobStealingFailoverSpi}
- * SPI to make sure that the job is indeed re-routed to the node that has sent the initial
- * request to <b>steal</b> it.
- * <p>
- * {@code GridJobStealingFailoverSpi} knows where to route a job based on the
- * {@link org.apache.ignite.spi.collision.jobstealing.JobStealingCollisionSpi#THIEF_NODE_ATTR} job context attribute (see {@link org.apache.ignite.compute.ComputeJobContext}).
- * Prior to rejecting a job,  {@link org.apache.ignite.spi.collision.jobstealing.JobStealingCollisionSpi} will populate this
- * attribute with the ID of the node that wants to <b>steal</b> this job.
- * Then {@code GridJobStealingFailoverSpi} will read the value of this attribute and
- * route the job to the node specified.
- * <p>
- * If failure is caused by a node crash, and not by <b>steal</b> request, then this
- * SPI behaves identically to {@link org.gridgain.grid.spi.failover.always.AlwaysFailoverSpi}, and tries to find the
- * next balanced node to fail-over a job to.
- * <p>
- * <h1 class="header">Configuration</h1>
- * <h2 class="header">Mandatory</h2>
- * This SPI has no mandatory configuration parameters.
- * <h2 class="header">Optional</h2>
- * This SPI has following optional configuration parameters:
- * <ul>
- * <li>Maximum failover attempts for a single job (see {@link #setMaximumFailoverAttempts(int)}).</li>
- * </ul>
- * Here is a Java example on how to configure grid with {@code GridJobStealingFailoverSpi}.
- * <pre name="code" class="java">
- * GridJobStealingFailoverSpi spi = new GridJobStealingFailoverSpi();
- *
- * // Override maximum failover attempts.
- * spi.setMaximumFailoverAttempts(5);
- *
- * GridConfiguration cfg = new GridConfiguration();
- *
- * // Override default failover SPI.
- * cfg.setFailoverSpiSpi(spi);
- *
- * // Starts grid.
- * G.start(cfg);
- </pre>
- * Here is an example of how to configure {@code GridJobStealingFailoverSpi} from Spring XML configuration file.
- * <pre name="code" class="xml">
- * &lt;property name="failoverSpi"&gt;
- *     &lt;bean class="org.gridgain.grid.spi.failover.jobstealing.GridJobStealingFailoverSpi"&gt;
- *         &lt;property name="maximumFailoverAttempts" value="5"/&gt;
- *     &lt;/bean&gt;
- * &lt;/property&gt;
- * </pre>
- * <p>
- * <img src="http://www.gridgain.com/images/spring-small.png">
- * <br>
- * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
- * @see org.gridgain.grid.spi.failover.FailoverSpi
- */
-@IgniteSpiMultipleInstancesSupport(true)
-@IgniteSpiConsistencyChecked(optional = true)
-public class JobStealingFailoverSpi extends IgniteSpiAdapter implements FailoverSpi,
-    JobStealingFailoverSpiMBean {
-    /** Maximum number of attempts to execute a failed job on another node (default is {@code 5}). */
-    public static final int DFLT_MAX_FAILOVER_ATTEMPTS = 5;
-
-    /**
-     * Name of job context attribute containing all nodes a job failed on. Note
-     * that this list does not include nodes that a job was stolen from.
-     *
-     * @see org.apache.ignite.compute.ComputeJobContext
-     */
-    static final String FAILED_NODE_LIST_ATTR = "gg:failover:failednodelist";
-
-    /**
-     * Name of job context attribute containing current failover attempt count.
-     * This count is incremented every time the same job gets failed over to
-     * another node for execution if it was not successfully stolen.
-     *
-     * @see org.apache.ignite.compute.ComputeJobContext
-     */
-    static final String FAILOVER_ATTEMPT_COUNT_ATTR = "gg:failover:attemptcount";
-
-    /** Maximum failover attempts job context attribute name. */
-    private static final String MAX_FAILOVER_ATTEMPT_ATTR = "gg:failover:maxattempts";
-
-    /** Injected grid logger. */
-    @IgniteLoggerResource
-    private IgniteLogger log;
-
-    /** Maximum number of attempts to execute a failed job on another node. */
-    private int maxFailoverAttempts = DFLT_MAX_FAILOVER_ATTEMPTS;
-
-    /** Number of jobs that were failed over. */
-    private int totalFailedOverJobs;
-
-    /** Number of jobs that were stolen. */
-    private int totalStolenJobs;
-
-    /** {@inheritDoc} */
-    @Override public int getMaximumFailoverAttempts() {
-        return maxFailoverAttempts;
-    }
-
-    /**
-     * Sets maximum number of attempts to execute a failed job on another node.
-     * If job gets stolen and thief node exists then it is not considered as
-     * failed job.
-     * If not specified, {@link #DFLT_MAX_FAILOVER_ATTEMPTS} value will be used.
-     * <p>
-     * Note this value must be identical for all grid nodes in the grid.
-     *
-     * @param maxFailoverAttempts Maximum number of attempts to execute a failed
-     *      job on another node.
-     */
-    @IgniteSpiConfiguration(optional = true)
-    public void setMaximumFailoverAttempts(int maxFailoverAttempts) {
-        this.maxFailoverAttempts = maxFailoverAttempts;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTotalFailedOverJobsCount() {
-        return totalFailedOverJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTotalStolenJobsCount() {
-        return totalStolenJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map<String, Object> getNodeAttributes() throws IgniteSpiException {
-        return F.<String, Object>asMap(createSpiAttributeName(MAX_FAILOVER_ATTEMPT_ATTR), maxFailoverAttempts);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void spiStart(String gridName) throws IgniteSpiException {
-        // Start SPI start stopwatch.
-        startStopwatch();
-
-        assertParameter(maxFailoverAttempts >= 0, "maximumFailoverAttempts >= 0");
-
-        if (log.isDebugEnabled())
-            log.debug(configInfo("maxFailoverAttempts", maxFailoverAttempts));
-
-        registerMBean(gridName, this, JobStealingFailoverSpiMBean.class);
-
-        // Ack ok start.
-        if (log.isDebugEnabled())
-            log.debug(startInfo());
-    }
-
-    /** {@inheritDoc} */
-    @Override public void spiStop() throws IgniteSpiException {
-        unregisterMBean();
-
-        // Ack ok stop.
-        if (log.isDebugEnabled())
-            log.debug(stopInfo());
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public ClusterNode failover(FailoverContext ctx, List<ClusterNode> top) {
-        assert ctx != null;
-        assert top != null;
-
-        if (top.isEmpty()) {
-            U.warn(log, "Received empty subgrid and is forced to fail.");
-
-            // Nowhere to failover to.
-            return null;
-        }
-
-        Integer failoverCnt = ctx.getJobResult().getJobContext().getAttribute(FAILOVER_ATTEMPT_COUNT_ATTR);
-
-        if (failoverCnt == null)
-            failoverCnt = 0;
-
-        if (failoverCnt > maxFailoverAttempts) {
-            U.error(log, "Failover count exceeded maximum failover attempts parameter [failedJob=" +
-                ctx.getJobResult().getJob() + ", maxFailoverAttempts=" + maxFailoverAttempts + ']');
-
-            return null;
-        }
-
-        if (failoverCnt == maxFailoverAttempts) {
-            U.warn(log, "Job failover failed because number of maximum failover attempts is exceeded [failedJob=" +
-                ctx.getJobResult().getJob() + ", maxFailoverAttempts=" + maxFailoverAttempts + ']');
-
-            return null;
-        }
-
-        try {
-            ClusterNode thief = null;
-            boolean isNodeFailed = false;
-
-            UUID thiefId = ctx.getJobResult().getJobContext().getAttribute(THIEF_NODE_ATTR);
-
-            if (thiefId != null) {
-                // Clear attribute.
-                ctx.getJobResult().getJobContext().setAttribute(THIEF_NODE_ATTR, null);
-
-                thief = getSpiContext().node(thiefId);
-
-                if (thief != null) {
-                    // If sender != receiver.
-                    if (thief.equals(ctx.getJobResult().getNode())) {
-                        U.error(log, "Job stealer node is equal to job node (will fail-over using " +
-                            "load-balancing): " + thief.id());
-
-                        isNodeFailed = true;
-
-                        thief = null;
-                    }
-                    else if (!top.contains(thief)) {
-                        U.warn(log, "Thief node is not part of task topology  (will fail-over using load-balancing) " +
-                            "[thief=" + thiefId + ", topSize=" + top.size() + ']');
-
-                        thief = null;
-                    }
-
-                    if (log.isDebugEnabled())
-                        log.debug("Failing-over stolen job [from=" + ctx.getJobResult().getNode() + ", to=" +
-                            thief + ']');
-                }
-                else {
-                    isNodeFailed = true;
-
-                    U.warn(log, "Thief node left grid (will fail-over using load balancing): " + thiefId);
-                }
-            }
-            else
-                isNodeFailed = true;
-
-            // If job was not stolen or stolen node is not part of topology,
-            // then failover the regular way.
-            if (thief == null) {
-                Collection<UUID> failedNodes = ctx.getJobResult().getJobContext().getAttribute(FAILED_NODE_LIST_ATTR);
-
-                if (failedNodes == null)
-                    failedNodes = U.newHashSet(1);
-
-                if (isNodeFailed)
-                    failedNodes.add(ctx.getJobResult().getNode().id());
-
-                // Set updated failed node set into job context.
-                ctx.getJobResult().getJobContext().setAttribute(FAILED_NODE_LIST_ATTR, failedNodes);
-
-                // Copy.
-                List<ClusterNode> newTop = new ArrayList<>(top.size());
-
-                for (ClusterNode n : top) {
-                    // Add non-failed nodes to topology.
-                    if (!failedNodes.contains(n.id()))
-                        newTop.add(n);
-                }
-
-                if (newTop.isEmpty()) {
-                    U.warn(log, "Received topology with only nodes that job had failed on (forced to fail) " +
-                        "[failedNodes=" + failedNodes + ']');
-
-                    // Nowhere to failover to.
-                    return null;
-                }
-
-                thief = ctx.getBalancedNode(newTop);
-
-                if (thief == null)
-                    U.warn(log, "Load balancer returned null node for topology: " + newTop);
-            }
-
-            if (isNodeFailed)
-                // This is a failover, not stealing.
-                failoverCnt++;
-
-            // Even if it was stealing and thief node left grid we assume
-            // that it is failover because of the fail.
-            ctx.getJobResult().getJobContext().setAttribute(FAILOVER_ATTEMPT_COUNT_ATTR, failoverCnt);
-
-            if (thief != null) {
-                totalFailedOverJobs++;
-
-                if (isNodeFailed) {
-                    U.warn(log, "Failed over job to a new node [newNode=" + thief.id() +
-                        ", oldNode=" + ctx.getJobResult().getNode().id() +
-                        ", sesId=" + ctx.getTaskSession().getId() +
-                        ", job=" + ctx.getJobResult().getJob() +
-                        ", jobCtx=" + ctx.getJobResult().getJobContext() +
-                        ", task=" + ctx.getTaskSession().getTaskName() + ']');
-                }
-                else {
-                    totalStolenJobs++;
-                    if (log.isInfoEnabled())
-                        log.info("Stealing job to a new node [newNode=" + thief.id() +
-                            ", oldNode=" + ctx.getJobResult().getNode().id() +
-                            ", sesId=" + ctx.getTaskSession().getId() +
-                            ", job=" + ctx.getJobResult().getJob() +
-                            ", jobCtx=" + ctx.getJobResult().getJobContext() +
-                            ", task=" + ctx.getTaskSession().getTaskName() + ']');
-                }
-            }
-
-            return thief;
-        }
-        catch (GridException e) {
-            U.error(log, "Failed to get next balanced node for failover: " + ctx, e);
-
-            return null;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected List<String> getConsistentAttributeNames() {
-        return Collections.singletonList(createSpiAttributeName(MAX_FAILOVER_ATTEMPT_ATTR));
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(JobStealingFailoverSpi.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/main/java/org/gridgain/grid/spi/failover/jobstealing/JobStealingFailoverSpiMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/failover/jobstealing/JobStealingFailoverSpiMBean.java b/modules/core/src/main/java/org/gridgain/grid/spi/failover/jobstealing/JobStealingFailoverSpiMBean.java
deleted file mode 100644
index 38d9534..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/failover/jobstealing/JobStealingFailoverSpiMBean.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.failover.jobstealing;
-
-import org.apache.ignite.mbean.*;
-import org.apache.ignite.spi.*;
-
-/**
- * Management bean for {@link JobStealingFailoverSpi}.
- */
-@IgniteMBeanDescription("MBean that provides access to job stealing failover SPI configuration.")
-public interface JobStealingFailoverSpiMBean extends IgniteSpiManagementMBean {
-    /**
-     * Gets maximum number of attempts to execute a failed job on another node.
-     * If job gets stolen and thief node exists then it is not considered as
-     * failed job.
-     * If not specified, {@link JobStealingFailoverSpi#DFLT_MAX_FAILOVER_ATTEMPTS} value will be used.
-     *
-     * @return Maximum number of attempts to execute a failed job on another node.
-     */
-    @IgniteMBeanDescription("Maximum number of attempts to execute a failed job on another node.")
-    public int getMaximumFailoverAttempts();
-
-    /**
-     * Get total number of jobs that were failed over including stolen ones.
-     *
-     * @return Total number of failed over jobs.
-     */
-    @IgniteMBeanDescription("Total number of jobs that were failed over including stolen ones.")
-    public int getTotalFailedOverJobsCount();
-
-    /**
-     * Get total number of jobs that were stolen.
-     *
-     * @return Total number of stolen jobs.
-     */
-    @IgniteMBeanDescription("Total number of jobs that were stolen.")
-    public int getTotalStolenJobsCount();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/main/java/org/gridgain/grid/spi/failover/jobstealing/package.html
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/failover/jobstealing/package.html b/modules/core/src/main/java/org/gridgain/grid/spi/failover/jobstealing/package.html
deleted file mode 100644
index ebb77c2..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/failover/jobstealing/package.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
-    @html.file.header
-    _________        _____ __________________        _____
-    __  ____/___________(_)______  /__  ____/______ ____(_)_______
-    _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
-    / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
-    \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
--->
-<html>
-<body>
-    <!-- Package description. -->
-    Contains job stealing failover SPI.
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/main/java/org/gridgain/grid/spi/failover/never/NeverFailoverSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/failover/never/NeverFailoverSpi.java b/modules/core/src/main/java/org/gridgain/grid/spi/failover/never/NeverFailoverSpi.java
deleted file mode 100644
index 945b2a5..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/failover/never/NeverFailoverSpi.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.failover.never;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.spi.*;
-import org.gridgain.grid.spi.failover.*;
-import org.gridgain.grid.util.typedef.internal.*;
-import java.util.*;
-
-/**
- * This class provides failover SPI implementation that never fails over. This implementation
- * never fails over a failed job by always returning {@code null} out of
- * {@link org.gridgain.grid.spi.failover.FailoverSpi#failover(org.gridgain.grid.spi.failover.FailoverContext, List)} method.
- * <h1 class="header">Configuration</h1>
- * <h2 class="header">Mandatory</h2>
- * This SPI has no mandatory configuration parameters.
- * <h2 class="header">Optional</h2>
- * This SPI has no optional configuration parameters.
- * <p>
- * Here is a Java example on how to configure grid with {@code GridNeverFailoverSpi}:
- * <pre name="code" class="java">
- * GridNeverFailoverSpi spi = new GridNeverFailoverSpi();
- *
- * GridConfiguration cfg = new GridConfiguration();
- *
- * // Override default failover SPI.
- * cfg.setFailoverSpiSpi(spi);
- *
- * // Starts grid.
- * G.start(cfg);
- * </pre>
- * Here is an example on how to configure grid with {@code GridNeverFailoverSpi} from Spring XML configuration file:
- * <pre name="code" class="xml">
- * &lt;property name="failoverSpi"&gt;
- *     &lt;bean class="org.gridgain.grid.spi.failover.never.GridNeverFailoverSpi"/&gt;
- * &lt;/property&gt;
- * </pre>
- * <p>
- * <img src="http://www.gridgain.com/images/spring-small.png">
- * <br>
- * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
- * @see org.gridgain.grid.spi.failover.FailoverSpi
- */
-@IgniteSpiMultipleInstancesSupport(true)
-public class NeverFailoverSpi extends IgniteSpiAdapter implements FailoverSpi, NeverFailoverSpiMBean {
-    /** Injected grid logger. */
-    @IgniteLoggerResource
-    private IgniteLogger log;
-
-    /** {@inheritDoc} */
-    @Override public void spiStart(String gridName) throws IgniteSpiException {
-        // Start SPI start stopwatch.
-        startStopwatch();
-
-        registerMBean(gridName, this, NeverFailoverSpiMBean.class);
-
-        // Ack ok start.
-        if (log.isDebugEnabled())
-            log.debug(startInfo());
-    }
-
-    /** {@inheritDoc} */
-    @Override public void spiStop() throws IgniteSpiException {
-        unregisterMBean();
-
-        // Ack ok stop.
-        if (log.isDebugEnabled())
-            log.debug(stopInfo());
-    }
-
-    /** {@inheritDoc} */
-    @Override public ClusterNode failover(FailoverContext ctx, List<ClusterNode> top) {
-        U.warn(log, "Returning 'null' node for failed job (failover will not happen) [job=" +
-            ctx.getJobResult().getJob() + ", task=" +  ctx.getTaskSession().getTaskName() +
-            ", sessionId=" + ctx.getTaskSession().getId() + ']');
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(NeverFailoverSpi.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/main/java/org/gridgain/grid/spi/failover/never/NeverFailoverSpiMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/failover/never/NeverFailoverSpiMBean.java b/modules/core/src/main/java/org/gridgain/grid/spi/failover/never/NeverFailoverSpiMBean.java
deleted file mode 100644
index 30651c4..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/failover/never/NeverFailoverSpiMBean.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.spi.failover.never;
-
-import org.apache.ignite.mbean.*;
-import org.apache.ignite.spi.*;
-
-/**
- * Management bean for {@link NeverFailoverSpi}.
- */
-@IgniteMBeanDescription("MBean that provides access to never failover SPI configuration.")
-public interface NeverFailoverSpiMBean extends IgniteSpiManagementMBean {
-    // No-op.
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/main/java/org/gridgain/grid/spi/failover/never/package.html
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/failover/never/package.html b/modules/core/src/main/java/org/gridgain/grid/spi/failover/never/package.html
deleted file mode 100644
index 81e38aa..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/failover/never/package.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
-    @html.file.header
-    _________        _____ __________________        _____
-    __  ____/___________(_)______  /__  ____/______ ____(_)_______
-    _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
-    / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
-    \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
--->
-<html>
-<body>
-    <!-- Package description. -->
-    Contains "never" failover SPI.
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/main/java/org/gridgain/grid/spi/failover/package.html
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/failover/package.html b/modules/core/src/main/java/org/gridgain/grid/spi/failover/package.html
deleted file mode 100644
index 3b28cd2..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/spi/failover/package.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!--
-    @html.file.header
-    _________        _____ __________________        _____
-    __  ____/___________(_)______  /__  ____/______ ____(_)_______
-    _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
-    / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
-    \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
--->
-<html>
-<body>
-    <!-- Package description. -->
-    Contains APIs for failover SPI.
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/config/job-loadtest/client.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/job-loadtest/client.xml b/modules/core/src/test/config/job-loadtest/client.xml
index ce6b718..e828a47 100644
--- a/modules/core/src/test/config/job-loadtest/client.xml
+++ b/modules/core/src/test/config/job-loadtest/client.xml
@@ -23,7 +23,7 @@
         <property name="deploymentMode" value="CONTINUOUS"/>
 
         <property name="failoverSpi">
-            <bean class="org.gridgain.grid.spi.failover.jobstealing.JobStealingFailoverSpi">
+            <bean class="org.apache.ignite.spi.failover.jobstealing.JobStealingFailoverSpi">
                 <property name="maximumFailoverAttempts" value="10"/>
             </bean>
         </property>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/config/job-loadtest/server.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/job-loadtest/server.xml b/modules/core/src/test/config/job-loadtest/server.xml
index 5546e20..1a4bf96 100644
--- a/modules/core/src/test/config/job-loadtest/server.xml
+++ b/modules/core/src/test/config/job-loadtest/server.xml
@@ -36,7 +36,7 @@
         </property>
 
         <property name="failoverSpi">
-            <bean class="org.gridgain.grid.spi.failover.jobstealing.JobStealingFailoverSpi">
+            <bean class="org.apache.ignite.spi.failover.jobstealing.JobStealingFailoverSpi">
                 <property name="maximumFailoverAttempts" value="10"/>
             </bean>
         </property>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/config/load/dsi-load-base.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/load/dsi-load-base.xml b/modules/core/src/test/config/load/dsi-load-base.xml
index 8b49076..cb3009c 100644
--- a/modules/core/src/test/config/load/dsi-load-base.xml
+++ b/modules/core/src/test/config/load/dsi-load-base.xml
@@ -97,7 +97,7 @@
         </property>
 
         <property name="failoverSpi">
-            <bean class="org.gridgain.grid.spi.failover.always.AlwaysFailoverSpi">
+            <bean class="org.apache.ignite.spi.failover.always.AlwaysFailoverSpi">
                 <property name="maximumFailoverAttempts" value="1"/>
             </bean>
         </property>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiAttributesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiAttributesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiAttributesSelfTest.java
index 73567e2..4a9495e 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiAttributesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiAttributesSelfTest.java
@@ -12,7 +12,7 @@ package org.apache.ignite.spi.collision.jobstealing;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.spi.collision.*;
 import org.apache.ignite.spi.discovery.*;
-import org.gridgain.grid.spi.failover.jobstealing.*;
+import org.apache.ignite.spi.failover.jobstealing.*;
 import org.gridgain.grid.util.typedef.*;
 import org.gridgain.grid.util.typedef.internal.*;
 import org.gridgain.testframework.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiCustomTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiCustomTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiCustomTopologySelfTest.java
index e94a937..73c777c 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiCustomTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiCustomTopologySelfTest.java
@@ -14,7 +14,7 @@ import org.apache.ignite.lang.*;
 import org.gridgain.grid.*;
 import org.apache.ignite.spi.collision.*;
 import org.apache.ignite.spi.discovery.*;
-import org.gridgain.grid.spi.failover.jobstealing.*;
+import org.apache.ignite.spi.failover.jobstealing.*;
 import org.gridgain.grid.util.typedef.internal.*;
 import org.gridgain.testframework.*;
 import org.gridgain.testframework.junits.spi.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiSelfTest.java
index 3040afb..68bbc5b 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiSelfTest.java
@@ -14,7 +14,7 @@ import org.apache.ignite.lang.*;
 import org.gridgain.grid.*;
 import org.apache.ignite.spi.collision.*;
 import org.apache.ignite.spi.discovery.*;
-import org.gridgain.grid.spi.failover.jobstealing.*;
+import org.apache.ignite.spi.failover.jobstealing.*;
 import org.gridgain.grid.util.typedef.*;
 import org.gridgain.grid.util.typedef.internal.*;
 import org.gridgain.testframework.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiStartStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiStartStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiStartStopSelfTest.java
index b00f760..8d8a6b0 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiStartStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiStartStopSelfTest.java
@@ -10,7 +10,7 @@
 package org.apache.ignite.spi.collision.jobstealing;
 
 import org.gridgain.grid.spi.*;
-import org.gridgain.grid.spi.failover.jobstealing.*;
+import org.apache.ignite.spi.failover.jobstealing.*;
 import org.gridgain.grid.util.typedef.internal.*;
 import org.gridgain.testframework.*;
 import org.gridgain.testframework.junits.spi.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/GridMemoryEventStorageMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/GridMemoryEventStorageMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/GridMemoryEventStorageMultiThreadedSelfTest.java
new file mode 100644
index 0000000..bdc5996
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/GridMemoryEventStorageMultiThreadedSelfTest.java
@@ -0,0 +1,43 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.spi.eventstorage.memory;
+
+import org.apache.ignite.events.*;
+import org.gridgain.grid.util.typedef.*;
+import org.gridgain.testframework.*;
+import org.gridgain.testframework.junits.spi.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+/**
+ * Memory event storage load test.
+ */
+@GridSpiTest(spi = MemoryEventStorageSpi.class, group = "EventStorage SPI")
+public class GridMemoryEventStorageMultiThreadedSelfTest extends GridSpiAbstractTest<MemoryEventStorageSpi> {
+    /**
+     * @throws Exception If test failed
+     */
+    public void testMultiThreaded() throws Exception {
+        GridTestUtils.runMultiThreaded(new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                for (int i = 0; i < 100000; i++)
+                    getSpi().record(new IgniteDiscoveryEvent(null, "Test event", 1, null));
+
+                return null;
+            }
+        }, 10, "event-thread");
+
+        Collection<IgniteEvent> evts = getSpi().localEvents(F.<IgniteEvent>alwaysTrue());
+
+        info("Events count in memory: " + evts.size());
+
+        assert evts.size() <= 10000 : "Incorrect number of events: " + evts.size();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/GridMemoryEventStorageSpiConfigSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/GridMemoryEventStorageSpiConfigSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/GridMemoryEventStorageSpiConfigSelfTest.java
new file mode 100644
index 0000000..c808ddc
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/GridMemoryEventStorageSpiConfigSelfTest.java
@@ -0,0 +1,26 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.spi.eventstorage.memory;
+
+import org.gridgain.testframework.junits.spi.*;
+
+/**
+ * Memory event storage SPI config test.
+ */
+@GridSpiTest(spi = MemoryEventStorageSpi.class, group = "Event Storage SPI")
+public class GridMemoryEventStorageSpiConfigSelfTest extends GridSpiAbstractConfigTest<MemoryEventStorageSpi> {
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNegativeConfig() throws Exception {
+        checkNegativeSpiProperty(new MemoryEventStorageSpi(), "expireCount", 0);
+        checkNegativeSpiProperty(new MemoryEventStorageSpi(), "expireAgeMs", 0);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/GridMemoryEventStorageSpiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/GridMemoryEventStorageSpiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/GridMemoryEventStorageSpiSelfTest.java
new file mode 100644
index 0000000..3b4dc60
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/GridMemoryEventStorageSpiSelfTest.java
@@ -0,0 +1,130 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.spi.eventstorage.memory;
+
+import org.apache.ignite.events.*;
+import org.apache.ignite.lang.*;
+import org.gridgain.grid.util.typedef.*;
+import org.gridgain.testframework.junits.spi.*;
+
+import java.util.*;
+
+import static org.apache.ignite.events.IgniteEventType.*;
+
+/**
+ * Tests for {@link MemoryEventStorageSpi}.
+ */
+@GridSpiTest(spi = MemoryEventStorageSpi.class, group = "Event Storage SPI")
+public class GridMemoryEventStorageSpiSelfTest extends GridSpiAbstractTest<MemoryEventStorageSpi> {
+    /** */
+    private static final int EXPIRE_CNT = 100;
+
+    /**
+     * @return Maximum events queue size.
+     */
+    @GridSpiTestConfig
+    public long getExpireCount() {
+        return EXPIRE_CNT;
+    }
+
+    /**
+     * @return Events expiration time.
+     */
+    @GridSpiTestConfig
+    public long getExpireAgeMs() {
+        return 1000;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testMemoryEventStorage() throws Exception {
+        MemoryEventStorageSpi spi = getSpi();
+
+        IgnitePredicate<IgniteEvent> filter = F.alwaysTrue();
+
+        // Get all events.
+        Collection<IgniteEvent> evts = spi.localEvents(filter);
+
+        // Check.
+        assert evts != null : "Events can't be null.";
+        assert evts.isEmpty() : "Invalid events count.";
+
+        // Store.
+        spi.record(createEvent());
+
+        // Get all events.
+        evts = spi.localEvents(filter);
+
+        // Check stored events.
+        assert evts != null : "Events can't be null.";
+        assert evts.size() == 1 : "Invalid events count.";
+
+        // Sleep a bit more than expire age configuration property.
+        Thread.sleep(getExpireAgeMs() * 2);
+
+        // Get all events.
+        evts = spi.localEvents(filter);
+
+        // Check expired by age.
+        assert evts != null : "Events can't be null.";
+        assert evts.isEmpty() : "Invalid events count.";
+
+        // Clear.
+        spi.clearAll();
+
+        // Get all events.
+        evts = spi.localEvents(filter);
+
+        // Check events cleared.
+        assert evts != null : "Events can't be null.";
+        assert evts.isEmpty() : "Invalid events count.";
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @SuppressWarnings({"NullableProblems"})
+    public void testFilter() throws Exception {
+        MemoryEventStorageSpi spi = getSpi();
+
+        try {
+            spi.clearAll();
+
+            spi.setFilter(F.<IgniteEvent>alwaysFalse());
+
+            // This event should not record.
+            spi.record(createEvent());
+
+            spi.setFilter(null);
+
+            spi.record(createEvent());
+
+            // Get all events.
+            Collection<IgniteEvent> evts = spi.localEvents(F.<IgniteEvent>alwaysTrue());
+
+            assert evts != null : "Events can't be null.";
+            assert evts.size() == 1 : "Invalid events count: " + evts.size();
+        }
+        finally {
+            if (spi != null)
+                spi.clearAll();
+        }
+    }
+
+    /**
+     * @return Discovery event.
+     * @throws Exception If error occurred.
+     */
+    private IgniteEvent createEvent() throws Exception {
+        return new IgniteDiscoveryEvent(null, "Test Event", EVT_NODE_METRICS_UPDATED, null);
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/GridMemoryEventStorageSpiStartStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/GridMemoryEventStorageSpiStartStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/GridMemoryEventStorageSpiStartStopSelfTest.java
new file mode 100644
index 0000000..1339fe5
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/GridMemoryEventStorageSpiStartStopSelfTest.java
@@ -0,0 +1,21 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.spi.eventstorage.memory;
+
+import org.gridgain.grid.spi.*;
+import org.gridgain.testframework.junits.spi.*;
+
+/**
+ * Memory event storage SPI start-stop test.
+ */
+@GridSpiTest(spi = MemoryEventStorageSpi.class, group = "Event Storage SPI")
+public class GridMemoryEventStorageSpiStartStopSelfTest extends GridSpiStartStopAbstractTest<MemoryEventStorageSpi> {
+    // No-op.
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/package.html
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/package.html b/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/package.html
new file mode 100644
index 0000000..5cad80a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/eventstorage/memory/package.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--
+    @html.file.header
+    _________        _____ __________________        _____
+    __  ____/___________(_)______  /__  ____/______ ____(_)_______
+    _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+    / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+    \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+-->
+<html>
+<body>
+    <!-- Package description. -->
+    Contains internal tests or test related classes and interfaces.
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/java/org/apache/ignite/spi/failover/GridFailoverTestContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/failover/GridFailoverTestContext.java b/modules/core/src/test/java/org/apache/ignite/spi/failover/GridFailoverTestContext.java
new file mode 100644
index 0000000..cace3e2
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/failover/GridFailoverTestContext.java
@@ -0,0 +1,62 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.spi.failover;
+
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.compute.*;
+import org.gridgain.grid.*;
+
+import java.util.*;
+
+/**
+ * Failover test context.
+ */
+public class GridFailoverTestContext implements FailoverContext {
+    /** */
+    private static final Random RAND = new Random();
+
+    /** Grid task session. */
+    private final ComputeTaskSession taskSes;
+
+    /** Failed job result. */
+    private final ComputeJobResult jobRes;
+
+    /** */
+    public GridFailoverTestContext() {
+        taskSes = null;
+        jobRes = null;
+    }
+
+    /**
+     * Initializes failover context.
+     *
+     * @param taskSes Grid task session.
+     * @param jobRes Failed job result.
+     */
+    public GridFailoverTestContext(ComputeTaskSession taskSes, ComputeJobResult jobRes) {
+        this.taskSes = taskSes;
+        this.jobRes = jobRes;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ComputeTaskSession getTaskSession() {
+        return taskSes;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ComputeJobResult getJobResult() {
+        return jobRes;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ClusterNode getBalancedNode(List<ClusterNode> grid) throws GridException {
+        return grid.get(RAND.nextInt(grid.size()));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/java/org/apache/ignite/spi/failover/always/GridAlwaysFailoverSpiConfigSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/failover/always/GridAlwaysFailoverSpiConfigSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/failover/always/GridAlwaysFailoverSpiConfigSelfTest.java
new file mode 100644
index 0000000..2b75e16
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/failover/always/GridAlwaysFailoverSpiConfigSelfTest.java
@@ -0,0 +1,25 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.spi.failover.always;
+
+import org.gridgain.testframework.junits.spi.*;
+
+/**
+ * Always-failover SPI config test.
+ */
+@GridSpiTest(spi = AlwaysFailoverSpi.class, group = "Collision SPI")
+public class GridAlwaysFailoverSpiConfigSelfTest extends GridSpiAbstractConfigTest<AlwaysFailoverSpi> {
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNegativeConfig() throws Exception {
+        checkNegativeSpiProperty(new AlwaysFailoverSpi(), "maximumFailoverAttempts", -1);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/java/org/apache/ignite/spi/failover/always/GridAlwaysFailoverSpiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/failover/always/GridAlwaysFailoverSpiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/failover/always/GridAlwaysFailoverSpiSelfTest.java
new file mode 100644
index 0000000..46a0ab4
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/failover/always/GridAlwaysFailoverSpiSelfTest.java
@@ -0,0 +1,110 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.spi.failover.always;
+
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.compute.*;
+import org.gridgain.grid.*;
+import org.apache.ignite.spi.failover.*;
+import org.gridgain.testframework.*;
+import org.gridgain.testframework.junits.spi.*;
+
+import java.util.*;
+
+import static org.apache.ignite.spi.failover.always.AlwaysFailoverSpi.*;
+
+/**
+ * Always-failover SPI test.
+ */
+@GridSpiTest(spi = AlwaysFailoverSpi.class, group = "Failover SPI")
+public class GridAlwaysFailoverSpiSelfTest extends GridSpiAbstractTest<AlwaysFailoverSpi> {
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSingleNode() throws Exception {
+        AlwaysFailoverSpi spi = getSpi();
+
+        List<ClusterNode> nodes = new ArrayList<>();
+
+        ClusterNode node = new GridTestNode(UUID.randomUUID());
+
+        nodes.add(node);
+
+        node = spi.failover(new GridFailoverTestContext(new GridTestTaskSession(), new GridTestJobResult(node)), nodes);
+
+        assert node == null;
+    }
+
+    /**
+     * @throws Exception If test failed.
+     */
+    @SuppressWarnings("unchecked")
+    public void testTwoNodes() throws Exception {
+        AlwaysFailoverSpi spi = getSpi();
+
+        List<ClusterNode> nodes = new ArrayList<>();
+
+        nodes.add(new GridTestNode(UUID.randomUUID()));
+        nodes.add(new GridTestNode(UUID.randomUUID()));
+
+        ComputeJobResult jobRes = new GridTestJobResult(nodes.get(0));
+
+        ClusterNode node = spi.failover(new GridFailoverTestContext(new GridTestTaskSession(), jobRes), nodes);
+
+        assert node != null;
+        assert node.equals(nodes.get(1));
+
+        checkFailedNodes(jobRes, 1);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testMaxAttempts() throws Exception {
+        AlwaysFailoverSpi spi = getSpi();
+
+        spi.setMaximumFailoverAttempts(1);
+
+        List<ClusterNode> nodes = new ArrayList<>();
+
+        nodes.add(new GridTestNode(UUID.randomUUID()));
+        nodes.add(new GridTestNode(UUID.randomUUID()));
+
+        ComputeJobResult jobRes = new GridTestJobResult(nodes.get(0));
+
+        // First attempt.
+        ClusterNode node = spi.failover(new GridFailoverTestContext(new GridTestTaskSession(), jobRes), nodes);
+
+        assert node != null;
+        assert node.equals(nodes.get(1));
+
+        checkFailedNodes(jobRes, 1);
+
+        // Second attempt (exceeds default max attempts of 1).
+        node = spi.failover(new GridFailoverTestContext(new GridTestTaskSession(), jobRes), nodes);
+
+        assert node == null;
+
+        checkFailedNodes(jobRes, 1);
+    }
+
+    /**
+     * @param res Job result.
+     * @param cnt Failure count.
+     */
+    @SuppressWarnings("unchecked")
+    private void checkFailedNodes(ComputeJobResult res, int cnt) {
+        Collection<UUID> failedNodes =
+            (Collection<UUID>)res.getJobContext().getAttribute(FAILED_NODE_LIST_ATTR);
+
+        assert failedNodes != null;
+        assert failedNodes.size() == cnt;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/java/org/apache/ignite/spi/failover/always/GridAlwaysFailoverSpiStartStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/failover/always/GridAlwaysFailoverSpiStartStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/failover/always/GridAlwaysFailoverSpiStartStopSelfTest.java
new file mode 100644
index 0000000..c3c075a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/failover/always/GridAlwaysFailoverSpiStartStopSelfTest.java
@@ -0,0 +1,22 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.spi.failover.always;
+
+import org.gridgain.grid.spi.*;
+import org.apache.ignite.spi.failover.*;
+import org.gridgain.testframework.junits.spi.*;
+
+/**
+ * Always-failover SPI start-stop test.
+ */
+@GridSpiTest(spi = AlwaysFailoverSpi.class, group = "Failover SPI")
+public class GridAlwaysFailoverSpiStartStopSelfTest extends GridSpiStartStopAbstractTest<FailoverSpi> {
+    // No-op.
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/java/org/apache/ignite/spi/failover/always/package.html
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/failover/always/package.html b/modules/core/src/test/java/org/apache/ignite/spi/failover/always/package.html
new file mode 100644
index 0000000..5cad80a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/failover/always/package.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--
+    @html.file.header
+    _________        _____ __________________        _____
+    __  ____/___________(_)______  /__  ____/______ ____(_)_______
+    _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+    / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+    \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+-->
+<html>
+<body>
+    <!-- Package description. -->
+    Contains internal tests or test related classes and interfaces.
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/725526fa/modules/core/src/test/java/org/apache/ignite/spi/failover/jobstealing/GridJobStealingFailoverSpiConfigSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/failover/jobstealing/GridJobStealingFailoverSpiConfigSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/failover/jobstealing/GridJobStealingFailoverSpiConfigSelfTest.java
new file mode 100644
index 0000000..b2d655e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/failover/jobstealing/GridJobStealingFailoverSpiConfigSelfTest.java
@@ -0,0 +1,25 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.spi.failover.jobstealing;
+
+import org.gridgain.testframework.junits.spi.*;
+
+/**
+ * Job stealing failover SPI config test.
+ */
+@GridSpiTest(spi = JobStealingFailoverSpi.class, group = "Collision SPI")
+public class GridJobStealingFailoverSpiConfigSelfTest extends GridSpiAbstractConfigTest<JobStealingFailoverSpi> {
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNegativeConfig() throws Exception {
+        checkNegativeSpiProperty(new JobStealingFailoverSpi(), "maximumFailoverAttempts", -1);
+    }
+}