ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [09/50] [abbrv] ignite git commit: IGNITE-4564: All setters on public configuration now return "this" instance to allow convenient chaining. This closes #1449.
Date Thu, 06 Apr 2017 09:32:00 GMT
http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java
index 7afaaee..cfd4fc7 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java
@@ -50,6 +50,7 @@ import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiContext;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.loadbalancing.LoadBalancingSpi;
 import org.jetbrains.annotations.Nullable;
@@ -254,8 +255,7 @@ import static org.apache.ignite.events.EventType.EVT_TASK_FINISHED;
  * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
  */
 @IgniteSpiMultipleInstancesSupport(true)
-public class AdaptiveLoadBalancingSpi extends IgniteSpiAdapter implements LoadBalancingSpi,
-    AdaptiveLoadBalancingSpiMBean {
+public class AdaptiveLoadBalancingSpi extends IgniteSpiAdapter implements LoadBalancingSpi
{
     /** Random number generator. */
     private static final Random RAND = new Random();
 
@@ -279,8 +279,12 @@ public class AdaptiveLoadBalancingSpi extends IgniteSpiAdapter implements
LoadBa
     /** */
     private final ReadWriteLock rwLock = new ReentrantReadWriteLock();
 
-    /** {@inheritDoc} */
-    @Override public String getLoadProbeFormatted() {
+    /**
+     * Gets text description of current load probing implementation used.
+     *
+     * @return Text description of current load probing implementation used.
+     */
+    public String getLoadProbeFormatted() {
         return probe.toString();
     }
 
@@ -290,12 +294,15 @@ public class AdaptiveLoadBalancingSpi extends IgniteSpiAdapter implements
LoadBa
      * time on every node.
      *
      * @param probe Implementation of node load probe
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setLoadProbe(AdaptiveLoadProbe probe) {
+    public AdaptiveLoadBalancingSpi setLoadProbe(AdaptiveLoadProbe probe) {
         A.ensure(probe != null, "probe != null");
 
         this.probe = probe;
+
+        return this;
     }
 
     /** {@inheritDoc} */
@@ -307,7 +314,8 @@ public class AdaptiveLoadBalancingSpi extends IgniteSpiAdapter implements
LoadBa
         if (log.isDebugEnabled())
             log.debug(configInfo("loadProbe", probe));
 
-        registerMBean(igniteInstanceName, this, AdaptiveLoadBalancingSpiMBean.class);
+        registerMBean(igniteInstanceName, new AdaptiveLoadBalancingSpiMBeanImpl(this),
+            AdaptiveLoadBalancingSpiMBean.class);
 
         // Ack ok start.
         if (log.isDebugEnabled())
@@ -606,7 +614,30 @@ public class AdaptiveLoadBalancingSpi extends IgniteSpiAdapter implements
LoadBa
     }
 
     /** {@inheritDoc} */
+    @Override public AdaptiveLoadBalancingSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(AdaptiveLoadBalancingSpi.class, this);
     }
+
+    /**
+     * MBean implementation for AdaptiveLoadBalancingSpi.
+     */
+    private class AdaptiveLoadBalancingSpiMBeanImpl extends IgniteSpiMBeanAdapter
+        implements AdaptiveLoadBalancingSpiMBean {
+        /** {@inheritDoc} */
+        AdaptiveLoadBalancingSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getLoadProbeFormatted() {
+            return AdaptiveLoadBalancingSpi.this.getLoadProbeFormatted();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java
index 40af99a..5472811 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java
@@ -39,6 +39,7 @@ import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiContext;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.loadbalancing.LoadBalancingSpi;
 import org.jetbrains.annotations.Nullable;
@@ -172,8 +173,7 @@ import static org.apache.ignite.events.EventType.EVT_TASK_FINISHED;
  * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
  */
 @IgniteSpiMultipleInstancesSupport(true)
-public class RoundRobinLoadBalancingSpi extends IgniteSpiAdapter implements LoadBalancingSpi,
-    RoundRobinLoadBalancingSpiMBean {
+public class RoundRobinLoadBalancingSpi extends IgniteSpiAdapter implements LoadBalancingSpi
{
     /** Grid logger. */
     @LoggerResource
     private IgniteLogger log;
@@ -204,8 +204,13 @@ public class RoundRobinLoadBalancingSpi extends IgniteSpiAdapter implements
Load
         }
     };
 
-    /** {@inheritDoc} */
-    @Override public boolean isPerTask() {
+    /**
+     * See {@link #setPerTask(boolean)}.
+     *
+     * @return Configuration parameter indicating whether a new round robin order should
+     *      be created for every task. Default is {@code false}.
+     */
+    public boolean isPerTask() {
         return isPerTask;
     }
 
@@ -223,10 +228,13 @@ public class RoundRobinLoadBalancingSpi extends IgniteSpiAdapter implements
Load
      *
      * @param isPerTask Configuration parameter indicating whether a new round robin order
should
      *      be created for every task. Default is {@code false}.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setPerTask(boolean isPerTask) {
+    public RoundRobinLoadBalancingSpi setPerTask(boolean isPerTask) {
         this.isPerTask = isPerTask;
+
+        return this;
     }
 
     /** {@inheritDoc} */
@@ -236,7 +244,8 @@ public class RoundRobinLoadBalancingSpi extends IgniteSpiAdapter implements
Load
         if (log.isDebugEnabled())
             log.debug(configInfo("isPerTask", isPerTask));
 
-        registerMBean(igniteInstanceName, this, RoundRobinLoadBalancingSpiMBean.class);
+        registerMBean(igniteInstanceName, new RoundRobinLoadBalancingSpiMBeanImpl(this),
+            RoundRobinLoadBalancingSpiMBean.class);
 
         balancer = new RoundRobinGlobalLoadBalancer(log);
 
@@ -331,7 +340,30 @@ public class RoundRobinLoadBalancingSpi extends IgniteSpiAdapter implements
Load
     }
 
     /** {@inheritDoc} */
+    @Override public RoundRobinLoadBalancingSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(RoundRobinLoadBalancingSpi.class, this);
     }
+
+    /**
+     * MBean implementation for RoundRobinLoadBalancingSpi.
+     */
+    private class RoundRobinLoadBalancingSpiMBeanImpl extends IgniteSpiMBeanAdapter
+        implements RoundRobinLoadBalancingSpiMBean {
+        /** {@inheritDoc} */
+        RoundRobinLoadBalancingSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isPerTask() {
+            return RoundRobinLoadBalancingSpi.this.isPerTask();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpi.java
index 6e67b80..2af6d44 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpi.java
@@ -44,6 +44,7 @@ import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiConsistencyChecked;
 import org.apache.ignite.spi.IgniteSpiContext;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.loadbalancing.LoadBalancingSpi;
 import org.jetbrains.annotations.Nullable;
@@ -176,8 +177,7 @@ import static org.apache.ignite.events.EventType.EVT_TASK_FINISHED;
  */
 @IgniteSpiMultipleInstancesSupport(true)
 @IgniteSpiConsistencyChecked(optional = true)
-public class WeightedRandomLoadBalancingSpi extends IgniteSpiAdapter implements LoadBalancingSpi,
-    WeightedRandomLoadBalancingSpiMBean {
+public class WeightedRandomLoadBalancingSpi extends IgniteSpiAdapter implements LoadBalancingSpi
{
     /** Random number generator. */
     private static final Random RAND = new Random();
 
@@ -216,14 +216,21 @@ public class WeightedRandomLoadBalancingSpi extends IgniteSpiAdapter
implements
      *
      * @param isUseWeights If {@code true} then random load is distributed according
      *      to node weights.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setUseWeights(boolean isUseWeights) {
+    public WeightedRandomLoadBalancingSpi setUseWeights(boolean isUseWeights) {
         this.isUseWeights = isUseWeights;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public boolean isUseWeights() {
+    /**
+     * See {@link #setUseWeights(boolean)}.
+     *
+     * @return Maximum sparsity.
+     */
+    public boolean isUseWeights() {
         return isUseWeights;
     }
 
@@ -233,14 +240,21 @@ public class WeightedRandomLoadBalancingSpi extends IgniteSpiAdapter
implements
      * is {@link #DFLT_NODE_WEIGHT} and is equal for all nodes.
      *
      * @param nodeWeight Weight of this node.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setNodeWeight(int nodeWeight) {
+    public WeightedRandomLoadBalancingSpi setNodeWeight(int nodeWeight) {
         this.nodeWeight = nodeWeight;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getNodeWeight() {
+    /**
+     * See {@link #setNodeWeight(int)}.
+     *
+     * @return Maximum sparsity.
+     */
+    public int getNodeWeight() {
         return nodeWeight;
     }
 
@@ -260,7 +274,8 @@ public class WeightedRandomLoadBalancingSpi extends IgniteSpiAdapter implements
             log.debug(configInfo("nodeWeight", nodeWeight));
         }
 
-        registerMBean(igniteInstanceName, this, WeightedRandomLoadBalancingSpiMBean.class);
+        registerMBean(igniteInstanceName, new WeightedRandomLoadBalancingSpiMBeanImpl(this),
+            WeightedRandomLoadBalancingSpiMBean.class);
 
         // Ack ok start.
         if (log.isDebugEnabled())
@@ -413,7 +428,35 @@ public class WeightedRandomLoadBalancingSpi extends IgniteSpiAdapter
implements
     }
 
     /** {@inheritDoc} */
+    @Override public WeightedRandomLoadBalancingSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(WeightedRandomLoadBalancingSpi.class, this);
     }
+
+    /**
+     * MBean implementation for WeightedRandomLoadBalancingSpi.
+     */
+    private class WeightedRandomLoadBalancingSpiMBeanImpl extends IgniteSpiMBeanAdapter
+        implements WeightedRandomLoadBalancingSpiMBean {
+        /** {@inheritDoc} */
+        WeightedRandomLoadBalancingSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isUseWeights() {
+            return WeightedRandomLoadBalancingSpi.this.isUseWeights();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getNodeWeight() {
+            return WeightedRandomLoadBalancingSpi.this.getNodeWeight();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java
index 142b31a..b41fb4b 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java
@@ -63,6 +63,7 @@ import org.apache.ignite.spi.IgniteSpiCloseableIterator;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiConsistencyChecked;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.IgniteSpiThread;
 import org.apache.ignite.spi.swapspace.SwapContext;
@@ -140,7 +141,7 @@ import static org.apache.ignite.events.EventType.EVT_SWAP_SPACE_DATA_STORED;
 @IgniteSpiMultipleInstancesSupport(true)
 @IgniteSpiConsistencyChecked(optional = false, checkClient = false)
 @SuppressWarnings({"PackageVisibleInnerClass", "PackageVisibleField"})
-public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi, FileSwapSpaceSpiMBean
{
+public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi {
     /**
      * 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
@@ -190,8 +191,12 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
     @LoggerResource
     private IgniteLogger log;
 
-    /** {@inheritDoc} */
-    @Override public String getBaseDirectory() {
+    /**
+     * Gets base directory.
+     *
+     * @return Base directory.
+     */
+    public String getBaseDirectory() {
         return baseDir;
     }
 
@@ -199,14 +204,21 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
      * Sets base directory.
      *
      * @param baseDir Base directory.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setBaseDirectory(String baseDir) {
+    public FileSwapSpaceSpi setBaseDirectory(String baseDir) {
         this.baseDir = baseDir;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public float getMaximumSparsity() {
+    /**
+     * See {@link #setMaximumSparsity(float)}.
+     *
+     * @return Maximum sparsity.
+     */
+    public float getMaximumSparsity() {
         return maxSparsity;
     }
 
@@ -215,13 +227,20 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
      * 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}.
+     * @return {@code this} for chaining.
      */
-    public void setMaximumSparsity(float maxSparsity) {
+    public FileSwapSpaceSpi setMaximumSparsity(float maxSparsity) {
         this.maxSparsity = maxSparsity;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getWriteBufferSize() {
+    /**
+     * See {@link #setWriteBufferSize(int)}.
+     *
+     * @return Write buffer size in bytes.
+     */
+    public int getWriteBufferSize() {
         return writeBufSize;
     }
 
@@ -230,13 +249,20 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
      * {@link #DFLT_BUF_SIZE}.
      *
      * @param writeBufSize Write buffer size in bytes.
+     * @return {@code this} for chaining.
      */
-    public void setWriteBufferSize(int writeBufSize) {
+    public FileSwapSpaceSpi setWriteBufferSize(int writeBufSize) {
         this.writeBufSize = writeBufSize;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getMaxWriteQueueSize() {
+    /**
+     * See {@link #setMaxWriteQueueSize(int)}.
+     *
+     * @return Max write queue size in bytes.
+     */
+    public int getMaxWriteQueueSize() {
         return maxWriteQueSize;
     }
 
@@ -246,13 +272,20 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
      * {@link #DFLT_QUE_SIZE}.
      *
      * @param maxWriteQueSize Max write queue size in bytes.
+     * @return {@code this} for chaining.
      */
-    public void setMaxWriteQueueSize(int maxWriteQueSize) {
+    public FileSwapSpaceSpi setMaxWriteQueueSize(int maxWriteQueSize) {
         this.maxWriteQueSize = maxWriteQueSize;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getReadStripesNumber() {
+    /**
+     * See {@link #setReadStripesNumber(int)}.
+     *
+     * @return Read pool size.
+     */
+    public int getReadStripesNumber() {
         return readStripesNum;
     }
 
@@ -261,12 +294,15 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
      * CPU cores available to this JVM.
      *
      * @param readStripesNum Read stripe number.
+     * @return {@code this} for chaining.
      */
-    public void setReadStripesNumber(int readStripesNum) {
+    public FileSwapSpaceSpi setReadStripesNumber(int readStripesNum) {
         A.ensure(readStripesNum == -1 || (readStripesNum & (readStripesNum - 1)) == 0,
             "readStripesNum must be positive and power of two");
 
         this.readStripesNum = readStripesNum;
+
+        return this;
     }
 
     /** {@inheritDoc} */
@@ -294,7 +330,7 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
 
         startStopwatch();
 
-        registerMBean(igniteInstanceName, this, FileSwapSpaceSpiMBean.class);
+        registerMBean(igniteInstanceName, new FileSwapSpaceSpiMBeanImpl(this), FileSwapSpaceSpiMBean.class);
 
         String path = baseDir + File.separator + igniteInstanceName + File.separator + ignite.configuration().getNodeId();
 
@@ -695,6 +731,13 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
     }
 
     /** {@inheritDoc} */
+    @Override public FileSwapSpaceSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(FileSwapSpaceSpi.class, this);
     }
@@ -1944,4 +1987,39 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
             };
         }
     }
+
+    /**
+     * MBean implementation for LocalDeploymentSpi.
+     */
+    private class FileSwapSpaceSpiMBeanImpl extends IgniteSpiMBeanAdapter implements FileSwapSpaceSpiMBean
{
+        /** {@inheritDoc} */
+        FileSwapSpaceSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getBaseDirectory() {
+            return FileSwapSpaceSpi.this.getBaseDirectory();
+        }
+
+        /** {@inheritDoc} */
+        @Override public float getMaximumSparsity() {
+            return FileSwapSpaceSpi.this.getMaximumSparsity();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getWriteBufferSize() {
+            return FileSwapSpaceSpi.this.getWriteBufferSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getMaxWriteQueueSize() {
+            return FileSwapSpaceSpi.this.getMaxWriteQueueSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getReadStripesNumber() {
+            return FileSwapSpaceSpi.this.getReadStripesNumber();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/swapspace/noop/NoopSwapSpaceSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/swapspace/noop/NoopSwapSpaceSpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/noop/NoopSwapSpaceSpi.java
index a3649b2..a6618b0 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/swapspace/noop/NoopSwapSpaceSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/noop/NoopSwapSpaceSpi.java
@@ -146,6 +146,13 @@ public class NoopSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi
{
     }
 
     /** {@inheritDoc} */
+    @Override public NoopSwapSpaceSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(NoopSwapSpaceSpi.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java
b/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java
index 71074c0..c238998 100644
--- a/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java
+++ b/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java
@@ -40,6 +40,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.resources.LoggerResource;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
@@ -198,10 +199,13 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt
      * For details refer to Google Cloud Platform API reference.
      *
      * @param projectName Project name.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = false)
-    public void setProjectName(String projectName) {
+    public TcpDiscoveryGoogleStorageIpFinder setProjectName(String projectName) {
         this.projectName = projectName;
+
+        return this;
     }
 
     /**
@@ -211,10 +215,13 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt
      * perform this operation.
      *
      * @param bucketName Bucket name.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = false)
-    public void setBucketName(String bucketName) {
+    public TcpDiscoveryGoogleStorageIpFinder setBucketName(String bucketName) {
         this.bucketName = bucketName;
+
+        return this;
     }
 
 
@@ -226,10 +233,13 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt
      *     Service Account Authentication</a>.
      *
      * @param p12FileName Private key file full path.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = false)
-    public void setServiceAccountP12FilePath(String p12FileName) {
+    public TcpDiscoveryGoogleStorageIpFinder setServiceAccountP12FilePath(String p12FileName)
{
         this.srvcAccountP12FilePath = p12FileName;
+
+        return this;
     }
 
     /**
@@ -240,10 +250,13 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt
      *     Service Account Authentication</a>.
      *
      * @param id Service account ID.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = false)
-    public void setServiceAccountId(String id) {
+    public TcpDiscoveryGoogleStorageIpFinder setServiceAccountId(String id) {
         this.srvcAccountId = id;
+
+        return this;
     }
 
     /**
@@ -403,4 +416,16 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt
             throw new IgniteSpiException("Failed to remove the bucket: " + bucketName, e);
         }
     }
+
+    /** {@inheritDoc} */
+    @Override public TcpDiscoveryGoogleStorageIpFinder setShared(boolean shared) {
+        super.setShared(shared);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(TcpDiscoveryGoogleStorageIpFinder.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
index 674cca7..ee71503 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
@@ -142,9 +142,12 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
      * Sets default user name. See {@link #getDefaultUserName()} for details.
      *
      * @param dfltUsrName Default user name.
+     * @return {@code this} for chaining.
      */
-    public void setDefaultUserName(@Nullable String dfltUsrName) {
+    public IgniteHadoopIgfsSecondaryFileSystem setDefaultUserName(@Nullable String dfltUsrName)
{
         this.dfltUsrName = dfltUsrName;
+
+        return this;
     }
 
     /**
@@ -164,9 +167,12 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
      * Sets secondary file system factory. See {@link #getFileSystemFactory()} for details.
      *
      * @param factory Secondary file system factory.
+     * @return {@code this} for chaining.
      */
-    public void setFileSystemFactory(HadoopFileSystemFactory factory) {
+    public IgniteHadoopIgfsSecondaryFileSystem setFileSystemFactory(HadoopFileSystemFactory
factory) {
         this.factory = factory;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/hadoop/src/main/java/org/apache/ignite/hadoop/mapreduce/IgniteHadoopWeightedMapReducePlanner.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/mapreduce/IgniteHadoopWeightedMapReducePlanner.java
b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/mapreduce/IgniteHadoopWeightedMapReducePlanner.java
index bb0b47f..1d72c4b 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/mapreduce/IgniteHadoopWeightedMapReducePlanner.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/mapreduce/IgniteHadoopWeightedMapReducePlanner.java
@@ -637,9 +637,12 @@ public class IgniteHadoopWeightedMapReducePlanner extends HadoopAbstractMapReduc
      * Set local mapper weight. See {@link #getLocalMapperWeight()} for more information.
      *
      * @param locMapperWeight Local mapper weight.
+     * @return {@code this} for chaining.
      */
-    public void setLocalMapperWeight(int locMapperWeight) {
+    public IgniteHadoopWeightedMapReducePlanner setLocalMapperWeight(int locMapperWeight)
{
         this.locMapperWeight = locMapperWeight;
+
+        return this;
     }
 
     /**
@@ -658,9 +661,12 @@ public class IgniteHadoopWeightedMapReducePlanner extends HadoopAbstractMapReduc
      * Set remote mapper weight. See {@link #getRemoteMapperWeight()} for more information.
      *
      * @param rmtMapperWeight Remote mapper weight.
+     * @return {@code this} for chaining.
      */
-    public void setRemoteMapperWeight(int rmtMapperWeight) {
+    public IgniteHadoopWeightedMapReducePlanner setRemoteMapperWeight(int rmtMapperWeight)
{
         this.rmtMapperWeight = rmtMapperWeight;
+
+        return this;
     }
 
     /**
@@ -679,9 +685,12 @@ public class IgniteHadoopWeightedMapReducePlanner extends HadoopAbstractMapReduc
      * Set local reducer weight. See {@link #getLocalReducerWeight()} for more information.
      *
      * @param locReducerWeight Local reducer weight.
+     * @return {@code this} for chaining.
      */
-    public void setLocalReducerWeight(int locReducerWeight) {
+    public IgniteHadoopWeightedMapReducePlanner setLocalReducerWeight(int locReducerWeight)
{
         this.locReducerWeight = locReducerWeight;
+
+        return this;
     }
 
     /**
@@ -700,9 +709,12 @@ public class IgniteHadoopWeightedMapReducePlanner extends HadoopAbstractMapReduc
      * Set remote reducer weight. See {@link #getRemoteReducerWeight()} for more information.
      *
      * @param rmtReducerWeight Remote reducer weight.
+     * @return {@code this} for chaining.
      */
-    public void setRemoteReducerWeight(int rmtReducerWeight) {
+    public IgniteHadoopWeightedMapReducePlanner setRemoteReducerWeight(int rmtReducerWeight)
{
         this.rmtReducerWeight = rmtReducerWeight;
+
+        return this;
     }
 
     /**
@@ -722,9 +734,13 @@ public class IgniteHadoopWeightedMapReducePlanner extends HadoopAbstractMapReduc
      * information.
      *
      * @param reducerMigrationThresholdWeight Reducer migration threshold weight.
+     * @return {@code this} for chaining.
      */
-    public void setPreferLocalReducerThresholdWeight(int reducerMigrationThresholdWeight)
{
+    public IgniteHadoopWeightedMapReducePlanner setPreferLocalReducerThresholdWeight(
+        int reducerMigrationThresholdWeight) {
         this.preferLocReducerThresholdWeight = reducerMigrationThresholdWeight;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
----------------------------------------------------------------------
diff --git a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
index ce69ce1..b49e2c5 100644
--- a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
+++ b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
@@ -52,6 +52,7 @@ import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiConsistencyChecked;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.deployment.DeploymentListener;
 import org.apache.ignite.spi.deployment.DeploymentResource;
@@ -307,7 +308,7 @@ import org.jetbrains.annotations.Nullable;
 @IgniteSpiMultipleInstancesSupport(true)
 @IgniteSpiConsistencyChecked(optional = false)
 @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
-public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi, UriDeploymentSpiMBean
{
+public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi {
     /**
      * Default deployment directory where SPI will pick up GAR files. Note that this path
is relative to
      * {@code IGNITE_HOME/work} folder if {@code IGNITE_HOME} system or environment variable
specified,
@@ -382,10 +383,13 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
      * If not provided, default value is {@code java.io.tmpdir} system property value.
      *
      * @param tmpDirPath Temporary directory path.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setTemporaryDirectoryPath(String tmpDirPath) {
+    public UriDeploymentSpi setTemporaryDirectoryPath(String tmpDirPath) {
         this.tmpDirPath = tmpDirPath;
+
+        return this;
     }
 
     /**
@@ -398,10 +402,13 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
      * For unknown {@code IGNITE_HOME} list of URI must be provided explicitly.
      *
      * @param uriList GAR file URIs.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setUriList(List<String> uriList) {
+    public UriDeploymentSpi setUriList(List<String> uriList) {
         this.uriList = uriList;
+
+        return this;
     }
 
     /**
@@ -409,10 +416,13 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
      * Otherwise it should try to load new unit regardless to possible file duplication.
      *
      * @param checkMd5 new value for the property
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setCheckMd5(boolean checkMd5) {
+    public UriDeploymentSpi setCheckMd5(boolean checkMd5) {
         this.checkMd5 = checkMd5;
+
+        return this;
     }
 
     /**
@@ -420,7 +430,7 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
      *
      * @return value of the {@code checkMd5} property.
      */
-    @Override public boolean isCheckMd5() {
+    public boolean isCheckMd5() {
         return checkMd5;
     }
 
@@ -433,19 +443,30 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
      *
      * @param encodeUri {@code true} if every URI should be encoded and
      *      {@code false} otherwise.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setEncodeUri(boolean encodeUri) {
+    public UriDeploymentSpi setEncodeUri(boolean encodeUri) {
         this.encodeUri = encodeUri;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getTemporaryDirectoryPath() {
+    /**
+     * Gets temporary directory path.
+     *
+     * @return Temporary directory path.
+     */
+    public String getTemporaryDirectoryPath() {
         return tmpDirPath;
     }
 
-    /** {@inheritDoc} */
-    @Override public List<String> getUriList() {
+    /**
+     * Gets list of URIs that are processed by SPI.
+     *
+     * @return List of URIs.
+     */
+    public List<String> getUriList() {
         return Collections.unmodifiableList(uriList);
     }
 
@@ -467,10 +488,13 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
      * Sets scanners.
      *
      * @param scanners Scanners.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setScanners(UriDeploymentScanner... scanners) {
+    public UriDeploymentSpi setScanners(UriDeploymentScanner... scanners) {
         this.scanners = scanners;
+
+        return this;
     }
 
     /** {@inheritDoc} */
@@ -523,7 +547,7 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
 
         initializeTemporaryDirectoryPath();
 
-        registerMBean(igniteInstanceName, this, UriDeploymentSpiMBean.class);
+        registerMBean(igniteInstanceName, new UriDeploymentSpiMBeanImpl(this), UriDeploymentSpiMBean.class);
 
         FilenameFilter filter = new FilenameFilter() {
             @Override public boolean accept(File dir, String name) {
@@ -1343,7 +1367,39 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
     }
 
     /** {@inheritDoc} */
+    public IgniteSpiAdapter setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(UriDeploymentSpi.class, this);
     }
+
+    /**
+     * MBean implementation for UriDeploymentSpi.
+     */
+    private class UriDeploymentSpiMBeanImpl extends IgniteSpiMBeanAdapter implements UriDeploymentSpiMBean
{
+        /** {@inheritDoc} */
+        UriDeploymentSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getTemporaryDirectoryPath() {
+            return UriDeploymentSpi.this.getTemporaryDirectoryPath();
+        }
+
+        /** {@inheritDoc} */
+        @Override public List<String> getUriList() {
+            return  UriDeploymentSpi.this.getUriList();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isCheckMd5() {
+            return  UriDeploymentSpi.this.isCheckMd5();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/TcpDiscoveryZookeeperIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/TcpDiscoveryZookeeperIpFinder.java
b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/TcpDiscoveryZookeeperIpFinder.java
index e7a732a..f96a762 100644
--- a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/TcpDiscoveryZookeeperIpFinder.java
+++ b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/TcpDiscoveryZookeeperIpFinder.java
@@ -274,9 +274,12 @@ public class TcpDiscoveryZookeeperIpFinder extends TcpDiscoveryIpFinderAdapter
{
 
     /**
      * @param curator A {@link CuratorFramework} instance to use. It can already be in <tt>STARTED</tt>
state.
+     * @return {@code this} for chaining.
      */
-    public void setCurator(CuratorFramework curator) {
+    public TcpDiscoveryZookeeperIpFinder setCurator(CuratorFramework curator) {
         this.curator = curator;
+
+        return this;
     }
 
     /**
@@ -289,9 +292,12 @@ public class TcpDiscoveryZookeeperIpFinder extends TcpDiscoveryIpFinderAdapter
{
     /**
      * @param zkConnectionString ZooKeeper connection string in case a {@link CuratorFramework}
is not being set
      * explicitly.
+     * @return {@code this} for chaining.
      */
-    public void setZkConnectionString(String zkConnectionString) {
+    public TcpDiscoveryZookeeperIpFinder setZkConnectionString(String zkConnectionString)
{
         this.zkConnectionString = zkConnectionString;
+
+        return this;
     }
 
     /**
@@ -304,9 +310,12 @@ public class TcpDiscoveryZookeeperIpFinder extends TcpDiscoveryIpFinderAdapter
{
     /**
      * @param retryPolicy {@link RetryPolicy} to use in case a ZK Connection String is being
injected, or if using a
      * system property.
+     * @return {@code this} for chaining.
      */
-    public void setRetryPolicy(RetryPolicy retryPolicy) {
+    public TcpDiscoveryZookeeperIpFinder setRetryPolicy(RetryPolicy retryPolicy) {
         this.retryPolicy = retryPolicy;
+
+        return this;
     }
 
     /**
@@ -318,9 +327,12 @@ public class TcpDiscoveryZookeeperIpFinder extends TcpDiscoveryIpFinderAdapter
{
 
     /**
      * @param basePath Base path for service registration in ZK. If not passed, {@link #BASE_PATH}
will be used.
+     * @return {@code this} for chaining.
      */
-    public void setBasePath(String basePath) {
+    public TcpDiscoveryZookeeperIpFinder setBasePath(String basePath) {
         this.basePath = basePath;
+
+        return this;
     }
 
     /**
@@ -333,9 +345,12 @@ public class TcpDiscoveryZookeeperIpFinder extends TcpDiscoveryIpFinderAdapter
{
     /**
      * @param serviceName Service name to use, as defined by Curator's {#link ServiceDiscovery}
recipe. In physical ZK
      * terms, it represents the node under {@link #basePath}, under which services will be
registered.
+     * @return {@code this} for chaining.
      */
-    public void setServiceName(String serviceName) {
+    public TcpDiscoveryZookeeperIpFinder setServiceName(String serviceName) {
         this.serviceName = serviceName;
+
+        return this;
     }
 
     /**
@@ -350,9 +365,19 @@ public class TcpDiscoveryZookeeperIpFinder extends TcpDiscoveryIpFinderAdapter
{
      * allowed. Nodes will attempt to register themselves, plus those they know about. By
default, duplicate
      * registrations are not allowed, but you might want to set this property to <tt>true</tt>
if you have multiple
      * network interfaces or if you are facing troubles.
+     * @return {@code this} for chaining.
      */
-    public void setAllowDuplicateRegistrations(boolean allowDuplicateRegistrations) {
+    public TcpDiscoveryZookeeperIpFinder setAllowDuplicateRegistrations(boolean allowDuplicateRegistrations)
{
         this.allowDuplicateRegistrations = allowDuplicateRegistrations;
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public TcpDiscoveryZookeeperIpFinder setShared(boolean shared) {
+        super.setShared(shared);
+
+        return this;
     }
 
     /**


Mime
View raw message