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 2015/02/02 20:14:20 UTC

incubator-ignite git commit: IGNITE-160 Added factory for SPI objects.

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-160 [created] 25b7f171f


IGNITE-160 Added factory for SPI objects.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/25b7f171
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/25b7f171
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/25b7f171

Branch: refs/heads/ignite-160
Commit: 25b7f171f159d6d01c535a68531babaa1856a9ed
Parents: ff7ee6d
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Mon Feb 2 22:12:50 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Mon Feb 2 22:14:21 2015 +0300

----------------------------------------------------------------------
 .../checkpoint/s3/S3CheckpointSpiFactory.java   | 114 +++++++++++++++
 .../org/apache/ignite/spi/IgniteSpiFactory.java |  28 ++++
 .../noop/NoopAuthenticationSpiFactory.java      |  72 +++++++++
 .../sharedfs/SharedFsCheckpointSpiFactory.java  |  86 +++++++++++
 .../memory/MemoryEventStorageSpiFactory.java    |  94 ++++++++++++
 .../always/AlwaysFailoverSpiFactory.java        |  60 ++++++++
 .../JobStealingFailoverSpiFactory.java          |  63 ++++++++
 .../failover/never/NeverFailoverSpiFactory.java |  68 +++++++++
 .../adaptive/AdaptiveCpuLoadProbeFactory.java   | 103 +++++++++++++
 .../AdaptiveJobCountLoadProbeFactory.java       |  51 +++++++
 .../AdaptiveLoadBalancingSpiFactory.java        |  62 ++++++++
 .../adaptive/AdaptiveLoadProbeFactory.java      |  82 +++++++++++
 .../AdaptiveProcessingTimeLoadProbeFactory.java |  52 +++++++
 .../RoundRobinLoadBalancingSpiFactory.java      |  64 ++++++++
 .../WeightedRandomLoadBalancingSpiFactory.java  |  77 ++++++++++
 .../noop/NoopSecureSessionSpiFactory.java       |  36 +++++
 .../swapspace/file/FileSwapSpaceSpiFactory.java | 146 +++++++++++++++++++
 .../swapspace/noop/NoopSwapSpaceSpiFactory.java |  39 +++++
 18 files changed, 1297 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiFactory.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiFactory.java b/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiFactory.java
new file mode 100644
index 0000000..25125d5
--- /dev/null
+++ b/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiFactory.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.checkpoint.s3;
+
+import com.amazonaws.*;
+import com.amazonaws.auth.*;
+import com.amazonaws.services.s3.*;
+import org.apache.ignite.internal.util.tostring.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.*;
+import org.apache.ignite.spi.checkpoint.*;
+
+/**
+ *
+ */
+@IgniteSpiMultipleInstancesSupport(true)
+public class S3CheckpointSpiFactory implements IgniteSpiFactory<S3CheckpointSpi> {
+    /** Listener. */
+    private CheckpointListener lsnr;
+
+    /** Prefix to use in bucket name generation. */
+    public static final String BUCKET_NAME_PREFIX = "gridgain-checkpoint-";
+
+    /** Suffix to use in bucket name generation. */
+    public static final String DFLT_BUCKET_NAME_SUFFIX = "default-bucket";
+
+    /** Client to interact with S3 storage. */
+    @GridToStringExclude
+    private AmazonS3 s3;
+
+    /** Bucket name suffix (set by user). */
+    private String bucketNameSuffix;
+
+    /** Bucket name (generated). */
+    private String bucketName;
+
+    /** Amazon client configuration. */
+    private ClientConfiguration cfg;
+
+    /** AWS Credentials. */
+    @GridToStringExclude
+    private AWSCredentials cred;
+
+    /** {@inheritDoc} */
+    @Override public S3CheckpointSpi createSpi() {
+        S3CheckpointSpi spi = new S3CheckpointSpi();
+
+        spi.setAwsCredentials(cred);
+        spi.setBucketNameSuffix(bucketNameSuffix);
+        spi.setCheckpointListener(lsnr);
+        spi.setClientConfiguration(cfg);
+
+        return spi;
+    }
+
+     /**
+     * Sets bucket name suffix.
+     *
+     * @param bucketNameSuffix Bucket name suffix.
+     */
+    @IgniteSpiConfiguration(optional = true)
+    public void setBucketNameSuffix(String bucketNameSuffix) {
+        this.bucketNameSuffix = bucketNameSuffix;
+    }
+
+    /**
+     * Sets Amazon client configuration.
+     * <p>
+     * For details refer to Amazon S3 API reference.
+     *
+     * @param cfg Amazon client configuration.
+     */
+    @IgniteSpiConfiguration(optional = true)
+    public void setClientConfiguration(ClientConfiguration cfg) {
+        this.cfg = cfg;
+    }
+
+    /**
+     * Sets AWS credentials.
+     * <p>
+     * For details refer to Amazon S3 API reference.
+     *
+     * @param cred AWS credentials.
+     */
+    @IgniteSpiConfiguration(optional = false)
+    public void setAwsCredentials(AWSCredentials cred) {
+        this.cred = cred;
+    }
+
+    /** {@inheritDoc} */
+    public void setCheckpointListener(CheckpointListener lsnr) {
+        this.lsnr = lsnr;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(S3CheckpointSpiFactory.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiFactory.java
new file mode 100644
index 0000000..7ceb35b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiFactory.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi;
+
+/**
+ * TODO: Add javadoc
+ */
+public interface IgniteSpiFactory<T extends IgniteSpi> {
+    /**
+     * @return SPI object.
+     */
+    public T createSpi();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/authentication/noop/NoopAuthenticationSpiFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/authentication/noop/NoopAuthenticationSpiFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/authentication/noop/NoopAuthenticationSpiFactory.java
new file mode 100644
index 0000000..bc615fc
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/authentication/noop/NoopAuthenticationSpiFactory.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.authentication.noop;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.*;
+
+/**
+ * Default implementation of the authentication SPI which permits any request.
+ * <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 no optional configuration parameters.
+ * <h2 class="header">Java Example</h2>
+ * GridNoopAuthenticationSpi is used by default and has no parameters to be explicitly configured.
+ * <pre name="code" class="java">
+ * GridNoopAuthenticationSpi authSpi = new GridNoopAuthenticationSpi();
+ *
+ * GridConfiguration cfg = new GridConfiguration();
+ *
+ * // Override default authentication SPI.
+ * cfg.setAuthenticationSpi(authSpi);
+ *
+ * // Start grid.
+ * GridGain.start(cfg);
+ * </pre>
+ * <h2 class="header">Spring Example</h2>
+ * GridNoopAuthenticationSpi 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="authenticationSpi"&gt;
+ *             &lt;bean class="org.gridgain.grid.spi.authentication.noop.GridNoopAuthenticationSpi"/&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>
+ */
+@IgniteSpiNoop
+@IgniteSpiMultipleInstancesSupport(true)
+public class NoopAuthenticationSpiFactory implements IgniteSpiFactory<NoopAuthenticationSpi>{
+    /** {@inheritDoc} */
+    @Override public NoopAuthenticationSpi createSpi() {
+        return new NoopAuthenticationSpi();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(NoopAuthenticationSpiFactory.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpiFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpiFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpiFactory.java
new file mode 100644
index 0000000..fd54365
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpiFactory.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.checkpoint.sharedfs;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.SB;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.IgniteMarshaller;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.IgniteLoggerResource;
+import org.apache.ignite.spi.*;
+import org.apache.ignite.spi.checkpoint.CheckpointListener;
+import org.apache.ignite.spi.checkpoint.CheckpointSpi;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ *
+ */
+@IgniteSpiMultipleInstancesSupport(true)
+@IgniteSpiConsistencyChecked(optional = false)
+public class SharedFsCheckpointSpiFactory implements IgniteSpiFactory<SharedFsCheckpointSpi> {
+    /** List of checkpoint directories where all files are stored. */
+    private Collection<String> dirPaths = new ArrayList<>();
+
+    /** Listener. */
+    private CheckpointListener lsnr;
+
+    /** {@inheritDoc} */
+    @Override public SharedFsCheckpointSpi createSpi() {
+        SharedFsCheckpointSpi spi = new SharedFsCheckpointSpi();
+
+        spi.setCheckpointListener(lsnr);
+        spi.setDirectoryPaths(dirPaths);
+
+        return spi;
+    }
+
+    /**
+     * Sets path to a shared directory where checkpoints will be stored. The
+     * path can either be absolute or relative to {@code IGNITE_HOME} system
+     * or environment variable.
+     *
+     * @param dirPaths Absolute or GridGain installation home folder relative path where checkpoints
+     * will be stored.
+     */
+    @IgniteSpiConfiguration(optional = true)
+    public void setDirectoryPaths(Collection<String> dirPaths) {
+        A.ensure(!F.isEmpty(dirPaths), "!F.isEmpty(dirPaths)");
+
+        this.dirPaths = dirPaths;
+    }
+
+    public void setCheckpointListener(CheckpointListener lsnr) {
+        this.lsnr = lsnr;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(SharedFsCheckpointSpiFactory.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/memory/MemoryEventStorageSpiFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/memory/MemoryEventStorageSpiFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/memory/MemoryEventStorageSpiFactory.java
new file mode 100644
index 0000000..5100a2e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/memory/MemoryEventStorageSpiFactory.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.eventstorage.memory;
+
+import org.apache.ignite.events.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.spi.*;
+
+/**
+ *
+ */
+public class MemoryEventStorageSpiFactory implements IgniteSpiFactory<MemoryEventStorageSpi> {
+    /** 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;
+
+    /** Event time-to-live value in milliseconds. */
+    private long expireAgeMs = DFLT_EXPIRE_AGE_MS;
+
+    /** Maximum queue size. */
+    private long expireCnt = DFLT_EXPIRE_COUNT;
+
+    /** Configured event predicate filter. */
+    private IgnitePredicate<IgniteEvent> filter;
+
+    /** {@inheritDoc} */
+    @Override public MemoryEventStorageSpi createSpi() {
+        MemoryEventStorageSpi spi = new MemoryEventStorageSpi();
+
+        spi.setExpireAgeMs(expireAgeMs);
+        spi.setExpireCount(expireCnt);
+        spi.setFilter(filter);
+
+        return spi;
+    }
+
+    /**
+     * Sets filter for events to be recorded.
+     *
+     * @param filter Filter to use.
+     */
+    @IgniteSpiConfiguration(optional = true)
+    public void setFilter(IgnitePredicate<IgniteEvent> filter) {
+        this.filter = filter;
+    }
+
+    /**
+     * 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 String toString() {
+        return S.toString(MemoryEventStorageSpiFactory.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpiFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpiFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpiFactory.java
new file mode 100644
index 0000000..6f9c31d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpiFactory.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.failover.always;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.*;
+
+/**
+ * TODO:
+ */
+@IgniteSpiMultipleInstancesSupport(true)
+@IgniteSpiConsistencyChecked(optional = true)
+public class AlwaysFailoverSpiFactory implements IgniteSpiFactory<AlwaysFailoverSpi> {
+    /** 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;
+
+    /** Maximum number of attempts to execute a failed job on another node. */
+    private int maxFailoverAttempts = DFLT_MAX_FAILOVER_ATTEMPTS;
+
+    /** {@inheritDoc} */
+    @Override public AlwaysFailoverSpi createSpi() {
+        AlwaysFailoverSpi spi = new AlwaysFailoverSpi();
+
+        spi.setMaximumFailoverAttempts(maxFailoverAttempts);
+
+        return spi;
+    }
+
+    /**
+     * 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 String toString() {
+        return S.toString(AlwaysFailoverSpiFactory.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/failover/jobstealing/JobStealingFailoverSpiFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/failover/jobstealing/JobStealingFailoverSpiFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/failover/jobstealing/JobStealingFailoverSpiFactory.java
new file mode 100644
index 0000000..9126725
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/failover/jobstealing/JobStealingFailoverSpiFactory.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.failover.jobstealing;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.*;
+/**
+ *
+ */
+@IgniteSpiMultipleInstancesSupport(true)
+@IgniteSpiConsistencyChecked(optional = true)
+public class JobStealingFailoverSpiFactory implements IgniteSpiFactory<JobStealingFailoverSpi> {
+    /** 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;
+
+    /** Maximum number of attempts to execute a failed job on another node. */
+    private int maxFailoverAttempts = DFLT_MAX_FAILOVER_ATTEMPTS;
+
+    /** {@inheritDoc} */
+    @Override public JobStealingFailoverSpi createSpi() {
+        JobStealingFailoverSpi spi = new JobStealingFailoverSpi();
+
+        spi.setMaximumFailoverAttempts(maxFailoverAttempts);
+
+        return spi;
+    }
+
+    /**
+     * 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 String toString() {
+        return S.toString(JobStealingFailoverSpiFactory.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/failover/never/NeverFailoverSpiFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/failover/never/NeverFailoverSpiFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/failover/never/NeverFailoverSpiFactory.java
new file mode 100644
index 0000000..09de372
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/failover/never/NeverFailoverSpiFactory.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.failover.never;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.*;
+
+/**
+ * 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.apache.ignite.spi.failover.FailoverSpi#failover(org.apache.ignite.spi.failover.FailoverContext, java.util.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.apache.ignite.spi.failover.FailoverSpi
+ */
+@IgniteSpiMultipleInstancesSupport(true)
+public class NeverFailoverSpiFactory implements IgniteSpiFactory<NeverFailoverSpi> {
+    /** {@inheritDoc} */
+    @Override public NeverFailoverSpi createSpi() {
+        return new NeverFailoverSpi();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(NeverFailoverSpiFactory.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveCpuLoadProbeFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveCpuLoadProbeFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveCpuLoadProbeFactory.java
new file mode 100644
index 0000000..6816874
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveCpuLoadProbeFactory.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.loadbalancing.adaptive;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+/**
+ *
+ */
+public class AdaptiveCpuLoadProbeFactory implements AdaptiveLoadProbeFactory<AdaptiveCpuLoadProbe> {
+    /** Flag indicating whether to use average CPU load vs. current. */
+    private boolean useAvg = true;
+
+    /**
+     * Flag indicating whether to divide each node's CPU load
+     * by the number of processors on that node.
+     */
+    private boolean useProcs = true;
+
+    /**
+     * Coefficient of every CPU processor. By default it is {@code 1}, but
+     * in some environments every processor may not be adding 100% of processing
+     * power. For example, if you are using multi-core CPU's, then addition of
+     * every core would probably result in about 75% of extra CPU power, and hence
+     * you would set this coefficient to {@code 0.75} .
+     */
+    private double procCoefficient = 1;
+
+    /** {@inheritDoc} */
+    @Override public AdaptiveCpuLoadProbe createProbe() {
+        AdaptiveCpuLoadProbe probe = new AdaptiveCpuLoadProbe();
+
+        probe.setProcessorCoefficient(procCoefficient);
+        probe.setUseAverage(useAvg);
+        probe.setUseProcessors(useProcs);
+
+        return probe;
+    }
+
+    /**
+     * Sets flag indicating whether to use average CPU load vs. current.
+     * If not explicitly set, then default value is {@code true}.
+     *
+     * @param useAvg Flag indicating whether to use average CPU load vs. current.
+     */
+    public void setUseAverage(boolean useAvg) {
+        this.useAvg = useAvg;
+    }
+
+    /**
+     * Sets flag indicating whether to use average CPU load vs. current
+     * (default is {@code true}).
+     * <p>
+     * Since CPU load on multi-processor boxes shows medium load of multiple CPU's it
+     * usually means that the remaining capacity is proportional to the number of
+     * CPU's (or cores) on the node.
+     * <p>
+     * If not explicitly set, then default value is {@code true}.
+     *
+     * @param useProcs Flag indicating whether to divide each node's CPU load
+     *      by the number of processors on that node (default is {@code true}).
+     */
+    public void setUseProcessors(boolean useProcs) {
+        this.useProcs = useProcs;
+    }
+
+    /**
+     * Sets coefficient of every CPU processor. By default it is {@code 1}, but
+     * in some environments every processor may not be adding 100% of processing
+     * power. For example, if you are using multi-core CPU's, then addition of
+     * every core would probably result in about 75% of extra CPU power, and hence
+     * you would set this coefficient to {@code 0.75} .
+     * <p>
+     * This value is ignored if {@link #setUseProcessors(boolean)} is set to {@code false}.
+     *
+     * @param procCoefficient Coefficient of every CPU processor.
+     */
+    public void setProcessorCoefficient(double procCoefficient) {
+        A.ensure(procCoefficient > 0, "procCoefficient > 0");
+
+        this.procCoefficient = procCoefficient;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(AdaptiveCpuLoadProbeFactory.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveJobCountLoadProbeFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveJobCountLoadProbeFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveJobCountLoadProbeFactory.java
new file mode 100644
index 0000000..ab083ca
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveJobCountLoadProbeFactory.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.loadbalancing.adaptive;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+/**
+ *
+ */
+public class AdaptiveJobCountLoadProbeFactory implements AdaptiveLoadProbeFactory<AdaptiveJobCountLoadProbe> {
+    /** Flag indicating whether to use average CPU load vs. current. */
+    private boolean useAvg = true;
+
+    /** {@inheritDoc} */
+    @Override public AdaptiveJobCountLoadProbe createProbe() {
+        AdaptiveJobCountLoadProbe probe = new AdaptiveJobCountLoadProbe();
+
+        probe.setUseAverage(useAvg);
+
+        return probe;
+    }
+
+    /**
+     * Sets flag indicating whether to use average job counts vs. current.
+     *
+     * @param useAvg Flag indicating whether to use average job counts vs. current.
+     */
+    public void setUseAverage(boolean useAvg) {
+        this.useAvg = useAvg;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(AdaptiveJobCountLoadProbeFactory.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpiFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpiFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpiFactory.java
new file mode 100644
index 0000000..e054602
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpiFactory.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.loadbalancing.adaptive;
+
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.*;
+
+/**
+ *
+ */
+@IgniteSpiMultipleInstancesSupport(true)
+public class AdaptiveLoadBalancingSpiFactory implements IgniteSpiFactory<AdaptiveLoadBalancingSpi> {
+    /** */
+    private AdaptiveLoadProbeFactory probeFactory = new AdaptiveCpuLoadProbeFactory();
+
+    /**
+     * @return SPI object.
+     */
+    @Override
+    public AdaptiveLoadBalancingSpi createSpi() {
+        AdaptiveLoadBalancingSpi spi = new AdaptiveLoadBalancingSpi();
+
+        spi.setLoadProbe(probeFactory.createProbe());
+
+        return null;
+    }
+
+    /**
+     * Sets implementation of node load probe. By default {@link AdaptiveProcessingTimeLoadProbe}
+     * is used which proportionally distributes load based on the average job execution
+     * time on every node.
+     *
+     * @param probeFactory Implementation of node load probe
+     */
+    @IgniteSpiConfiguration(optional = true)
+    public void setLoadProbe(AdaptiveLoadProbeFactory probeFactory) {
+        A.ensure(probeFactory != null, "probe != null");
+
+        this.probeFactory = probeFactory;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(AdaptiveLoadBalancingSpiFactory.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadProbeFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadProbeFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadProbeFactory.java
new file mode 100644
index 0000000..4d0a35d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadProbeFactory.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.loadbalancing.adaptive;
+
+/**
+ * Pluggable implementation of node load probing. Implementations
+ * of this can be configured to be used with {@link org.apache.ignite.spi.loadbalancing.adaptive.AdaptiveLoadBalancingSpi}
+ * by setting {@link org.apache.ignite.spi.loadbalancing.adaptive.AdaptiveLoadBalancingSpi#setLoadProbe(org.apache.ignite.spi.loadbalancing.adaptive.AdaptiveLoadProbeFactory)}
+ * configuration parameter.
+ * <p>
+ * Note that if {@link #getLoad(org.apache.ignite.cluster.ClusterNode, int)} returns a value of {@code 0},
+ * then implementation will assume that load value is simply not available and
+ * will try to calculate an average of load values for other nodes. If such
+ * average cannot be obtained (all node load values are {@code 0}), then a value
+ * of {@code 1} will be used.
+ * <p>
+ * By default, {@link org.apache.ignite.spi.loadbalancing.adaptive.AdaptiveCpuLoadProbe} probing implementation is used.
+ * <p>
+ * <h1 class="header">Example</h1>
+ * Here is an example of how probing can be implemented to use
+ * number of active and waiting jobs as probing mechanism:
+ * <pre name="code" class="java">
+ * public class FooBarLoadProbe implements GridAdaptiveLoadProbe {
+ *     // Flag indicating whether to use average value or current.
+ *     private int useAvg = true;
+ *
+ *     public FooBarLoadProbe(boolean useAvg) {
+ *         this.useAvg = useAvg;
+ *     }
+ *
+ *     // Calculate load based on number of active and waiting jobs.
+ *     public double getLoad(GridNode node, int jobsSentSinceLastUpdate) {
+ *         GridNodeMetrics metrics = node.getMetrics();
+ *
+ *         if (useAvg) {
+ *             double load = metrics.getAverageActiveJobs() + metrics.getAverageWaitingJobs();
+ *
+ *             if (load > 0) {
+ *                 return load;
+ *             }
+ *         }
+ *
+ *         return metrics.getCurrentActiveJobs() + metrics.getCurrentWaitingJobs();
+ *     }
+ * }
+ * </pre>
+ * Below is an example of how a probe shown above would be configured with {@link org.apache.ignite.spi.loadbalancing.adaptive.AdaptiveLoadBalancingSpi}
+ * SPI:
+ * <pre name="code" class="xml">
+ * &lt;property name="loadBalancingSpi"&gt;
+ *     &lt;bean class="org.gridgain.grid.spi.loadBalancing.adaptive.GridAdaptiveLoadBalancingSpi"&gt;
+ *         &lt;property name="loadProbe"&gt;
+ *             &lt;bean class="foo.bar.FooBarLoadProbe"&gt;
+ *                 &lt;constructor-arg value="true"/&gt;
+ *             &lt;/bean&gt;
+ *         &lt;/property&gt;
+ *     &lt;/bean&gt;
+ * &lt;/property&gt;
+ * </pre>
+ */
+public interface AdaptiveLoadProbeFactory<T extends AdaptiveLoadProbe> {
+    /**
+     *
+     * @return AdaptiveLoadProbe
+     */
+    public T createProbe();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveProcessingTimeLoadProbeFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveProcessingTimeLoadProbeFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveProcessingTimeLoadProbeFactory.java
new file mode 100644
index 0000000..888b028
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveProcessingTimeLoadProbeFactory.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.loadbalancing.adaptive;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+/**
+ *
+ */
+public class AdaptiveProcessingTimeLoadProbeFactory implements
+    AdaptiveLoadProbeFactory<AdaptiveProcessingTimeLoadProbe> {
+    /** Flag indicating whether to use average execution time vs. current. */
+    private boolean useAvg = true;
+
+    /** {@inheritDoc} */
+    @Override public AdaptiveProcessingTimeLoadProbe createProbe() {
+        AdaptiveProcessingTimeLoadProbe probe = new AdaptiveProcessingTimeLoadProbe();
+
+        probe.setUseAverage(useAvg);
+
+        return probe;
+    }
+
+    /**
+     * Sets flag indicating whether to use average execution time vs. current.
+     *
+     * @param useAvg Flag indicating whether to use average execution time vs. current.
+     */
+    public void setUseAverage(boolean useAvg) {
+        this.useAvg = useAvg;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(AdaptiveProcessingTimeLoadProbeFactory.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpiFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpiFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpiFactory.java
new file mode 100644
index 0000000..a854bb1
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpiFactory.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.loadbalancing.roundrobin;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.*;
+
+/**
+ *
+ */
+@IgniteSpiMultipleInstancesSupport(true)
+public class RoundRobinLoadBalancingSpiFactory implements IgniteSpiFactory<RoundRobinLoadBalancingSpi> {
+    /** */
+    private boolean isPerTask;
+
+    /** {@inheritDoc} */
+    @Override public RoundRobinLoadBalancingSpi createSpi() {
+        RoundRobinLoadBalancingSpi spi = new RoundRobinLoadBalancingSpi();
+
+        spi.setPerTask(isPerTask);
+
+        return spi;
+    }
+
+    /**
+     * Configuration parameter indicating whether a new round robin order should be
+     * created for every task. If {@code true} then load balancer is guaranteed
+     * to iterate through nodes sequentially for every task - so as long as number
+     * of jobs is less than or equal to the number of nodes, jobs are guaranteed to
+     * be assigned to unique nodes. If {@code false} then one round-robin order
+     * will be maintained for all tasks, so when tasks execute concurrently, it
+     * is possible for more than one job within task to be assigned to the same
+     * node.
+     * <p>
+     * Default is {@code false}.
+     *
+     * @param isPerTask Configuration parameter indicating whether a new round robin order should
+     *      be created for every task. Default is {@code false}.
+     */
+    @IgniteSpiConfiguration(optional = true)
+    public void setPerTask(boolean isPerTask) {
+        this.isPerTask = isPerTask;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(RoundRobinLoadBalancingSpiFactory.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpiFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpiFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpiFactory.java
new file mode 100644
index 0000000..7863001
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpiFactory.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.loadbalancing.weightedrandom;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.*;
+
+/**
+ *
+ */
+@IgniteSpiMultipleInstancesSupport(true)
+@IgniteSpiConsistencyChecked(optional = true)
+public class WeightedRandomLoadBalancingSpiFactory implements IgniteSpiFactory<WeightedRandomLoadBalancingSpi> {
+    /** Default weight assigned to every node if explicit one is not provided (value is {@code 10}). */
+    public static final int DFLT_NODE_WEIGHT = 10;
+
+    /** */
+    private boolean isUseWeights;
+
+    /** Weight of this node. */
+    private int nodeWeight = DFLT_NODE_WEIGHT;
+
+    /** {@inheritDoc} */
+    @Override public WeightedRandomLoadBalancingSpi createSpi() {
+        WeightedRandomLoadBalancingSpi spi = new WeightedRandomLoadBalancingSpi();
+
+        spi.setNodeWeight(nodeWeight);
+        spi.setUseWeights(isUseWeights);
+
+        return spi;
+    }
+
+    /**
+     * Sets a flag to indicate whether node weights should be checked when
+     * doing random load balancing. Default value is {@code false} which
+     * means that node weights are disregarded for load balancing logic.
+     *
+     * @param isUseWeights If {@code true} then random load is distributed according
+     *      to node weights.
+     */
+    @IgniteSpiConfiguration(optional = true)
+    public void setUseWeights(boolean isUseWeights) {
+        this.isUseWeights = isUseWeights;
+    }
+
+    /**
+     * Sets weight of this node. Nodes with more processing capacity
+     * should be assigned proportionally larger weight. Default value
+     * is {@link #DFLT_NODE_WEIGHT} and is equal for all nodes.
+     *
+     * @param nodeWeight Weight of this node.
+     */
+    @IgniteSpiConfiguration(optional = true)
+    public void setNodeWeight(int nodeWeight) {
+        this.nodeWeight = nodeWeight;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(WeightedRandomLoadBalancingSpiFactory.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/securesession/noop/NoopSecureSessionSpiFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/securesession/noop/NoopSecureSessionSpiFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/securesession/noop/NoopSecureSessionSpiFactory.java
new file mode 100644
index 0000000..2054924
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/securesession/noop/NoopSecureSessionSpiFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.securesession.noop;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.*;
+
+/**
+ *
+ */
+public class NoopSecureSessionSpiFactory implements IgniteSpiFactory<NoopSecureSessionSpi> {
+    /** {@inheritDoc} */
+    @Override public NoopSecureSessionSpi createSpi() {
+        return new NoopSecureSessionSpi();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(NoopSecureSessionSpiFactory.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpiFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpiFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpiFactory.java
new file mode 100644
index 0000000..68b56f5
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpiFactory.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.swapspace.file;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.*;
+import org.apache.ignite.spi.swapspace.*;
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+/**
+ *
+ */
+@IgniteSpiMultipleInstancesSupport(true)
+public class FileSwapSpaceSpiFactory implements IgniteSpiFactory<FileSwapSpaceSpi> {
+    /**
+     * Default base directory. Note that this path is relative to {@code IGNITE_HOME/work} folder
+     * if {@code IGNITE_HOME} system or environment variable specified, otherwise it is relative to
+     * {@code work} folder under system {@code java.io.tmpdir} folder.
+     *
+     * @see org.apache.ignite.configuration.IgniteConfiguration#getWorkDirectory()
+     */
+    public static final String DFLT_BASE_DIR = "swapspace";
+
+    /** Default maximum sparsity. */
+    public static final float DFLT_MAX_SPARSITY = 0.5f;
+
+    /** Default write buffer size in bytes. */
+    public static final int DFLT_BUF_SIZE = 64 * 1024;
+
+    /** Default write queue size in bytes. */
+    public static final int DFLT_QUE_SIZE = 1024 * 1024;
+
+    /** Base directory. */
+    private String baseDir = DFLT_BASE_DIR;
+
+    /** Maximum sparsity. */
+    private float maxSparsity = DFLT_MAX_SPARSITY;
+
+    /** Eviction listener. */
+    private volatile SwapSpaceSpiListener evictLsnr;
+
+    /** Directory. */
+    private File dir;
+
+    /** Write buffer size. */
+    private int writeBufSize = DFLT_BUF_SIZE;
+
+    /** Max write queue size in bytes. */
+    private int maxWriteQueSize = DFLT_QUE_SIZE;
+
+    /** Read stripes number. */
+    private int readStripesNum = -1;
+
+    /** {@inheritDoc} */
+    @Override public FileSwapSpaceSpi createSpi() {
+        FileSwapSpaceSpi spi = new FileSwapSpaceSpi();
+
+        spi.setBaseDirectory(baseDir);
+        spi.setListener(evictLsnr);
+        spi.setMaximumSparsity(maxSparsity);
+        spi.setMaxWriteQueueSize(maxWriteQueSize);
+        spi.setReadStripesNumber(readStripesNum);
+        spi.setWriteBufferSize(writeBufSize);
+
+        return spi;
+    }
+
+    /**
+     * Sets base directory.
+     *
+     * @param baseDir Base directory.
+     */
+    @IgniteSpiConfiguration(optional = true)
+    public void setBaseDirectory(String baseDir) {
+        this.baseDir = baseDir;
+    }
+
+    /**
+     * Sets eviction listener to receive notifications on evicted swap entries.
+     *
+     * @param evictLsnr Eviction listener ({@code null} to stop receiving notifications).
+     */
+    public void setListener(@Nullable SwapSpaceSpiListener evictLsnr) {
+        this.evictLsnr = evictLsnr;
+    }
+
+
+    /**
+     * Sets maximum sparsity. This property defines maximum acceptable wasted file space to whole file size ratio.
+     * When this ratio becomes higher than specified number compacting thread starts working.
+     *
+     * @param maxSparsity Maximum sparsity. Must be between 0 and 1, default is {@link #DFLT_MAX_SPARSITY}.
+     */
+    public void setMaximumSparsity(float maxSparsity) {
+        this.maxSparsity = maxSparsity;
+    }
+
+    /**
+     * Sets write buffer size in bytes. Write to disk occurs only when this buffer is full. Default is
+     * {@link #DFLT_BUF_SIZE}.
+     *
+     * @param writeBufSize Write buffer size in bytes.
+     */
+    public void setWriteBufferSize(int writeBufSize) {
+        this.writeBufSize = writeBufSize;
+    }
+
+    /**
+     * Sets max write queue size in bytes. If there are more values are waiting for being written to disk then specified
+     * size. Default is {@link #DFLT_QUE_SIZE}.
+     *
+     * @param maxWriteQueSize Max write queue size in bytes.
+     */
+    public void setMaxWriteQueueSize(int maxWriteQueSize) {
+        this.maxWriteQueSize = maxWriteQueSize;
+    }
+
+    /**
+     * Sets read stripe size. Defines number of file channels to be used concurrently. Default is equal to number of
+     * CPU cores available to this JVM.
+     *
+     * @param readStripesNum Read stripe number.
+     */
+    public void setReadStripesNumber(int readStripesNum) {
+        A.ensure(readStripesNum == -1 || (readStripesNum & (readStripesNum - 1)) == 0,
+            "readStripesNum must be positive and power of two");
+
+        this.readStripesNum = readStripesNum;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25b7f171/modules/core/src/main/java/org/apache/ignite/spi/swapspace/noop/NoopSwapSpaceSpiFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/swapspace/noop/NoopSwapSpaceSpiFactory.java b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/noop/NoopSwapSpaceSpiFactory.java
new file mode 100644
index 0000000..799b367
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/noop/NoopSwapSpaceSpiFactory.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.swapspace.noop;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.*;
+
+/**
+ * No-op implementation of {@link org.apache.ignite.spi.swapspace.SwapSpaceSpi}.
+ * Exists for testing and benchmarking purposes.
+ */
+@IgniteSpiNoop
+@IgniteSpiMultipleInstancesSupport(true)
+public class NoopSwapSpaceSpiFactory implements IgniteSpiFactory<NoopSwapSpaceSpi> {
+    /** {@inheritDoc} */
+    @Override public NoopSwapSpaceSpi createSpi() {
+        return new NoopSwapSpaceSpi();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(NoopSwapSpaceSpiFactory.class, this);
+    }
+}