ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [20/23] incubator-ignite git commit: IGNITE-49 Removed DiscoveryMetricsHelper
Date Tue, 27 Jan 2015 13:34:18 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/abe5d178/modules/core/src/main/java/org/apache/ignite/spi/discovery/ClusterMetricsSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/ClusterMetricsSnapshot.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/ClusterMetricsSnapshot.java
deleted file mode 100644
index 192251c..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/ClusterMetricsSnapshot.java
+++ /dev/null
@@ -1,1118 +0,0 @@
-/*
- * 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.discovery;
-
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-
-import static java.lang.Math.*;
-
-/**
- * Implementation for {@link ClusterMetrics} interface.
- * <p>
- * Note that whenever adding or removing metric parameters, care
- * must be taken to update {@link DiscoveryMetricsHelper} as well.
- */
-public class ClusterMetricsSnapshot implements ClusterMetrics {
-    /** */
-    private long lastUpdateTime = -1;
-
-    /** */
-    private int maxActiveJobs = -1;
-
-    /** */
-    private int curActiveJobs = -1;
-
-    /** */
-    private float avgActiveJobs = -1;
-
-    /** */
-    private int maxWaitingJobs = -1;
-
-    /** */
-    private int curWaitingJobs = -1;
-
-    /** */
-    private float avgWaitingJobs = -1;
-
-    /** */
-    private int maxRejectedJobs = -1;
-
-    /** */
-    private int curRejectedJobs = -1;
-
-    /** */
-    private float avgRejectedJobs = -1;
-
-    /** */
-    private int maxCancelledJobs = -1;
-
-    /** */
-    private int curCancelledJobs = -1;
-
-    /** */
-    private float avgCancelledJobs = -1;
-
-    /** */
-    private int totalRejectedJobs = -1;
-
-    /** */
-    private int totalCancelledJobs = -1;
-
-    /** */
-    private int totalExecutedJobs = -1;
-
-    /** */
-    private long maxJobWaitTime = -1;
-
-    /** */
-    private long curJobWaitTime = -1;
-
-    /** */
-    private double avgJobWaitTime = -1;
-
-    /** */
-    private long maxJobExecTime = -1;
-
-    /** */
-    private long curJobExecTime = -1;
-
-    /** */
-    private double avgJobExecTime = -1;
-
-    /** */
-    private int totalExecTasks = -1;
-
-    /** */
-    private long totalIdleTime = -1;
-
-    /** */
-    private long curIdleTime = -1;
-
-    /** */
-    private int availProcs = -1;
-
-    /** */
-    private double load = -1;
-
-    /** */
-    private double avgLoad = -1;
-
-    /** */
-    private double gcLoad = -1;
-
-    /** */
-    private long heapInit = -1;
-
-    /** */
-    private long heapUsed = -1;
-
-    /** */
-    private long heapCommitted = -1;
-
-    /** */
-    private long heapMax = -1;
-
-    /** */
-    private long nonHeapInit = -1;
-
-    /** */
-    private long nonHeapUsed = -1;
-
-    /** */
-    private long nonHeapCommitted = -1;
-
-    /** */
-    private long nonHeapMax = -1;
-
-    /** */
-    private long upTime = -1;
-
-    /** */
-    private long startTime = -1;
-
-    /** */
-    private long nodeStartTime = -1;
-
-    /** */
-    private int threadCnt = -1;
-
-    /** */
-    private int peakThreadCnt = -1;
-
-    /** */
-    private long startedThreadCnt = -1;
-
-    /** */
-    private int daemonThreadCnt = -1;
-
-    /** */
-    private long lastDataVer = -1;
-
-    /** */
-    private int sentMsgsCnt = -1;
-
-    /** */
-    private long sentBytesCnt = -1;
-
-    /** */
-    private int rcvdMsgsCnt = -1;
-
-    /** */
-    private long rcvdBytesCnt = -1;
-
-    /** */
-    private int outMesQueueSize = -1;
-
-    /**
-     * Create empty snapshot.
-     */
-    public ClusterMetricsSnapshot() {
-    }
-
-    /**
-     * Create metrics for given cluster group.
-     *
-     * @param p Projection to get metrics for.
-     */
-    public ClusterMetricsSnapshot(ClusterGroup p) {
-        assert p != null;
-
-        Collection<ClusterNode> nodes = p.nodes();
-
-        int size = nodes.size();
-
-        curJobWaitTime = Long.MAX_VALUE;
-
-        for (ClusterNode node : nodes) {
-            ClusterMetrics m = node.metrics();
-
-            lastUpdateTime = max(lastUpdateTime, node.metrics().getLastUpdateTime());
-
-            curActiveJobs += m.getCurrentActiveJobs();
-            maxActiveJobs = max(maxActiveJobs, m.getCurrentActiveJobs());
-            avgActiveJobs += m.getCurrentActiveJobs();
-            totalExecutedJobs += m.getTotalExecutedJobs();
-
-            totalExecTasks += m.getTotalExecutedTasks();
-
-            totalCancelledJobs += m.getTotalCancelledJobs();
-            curCancelledJobs += m.getCurrentCancelledJobs();
-            maxCancelledJobs = max(maxCancelledJobs, m.getCurrentCancelledJobs());
-            avgCancelledJobs += m.getCurrentCancelledJobs();
-
-            totalRejectedJobs += m.getTotalRejectedJobs();
-            curRejectedJobs += m.getCurrentRejectedJobs();
-            maxRejectedJobs = max(maxRejectedJobs, m.getCurrentRejectedJobs());
-            avgRejectedJobs += m.getCurrentRejectedJobs();
-
-            curWaitingJobs += m.getCurrentJobWaitTime();
-            maxWaitingJobs = max(maxWaitingJobs, m.getCurrentWaitingJobs());
-            avgWaitingJobs += m.getCurrentWaitingJobs();
-
-            maxJobExecTime = max(maxJobExecTime, m.getMaximumJobExecuteTime());
-            avgJobExecTime += m.getAverageJobExecuteTime();
-            curJobExecTime += m.getCurrentJobExecuteTime();
-
-            curJobWaitTime = min(curJobWaitTime, m.getCurrentJobWaitTime());
-            maxJobWaitTime = max(maxJobWaitTime, m.getCurrentJobWaitTime());
-            avgJobWaitTime += m.getCurrentJobWaitTime();
-
-            daemonThreadCnt += m.getCurrentDaemonThreadCount();
-
-            peakThreadCnt = max(peakThreadCnt, m.getCurrentThreadCount());
-            threadCnt += m.getCurrentThreadCount();
-            startedThreadCnt += m.getTotalStartedThreadCount();
-
-            curIdleTime += m.getCurrentIdleTime();
-            totalIdleTime += m.getTotalIdleTime();
-
-            heapCommitted += m.getHeapMemoryCommitted();
-
-            heapUsed += m.getHeapMemoryUsed();
-
-            heapMax = max(heapMax, m.getHeapMemoryMaximum());
-
-            heapInit += m.getHeapMemoryInitialized();
-
-            nonHeapCommitted += m.getNonHeapMemoryCommitted();
-
-            nonHeapUsed += m.getNonHeapMemoryUsed();
-
-            nonHeapMax = max(nonHeapMax, m.getNonHeapMemoryMaximum());
-
-            nonHeapInit += m.getNonHeapMemoryInitialized();
-
-            upTime = max(upTime, m.getUpTime());
-
-            lastDataVer = max(lastDataVer, m.getLastDataVersion());
-
-            sentMsgsCnt += m.getSentMessagesCount();
-            sentBytesCnt += m.getSentBytesCount();
-            rcvdMsgsCnt += m.getReceivedMessagesCount();
-            rcvdBytesCnt += m.getReceivedBytesCount();
-            outMesQueueSize += m.getOutboundMessagesQueueSize();
-
-            avgLoad += m.getCurrentCpuLoad();
-            availProcs += m.getTotalCpus();
-        }
-
-        curJobExecTime /= size;
-
-        avgActiveJobs /= size;
-        avgCancelledJobs /= size;
-        avgRejectedJobs /= size;
-        avgWaitingJobs /= size;
-        avgJobExecTime /= size;
-        avgJobWaitTime /= size;
-        avgLoad /= size;
-
-        if (!F.isEmpty(nodes)) {
-            ClusterMetrics oldestNodeMetrics = oldest(nodes).metrics();
-
-            nodeStartTime = oldestNodeMetrics.getNodeStartTime();
-            startTime = oldestNodeMetrics.getStartTime();
-        }
-
-        Map<String, Collection<ClusterNode>> neighborhood = U.neighborhood(nodes);
-
-        gcLoad = gcCpus(neighborhood);
-        load = cpus(neighborhood);
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getLastUpdateTime() {
-        return lastUpdateTime;
-    }
-
-    /**
-     * Sets last update time.
-     *
-     * @param lastUpdateTime Last update time.
-     */
-    public void setLastUpdateTime(long lastUpdateTime) {
-        this.lastUpdateTime = lastUpdateTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getMaximumActiveJobs() {
-        return maxActiveJobs;
-    }
-
-    /**
-     * Sets max active jobs.
-     *
-     * @param maxActiveJobs Max active jobs.
-     */
-    public void setMaximumActiveJobs(int maxActiveJobs) {
-        this.maxActiveJobs = maxActiveJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getCurrentActiveJobs() {
-        return curActiveJobs;
-    }
-
-    /**
-     * Sets current active jobs.
-     *
-     * @param curActiveJobs Current active jobs.
-     */
-    public void setCurrentActiveJobs(int curActiveJobs) {
-        this.curActiveJobs = curActiveJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAverageActiveJobs() {
-        return avgActiveJobs;
-    }
-
-    /**
-     * Sets average active jobs.
-     *
-     * @param avgActiveJobs Average active jobs.
-     */
-    public void setAverageActiveJobs(float avgActiveJobs) {
-        this.avgActiveJobs = avgActiveJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getMaximumWaitingJobs() {
-        return maxWaitingJobs;
-    }
-
-    /**
-     * Sets maximum waiting jobs.
-     *
-     * @param maxWaitingJobs Maximum waiting jobs.
-     */
-    public void setMaximumWaitingJobs(int maxWaitingJobs) {
-        this.maxWaitingJobs = maxWaitingJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getCurrentWaitingJobs() {
-        return curWaitingJobs;
-    }
-
-    /**
-     * Sets current waiting jobs.
-     *
-     * @param curWaitingJobs Current waiting jobs.
-     */
-    public void setCurrentWaitingJobs(int curWaitingJobs) {
-        this.curWaitingJobs = curWaitingJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAverageWaitingJobs() {
-        return avgWaitingJobs;
-    }
-
-    /**
-     * Sets average waiting jobs.
-     *
-     * @param avgWaitingJobs Average waiting jobs.
-     */
-    public void setAverageWaitingJobs(float avgWaitingJobs) {
-        this.avgWaitingJobs = avgWaitingJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getMaximumRejectedJobs() {
-        return maxRejectedJobs;
-    }
-
-    /**
-     * @param maxRejectedJobs Maximum number of jobs rejected during a single collision resolution event.
-     */
-    public void setMaximumRejectedJobs(int maxRejectedJobs) {
-        this.maxRejectedJobs = maxRejectedJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getCurrentRejectedJobs() {
-        return curRejectedJobs;
-    }
-
-    /**
-     * @param curRejectedJobs Number of jobs rejected during most recent collision resolution.
-     */
-    public void setCurrentRejectedJobs(int curRejectedJobs) {
-        this.curRejectedJobs = curRejectedJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAverageRejectedJobs() {
-        return avgRejectedJobs;
-    }
-
-    /**
-     * @param avgRejectedJobs Average number of jobs this node rejects.
-     */
-    public void setAverageRejectedJobs(float avgRejectedJobs) {
-        this.avgRejectedJobs = avgRejectedJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTotalRejectedJobs() {
-        return totalRejectedJobs;
-    }
-
-    /**
-     * @param totalRejectedJobs Total number of jobs this node ever rejected.
-     */
-    public void setTotalRejectedJobs(int totalRejectedJobs) {
-        this.totalRejectedJobs = totalRejectedJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getMaximumCancelledJobs() {
-        return maxCancelledJobs;
-    }
-
-    /**
-     * Sets maximum cancelled jobs.
-     *
-     * @param maxCancelledJobs Maximum cancelled jobs.
-     */
-    public void setMaximumCancelledJobs(int maxCancelledJobs) {
-        this.maxCancelledJobs = maxCancelledJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getCurrentCancelledJobs() {
-        return curCancelledJobs;
-    }
-
-    /**
-     * Sets current cancelled jobs.
-     *
-     * @param curCancelledJobs Current cancelled jobs.
-     */
-    public void setCurrentCancelledJobs(int curCancelledJobs) {
-        this.curCancelledJobs = curCancelledJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAverageCancelledJobs() {
-        return avgCancelledJobs;
-    }
-
-    /**
-     * Sets average cancelled jobs.
-     *
-     * @param avgCancelledJobs Average cancelled jobs.
-     */
-    public void setAverageCancelledJobs(float avgCancelledJobs) {
-        this.avgCancelledJobs = avgCancelledJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTotalExecutedJobs() {
-        return totalExecutedJobs;
-    }
-
-    /**
-     * Sets total active jobs.
-     *
-     * @param totalExecutedJobs Total active jobs.
-     */
-    public void setTotalExecutedJobs(int totalExecutedJobs) {
-        this.totalExecutedJobs = totalExecutedJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTotalCancelledJobs() {
-        return totalCancelledJobs;
-    }
-
-    /**
-     * Sets total cancelled jobs.
-     *
-     * @param totalCancelledJobs Total cancelled jobs.
-     */
-    public void setTotalCancelledJobs(int totalCancelledJobs) {
-        this.totalCancelledJobs = totalCancelledJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getMaximumJobWaitTime() {
-        return maxJobWaitTime;
-    }
-
-    /**
-     * Sets max job wait time.
-     *
-     * @param maxJobWaitTime Max job wait time.
-     */
-    public void setMaximumJobWaitTime(long maxJobWaitTime) {
-        this.maxJobWaitTime = maxJobWaitTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCurrentJobWaitTime() {
-        return curJobWaitTime;
-    }
-
-    /**
-     * Sets current job wait time.
-     *
-     * @param curJobWaitTime Current job wait time.
-     */
-    public void setCurrentJobWaitTime(long curJobWaitTime) {
-        this.curJobWaitTime = curJobWaitTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double getAverageJobWaitTime() {
-        return avgJobWaitTime;
-    }
-
-    /**
-     * Sets average job wait time.
-     *
-     * @param avgJobWaitTime Average job wait time.
-     */
-    public void setAverageJobWaitTime(double avgJobWaitTime) {
-        this.avgJobWaitTime = avgJobWaitTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getMaximumJobExecuteTime() {
-        return maxJobExecTime;
-    }
-
-    /**
-     * Sets maximum job execution time.
-     *
-     * @param maxJobExecTime Maximum job execution time.
-     */
-    public void setMaximumJobExecuteTime(long maxJobExecTime) {
-        this.maxJobExecTime = maxJobExecTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCurrentJobExecuteTime() {
-        return curJobExecTime;
-    }
-
-    /**
-     * Sets current job execute time.
-     *
-     * @param curJobExecTime Current job execute time.
-     */
-    public void setCurrentJobExecuteTime(long curJobExecTime) {
-        this.curJobExecTime = curJobExecTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double getAverageJobExecuteTime() {
-        return avgJobExecTime;
-    }
-
-    /**
-     * Sets average job execution time.
-     *
-     * @param avgJobExecTime Average job execution time.
-     */
-    public void setAverageJobExecuteTime(double avgJobExecTime) {
-        this.avgJobExecTime = avgJobExecTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTotalExecutedTasks() {
-        return totalExecTasks;
-    }
-
-    /**
-     * Sets total executed tasks count.
-     *
-     * @param totalExecTasks total executed tasks count.
-     */
-    public void setTotalExecutedTasks(int totalExecTasks) {
-        this.totalExecTasks = totalExecTasks;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getTotalBusyTime() {
-        return getUpTime() - getTotalIdleTime();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getTotalIdleTime() {
-        return totalIdleTime;
-    }
-
-    /**
-     * Set total node idle time.
-     *
-     * @param totalIdleTime Total node idle time.
-     */
-    public void setTotalIdleTime(long totalIdleTime) {
-        this.totalIdleTime = totalIdleTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCurrentIdleTime() {
-        return curIdleTime;
-    }
-
-    /**
-     * Sets time elapsed since execution of last job.
-     *
-     * @param curIdleTime Time elapsed since execution of last job.
-     */
-    public void setCurrentIdleTime(long curIdleTime) {
-        this.curIdleTime = curIdleTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getBusyTimePercentage() {
-        return 1 - getIdleTimePercentage();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getIdleTimePercentage() {
-        return getTotalIdleTime() / (float)getUpTime();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTotalCpus() {
-        return availProcs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double getCurrentCpuLoad() {
-        return load;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double getAverageCpuLoad() {
-        return avgLoad;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double getCurrentGcCpuLoad() {
-        return gcLoad;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getHeapMemoryInitialized() {
-        return heapInit;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getHeapMemoryUsed() {
-        return heapUsed;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getHeapMemoryCommitted() {
-        return heapCommitted;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getHeapMemoryMaximum() {
-        return heapMax;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getNonHeapMemoryInitialized() {
-        return nonHeapInit;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getNonHeapMemoryUsed() {
-        return nonHeapUsed;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getNonHeapMemoryCommitted() {
-        return nonHeapCommitted;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getNonHeapMemoryMaximum() {
-        return nonHeapMax;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getUpTime() {
-        return upTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getStartTime() {
-        return startTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getNodeStartTime() {
-        return nodeStartTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getCurrentThreadCount() {
-        return threadCnt;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getMaximumThreadCount() {
-        return peakThreadCnt;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getTotalStartedThreadCount() {
-        return startedThreadCnt;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getCurrentDaemonThreadCount() {
-        return daemonThreadCnt;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getLastDataVersion() {
-        return lastDataVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getSentMessagesCount() {
-        return sentMsgsCnt;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getSentBytesCount() {
-        return sentBytesCnt;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getReceivedMessagesCount() {
-        return rcvdMsgsCnt;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getReceivedBytesCount() {
-        return rcvdBytesCnt;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getOutboundMessagesQueueSize() {
-        return outMesQueueSize;
-    }
-
-    /**
-     * Sets available processors.
-     *
-     * @param availProcs Available processors.
-     */
-    public void setAvailableProcessors(int availProcs) {
-        this.availProcs = availProcs;
-    }
-
-    /**
-     * Sets current CPU load.
-     *
-     * @param load Current CPU load.
-     */
-    public void setCurrentCpuLoad(double load) {
-        this.load = load;
-    }
-
-    /**
-     * Sets CPU load average over the metrics history.
-     *
-     * @param avgLoad CPU load average.
-     */
-    public void setAverageCpuLoad(double avgLoad) {
-        this.avgLoad = avgLoad;
-    }
-
-    /**
-     * Sets current GC load.
-     *
-     * @param gcLoad Current GC load.
-     */
-    public void setCurrentGcCpuLoad(double gcLoad) {
-        this.gcLoad = gcLoad;
-    }
-
-    /**
-     * Sets heap initial memory.
-     *
-     * @param heapInit Heap initial memory.
-     */
-    public void setHeapMemoryInitialized(long heapInit) {
-        this.heapInit = heapInit;
-    }
-
-    /**
-     * Sets used heap memory.
-     *
-     * @param heapUsed Used heap memory.
-     */
-    public void setHeapMemoryUsed(long heapUsed) {
-        this.heapUsed = heapUsed;
-    }
-
-    /**
-     * Sets committed heap memory.
-     *
-     * @param heapCommitted Committed heap memory.
-     */
-    public void setHeapMemoryCommitted(long heapCommitted) {
-        this.heapCommitted = heapCommitted;
-    }
-
-    /**
-     * Sets maximum possible heap memory.
-     *
-     * @param heapMax Maximum possible heap memory.
-     */
-    public void setHeapMemoryMaximum(long heapMax) {
-        this.heapMax = heapMax;
-    }
-
-    /**
-     * Sets initial non-heap memory.
-     *
-     * @param nonHeapInit Initial non-heap memory.
-     */
-    public void setNonHeapMemoryInitialized(long nonHeapInit) {
-        this.nonHeapInit = nonHeapInit;
-    }
-
-    /**
-     * Sets used non-heap memory.
-     *
-     * @param nonHeapUsed Used non-heap memory.
-     */
-    public void setNonHeapMemoryUsed(long nonHeapUsed) {
-        this.nonHeapUsed = nonHeapUsed;
-    }
-
-    /**
-     * Sets committed non-heap memory.
-     *
-     * @param nonHeapCommitted Committed non-heap memory.
-     */
-    public void setNonHeapMemoryCommitted(long nonHeapCommitted) {
-        this.nonHeapCommitted = nonHeapCommitted;
-    }
-
-    /**
-     * Sets maximum possible non-heap memory.
-     *
-     * @param nonHeapMax Maximum possible non-heap memory.
-     */
-    public void setNonHeapMemoryMaximum(long nonHeapMax) {
-        this.nonHeapMax = nonHeapMax;
-    }
-
-    /**
-     * Sets VM up time.
-     *
-     * @param upTime VM up time.
-     */
-    public void setUpTime(long upTime) {
-        this.upTime = upTime;
-    }
-
-    /**
-     * Sets VM start time.
-     *
-     * @param startTime VM start time.
-     */
-    public void setStartTime(long startTime) {
-        this.startTime = startTime;
-    }
-
-    /**
-     * Sets node start time.
-     *
-     * @param nodeStartTime node start time.
-     */
-    public void setNodeStartTime(long nodeStartTime) {
-        this.nodeStartTime = nodeStartTime;
-    }
-
-    /**
-     * Sets thread count.
-     *
-     * @param threadCnt Thread count.
-     */
-    public void setCurrentThreadCount(int threadCnt) {
-        this.threadCnt = threadCnt;
-    }
-
-    /**
-     * Sets peak thread count.
-     *
-     * @param peakThreadCnt Peak thread count.
-     */
-    public void setMaximumThreadCount(int peakThreadCnt) {
-        this.peakThreadCnt = peakThreadCnt;
-    }
-
-    /**
-     * Sets started thread count.
-     *
-     * @param startedThreadCnt Started thread count.
-     */
-    public void setTotalStartedThreadCount(long startedThreadCnt) {
-        this.startedThreadCnt = startedThreadCnt;
-    }
-
-    /**
-     * Sets daemon thread count.
-     *
-     * @param daemonThreadCnt Daemon thread count.
-     */
-    public void setCurrentDaemonThreadCount(int daemonThreadCnt) {
-        this.daemonThreadCnt = daemonThreadCnt;
-    }
-
-    /**
-     * Sets last data version.
-     *
-     * @param lastDataVer Last data version.
-     */
-    public void setLastDataVersion(long lastDataVer) {
-        this.lastDataVer = lastDataVer;
-    }
-
-    /**
-     * Sets sent messages count.
-     *
-     * @param sentMsgsCnt Sent messages count.
-     */
-    public void setSentMessagesCount(int sentMsgsCnt) {
-        this.sentMsgsCnt = sentMsgsCnt;
-    }
-
-    /**
-     * Sets sent bytes count.
-     *
-     * @param sentBytesCnt Sent bytes count.
-     */
-    public void setSentBytesCount(long sentBytesCnt) {
-        this.sentBytesCnt = sentBytesCnt;
-    }
-
-    /**
-     * Sets received messages count.
-     *
-     * @param rcvdMsgsCnt Received messages count.
-     */
-    public void setReceivedMessagesCount(int rcvdMsgsCnt) {
-        this.rcvdMsgsCnt = rcvdMsgsCnt;
-    }
-
-    /**
-     * Sets received bytes count.
-     *
-     * @param rcvdBytesCnt Received bytes count.
-     */
-    public void setReceivedBytesCount(long rcvdBytesCnt) {
-        this.rcvdBytesCnt = rcvdBytesCnt;
-    }
-
-    /**
-     * Sets outbound messages queue size.
-     *
-     * @param outMesQueueSize Outbound messages queue size.
-     */
-    public void setOutboundMessagesQueueSize(int outMesQueueSize) {
-        this.outMesQueueSize = outMesQueueSize;
-    }
-
-    private static int cpus(Map<String, Collection<ClusterNode>> neighborhood) {
-        int cpus = 0;
-
-        for (Collection<ClusterNode> nodes : neighborhood.values()) {
-            ClusterNode first = F.first(nodes);
-
-            // Projection can be empty if all nodes in it failed.
-            if (first != null)
-                cpus += first.metrics().getTotalCpus();
-        }
-
-        return cpus;
-    }
-
-    private static int gcCpus(Map<String, Collection<ClusterNode>> neighborhood) {
-        int cpus = 0;
-
-        for (Collection<ClusterNode> nodes : neighborhood.values()) {
-            ClusterNode first = F.first(nodes);
-
-            // Projection can be empty if all nodes in it failed.
-            if (first != null)
-                cpus += first.metrics().getCurrentGcCpuLoad();
-        }
-
-        return cpus;
-    }
-
-    /**
-     * Gets the oldest node in given collection.
-     *
-     * @param nodes Nodes.
-     * @return Oldest node or {@code null} if collection is empty.
-     */
-    @Nullable private static ClusterNode oldest(Collection<ClusterNode> nodes) {
-        long min = Long.MAX_VALUE;
-
-        ClusterNode oldest = null;
-
-        for (ClusterNode n : nodes)
-            if (n.order() < min) {
-                min = n.order();
-                oldest = n;
-            }
-
-        return oldest;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        return System.identityHashCode(this);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object obj) {
-        if (this == obj)
-            return true;
-
-        if (obj == null || getClass() != obj.getClass())
-            return false;
-
-        ClusterMetricsSnapshot other = (ClusterMetricsSnapshot)obj;
-
-        return
-            availProcs == other.availProcs &&
-            curActiveJobs == other.curActiveJobs &&
-            curCancelledJobs == other.curCancelledJobs &&
-            curIdleTime == other.curIdleTime &&
-            curJobExecTime == other.curJobExecTime &&
-            curJobWaitTime == other.curJobWaitTime &&
-            curRejectedJobs == other.curRejectedJobs &&
-            curWaitingJobs == other.curWaitingJobs &&
-            daemonThreadCnt == other.daemonThreadCnt &&
-            heapCommitted == other.heapCommitted &&
-            heapInit == other.heapInit &&
-            heapMax == other.heapMax &&
-            heapUsed == other.heapUsed &&
-            maxActiveJobs == other.maxActiveJobs &&
-            maxCancelledJobs == other.maxCancelledJobs &&
-            maxJobExecTime == other.maxJobExecTime &&
-            maxJobWaitTime == other.maxJobWaitTime &&
-            maxRejectedJobs == other.maxRejectedJobs &&
-            maxWaitingJobs == other.maxWaitingJobs &&
-            nonHeapCommitted == other.nonHeapCommitted &&
-            nonHeapInit == other.nonHeapInit &&
-            nonHeapMax == other.nonHeapMax &&
-            nonHeapUsed == other.nonHeapUsed &&
-            peakThreadCnt == other.peakThreadCnt &&
-            rcvdBytesCnt == other.rcvdBytesCnt &&
-            outMesQueueSize == other.outMesQueueSize &&
-            rcvdMsgsCnt == other.rcvdMsgsCnt &&
-            sentBytesCnt == other.sentBytesCnt &&
-            sentMsgsCnt == other.sentMsgsCnt &&
-            startTime == other.startTime &&
-            nodeStartTime == other.nodeStartTime &&
-            startedThreadCnt == other.startedThreadCnt &&
-            threadCnt == other.threadCnt &&
-            totalCancelledJobs == other.totalCancelledJobs &&
-            totalExecutedJobs == other.totalExecutedJobs &&
-            totalExecTasks == other.totalExecTasks &&
-            totalIdleTime == other.totalIdleTime &&
-            totalRejectedJobs == other.totalRejectedJobs &&
-            upTime == other.upTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(ClusterMetricsSnapshot.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/abe5d178/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryMetricsHelper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryMetricsHelper.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryMetricsHelper.java
deleted file mode 100644
index 512f041..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryMetricsHelper.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * 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.discovery;
-
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-
-/**
- * Helper class to serialize and deserialize cluster metrics.
- */
-public final class DiscoveryMetricsHelper {
-    /** Size of serialized node metrics. */
-    public static final int METRICS_SIZE =
-        4/*max active jobs*/ +
-        4/*current active jobs*/ +
-        4/*average active jobs*/ +
-        4/*max waiting jobs*/ +
-        4/*current waiting jobs*/ +
-        4/*average waiting jobs*/ +
-        4/*max cancelled jobs*/ +
-        4/*current cancelled jobs*/ +
-        4/*average cancelled jobs*/ +
-        4/*max rejected jobs*/ +
-        4/*current rejected jobs*/ +
-        4/*average rejected jobs*/ +
-        4/*total executed jobs*/ +
-        4/*total rejected jobs*/ +
-        4/*total cancelled jobs*/ +
-        8/*max job wait time*/ +
-        8/*current job wait time*/ +
-        8/*average job wait time*/ +
-        8/*max job execute time*/ +
-        8/*current job execute time*/ +
-        8/*average job execute time*/ +
-        4/*total executed tasks*/ +
-        8/*current idle time*/ +
-        8/*total idle time*/ +
-        4/*available processors*/ +
-        8/*current CPU load*/ +
-        8/*average CPU load*/ +
-        8/*current GC CPU load*/ +
-        8/*heap memory init*/ +
-        8/*heap memory used*/ +
-        8/*heap memory committed*/ +
-        8/*heap memory max*/ +
-        8/*non-heap memory init*/ +
-        8/*non-heap memory used*/ +
-        8/*non-heap memory committed*/ +
-        8/*non-heap memory max*/ +
-        8/*uptime*/ +
-        8/*start time*/ +
-        8/*node start time*/ +
-        4/*thread count*/ +
-        4/*peak thread count*/ +
-        8/*total started thread count*/ +
-        4/*daemon thread count*/ +
-        8/*last data version.*/ +
-        4/*sent messages count*/ +
-        8/*sent bytes count*/ +
-        4/*received messages count*/ +
-        8/*received bytes count*/ +
-        4/*outbound messages queue size*/;
-
-    /**
-     * Enforces singleton.
-     */
-    private DiscoveryMetricsHelper() {
-        // No-op.
-    }
-
-    /**
-     * Serializes node metrics into byte array.
-     *
-     * @param data Byte array.
-     * @param off Offset into byte array.
-     * @param metrics Node metrics to serialize.
-     * @return New offset.
-     */
-    public static int serialize(byte[] data, int off, ClusterMetrics metrics) {
-        int start = off;
-
-        off = U.intToBytes(metrics.getMaximumActiveJobs(), data, off);
-        off = U.intToBytes(metrics.getCurrentActiveJobs(), data, off);
-        off = U.floatToBytes(metrics.getAverageActiveJobs(), data, off);
-        off = U.intToBytes(metrics.getMaximumWaitingJobs(), data, off);
-        off = U.intToBytes(metrics.getCurrentWaitingJobs(), data, off);
-        off = U.floatToBytes(metrics.getAverageWaitingJobs(), data, off);
-        off = U.intToBytes(metrics.getMaximumRejectedJobs(), data, off);
-        off = U.intToBytes(metrics.getCurrentRejectedJobs(), data, off);
-        off = U.floatToBytes(metrics.getAverageRejectedJobs(), data, off);
-        off = U.intToBytes(metrics.getMaximumCancelledJobs(), data, off);
-        off = U.intToBytes(metrics.getCurrentCancelledJobs(), data, off);
-        off = U.floatToBytes(metrics.getAverageCancelledJobs(), data, off);
-        off = U.intToBytes(metrics.getTotalRejectedJobs(), data , off);
-        off = U.intToBytes(metrics.getTotalCancelledJobs(), data , off);
-        off = U.intToBytes(metrics.getTotalExecutedJobs(), data , off);
-        off = U.longToBytes(metrics.getMaximumJobWaitTime(), data, off);
-        off = U.longToBytes(metrics.getCurrentJobWaitTime(), data, off);
-        off = U.doubleToBytes(metrics.getAverageJobWaitTime(), data, off);
-        off = U.longToBytes(metrics.getMaximumJobExecuteTime(), data, off);
-        off = U.longToBytes(metrics.getCurrentJobExecuteTime(), data, off);
-        off = U.doubleToBytes(metrics.getAverageJobExecuteTime(), data, off);
-        off = U.intToBytes(metrics.getTotalExecutedTasks(), data, off);
-        off = U.longToBytes(metrics.getCurrentIdleTime(), data, off);
-        off = U.longToBytes(metrics.getTotalIdleTime(), data , off);
-        off = U.intToBytes(metrics.getTotalCpus(), data, off);
-        off = U.doubleToBytes(metrics.getCurrentCpuLoad(), data, off);
-        off = U.doubleToBytes(metrics.getAverageCpuLoad(), data, off);
-        off = U.doubleToBytes(metrics.getCurrentGcCpuLoad(), data, off);
-        off = U.longToBytes(metrics.getHeapMemoryInitialized(), data, off);
-        off = U.longToBytes(metrics.getHeapMemoryUsed(), data, off);
-        off = U.longToBytes(metrics.getHeapMemoryCommitted(), data, off);
-        off = U.longToBytes(metrics.getHeapMemoryMaximum(), data, off);
-        off = U.longToBytes(metrics.getNonHeapMemoryInitialized(), data, off);
-        off = U.longToBytes(metrics.getNonHeapMemoryUsed(), data, off);
-        off = U.longToBytes(metrics.getNonHeapMemoryCommitted(), data, off);
-        off = U.longToBytes(metrics.getNonHeapMemoryMaximum(), data, off);
-        off = U.longToBytes(metrics.getStartTime(), data, off);
-        off = U.longToBytes(metrics.getNodeStartTime(), data, off);
-        off = U.longToBytes(metrics.getUpTime(), data, off);
-        off = U.intToBytes(metrics.getCurrentThreadCount(), data, off);
-        off = U.intToBytes(metrics.getMaximumThreadCount(), data, off);
-        off = U.longToBytes(metrics.getTotalStartedThreadCount(), data, off);
-        off = U.intToBytes(metrics.getCurrentDaemonThreadCount(), data, off);
-        off = U.longToBytes(metrics.getLastDataVersion(), data, off);
-        off = U.intToBytes(metrics.getSentMessagesCount(), data, off);
-        off = U.longToBytes(metrics.getSentBytesCount(), data, off);
-        off = U.intToBytes(metrics.getReceivedMessagesCount(), data, off);
-        off = U.longToBytes(metrics.getReceivedBytesCount(), data, off);
-        off = U.intToBytes(metrics.getOutboundMessagesQueueSize(), data, off);
-
-        assert off - start == METRICS_SIZE : "Invalid metrics size [expected=" + METRICS_SIZE + ", actual=" +
-            (off - start) + ']';
-
-        return off;
-    }
-
-    /**
-     * De-serializes node metrics.
-     *
-     * @param data Byte array.
-     * @param off Offset into byte array.
-     * @return Deserialized node metrics.
-     */
-    public static ClusterMetrics deserialize(byte[] data, int off) {
-        int start = off;
-
-        ClusterMetricsSnapshot metrics = new ClusterMetricsSnapshot();
-
-        metrics.setLastUpdateTime(U.currentTimeMillis());
-
-        metrics.setMaximumActiveJobs(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setCurrentActiveJobs(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setAverageActiveJobs(U.bytesToFloat(data, off));
-
-        off += 4;
-
-        metrics.setMaximumWaitingJobs(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setCurrentWaitingJobs(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setAverageWaitingJobs(U.bytesToFloat(data, off));
-
-        off += 4;
-
-        metrics.setMaximumRejectedJobs(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setCurrentRejectedJobs(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setAverageRejectedJobs(U.bytesToFloat(data, off));
-
-        off += 4;
-
-        metrics.setMaximumCancelledJobs(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setCurrentCancelledJobs(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setAverageCancelledJobs(U.bytesToFloat(data, off));
-
-        off += 4;
-
-        metrics.setTotalRejectedJobs(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setTotalCancelledJobs(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setTotalExecutedJobs(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setMaximumJobWaitTime(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setCurrentJobWaitTime(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setAverageJobWaitTime(U.bytesToDouble(data, off));
-
-        off += 8;
-
-        metrics.setMaximumJobExecuteTime(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setCurrentJobExecuteTime(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setAverageJobExecuteTime(U.bytesToDouble(data, off));
-
-        off += 8;
-
-        metrics.setTotalExecutedTasks(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setCurrentIdleTime(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setTotalIdleTime(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setAvailableProcessors(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setCurrentCpuLoad(U.bytesToDouble(data, off));
-
-        off += 8;
-
-        metrics.setAverageCpuLoad(U.bytesToDouble(data, off));
-
-        off += 8;
-
-        metrics.setCurrentGcCpuLoad(U.bytesToDouble(data, off));
-
-        off += 8;
-
-        metrics.setHeapMemoryInitialized(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setHeapMemoryUsed(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setHeapMemoryCommitted(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setHeapMemoryMaximum(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setNonHeapMemoryInitialized(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setNonHeapMemoryUsed(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setNonHeapMemoryCommitted(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setNonHeapMemoryMaximum(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setStartTime(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setNodeStartTime(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setUpTime(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setCurrentThreadCount(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setMaximumThreadCount(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setTotalStartedThreadCount(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setCurrentDaemonThreadCount(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setLastDataVersion(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setSentMessagesCount(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setSentBytesCount(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setReceivedMessagesCount(U.bytesToInt(data, off));
-
-        off += 4;
-
-        metrics.setReceivedBytesCount(U.bytesToLong(data, off));
-
-        off += 8;
-
-        metrics.setOutboundMessagesQueueSize(U.bytesToInt(data, off));
-
-        off += 4;
-
-        assert off - start == METRICS_SIZE : "Invalid metrics size [expected=" + METRICS_SIZE + ", actual=" +
-            (off - start) + ']';
-
-        return metrics;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/abe5d178/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
index cd5dacf..f3aa670 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
@@ -396,9 +396,9 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
         byte[] mtr = null;
 
         if (metrics != null) {
-            mtr = new byte[DiscoveryMetricsHelper.METRICS_SIZE];
+            mtr = new byte[ClusterMetricsSnapshot.METRICS_SIZE];
 
-            DiscoveryMetricsHelper.serialize(mtr, 0, metrics);
+            ClusterMetricsSnapshot.serialize(mtr, 0, metrics);
         }
 
         U.writeByteArray(out, mtr);
@@ -425,7 +425,7 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
         byte[] mtr = U.readByteArray(in);
 
         if (mtr != null)
-            metrics = DiscoveryMetricsHelper.deserialize(mtr, 0);
+            metrics = ClusterMetricsSnapshot.deserialize(mtr, 0);
 
         order = in.readLong();
         intOrder = in.readLong();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/abe5d178/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
index 18baadc..65eea9f 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
@@ -18,7 +18,7 @@
 package org.apache.ignite.spi.discovery.tcp.messages;
 
 import org.apache.ignite.cluster.*;
-import org.apache.ignite.spi.discovery.*;
+import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
@@ -26,8 +26,6 @@ import org.apache.ignite.internal.util.typedef.internal.*;
 import java.io.*;
 import java.util.*;
 
-import static org.apache.ignite.spi.discovery.DiscoveryMetricsHelper.*;
-
 /**
  * Heartbeat message.
  * <p>
@@ -199,9 +197,9 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage {
     private static byte[] serializeMetrics(ClusterMetrics metrics) {
         assert metrics != null;
 
-        byte[] buf = new byte[DiscoveryMetricsHelper.METRICS_SIZE];
+        byte[] buf = new byte[ClusterMetricsSnapshot.METRICS_SIZE];
 
-        serialize(buf, 0, metrics);
+        ClusterMetricsSnapshot.serialize(buf, 0, metrics);
 
         return buf;
     }
@@ -215,12 +213,12 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage {
         assert nodeId != null;
         assert metrics != null;
 
-        byte[] buf = new byte[16 + DiscoveryMetricsHelper.METRICS_SIZE];
+        byte[] buf = new byte[16 + ClusterMetricsSnapshot.METRICS_SIZE];
 
         U.longToBytes(nodeId.getMostSignificantBits(), buf, 0);
         U.longToBytes(nodeId.getLeastSignificantBits(), buf, 8);
 
-        serialize(buf, 16, metrics);
+        ClusterMetricsSnapshot.serialize(buf, 16, metrics);
 
         return buf;
     }
@@ -257,7 +255,7 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage {
          * @return Deserialized metrics.
          */
         public ClusterMetrics metrics() {
-            return deserialize(metrics, 0);
+            return ClusterMetricsSnapshot.deserialize(metrics, 0);
         }
 
         /**
@@ -268,7 +266,7 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage {
                 @Override public T2<UUID, ClusterMetrics> apply(byte[] bytes) {
                     UUID nodeId = new UUID(U.bytesToLong(bytes, 0), U.bytesToLong(bytes, 8));
 
-                    return new T2<>(nodeId, deserialize(bytes, 16));
+                    return new T2<>(nodeId, ClusterMetricsSnapshot.deserialize(bytes, 16));
                 }
             });
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/abe5d178/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiAttributesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiAttributesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiAttributesSelfTest.java
index b26993a..2a6f6d4 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiAttributesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiAttributesSelfTest.java
@@ -18,8 +18,8 @@
 package org.apache.ignite.spi.collision.jobstealing;
 
 import org.apache.ignite.cluster.*;
+import org.apache.ignite.internal.*;
 import org.apache.ignite.spi.collision.*;
-import org.apache.ignite.spi.discovery.*;
 import org.apache.ignite.spi.failover.jobstealing.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/abe5d178/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiCustomTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiCustomTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiCustomTopologySelfTest.java
index 17ba88f..9a63379 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiCustomTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiCustomTopologySelfTest.java
@@ -19,9 +19,9 @@ package org.apache.ignite.spi.collision.jobstealing;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
+import org.apache.ignite.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.spi.collision.*;
-import org.apache.ignite.spi.discovery.*;
 import org.apache.ignite.spi.failover.jobstealing.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.testframework.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/abe5d178/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiSelfTest.java
index e1424ce..aff724c 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiSelfTest.java
@@ -19,9 +19,9 @@ package org.apache.ignite.spi.collision.jobstealing;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
+import org.apache.ignite.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.spi.collision.*;
-import org.apache.ignite.spi.discovery.*;
 import org.apache.ignite.spi.failover.jobstealing.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/abe5d178/modules/core/src/test/java/org/apache/ignite/spi/discovery/ClusterMetricsSnapshotSerializeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/ClusterMetricsSnapshotSerializeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/ClusterMetricsSnapshotSerializeSelfTest.java
new file mode 100644
index 0000000..a737a91
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/ClusterMetricsSnapshotSerializeSelfTest.java
@@ -0,0 +1,126 @@
+/*
+ * 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.discovery;
+
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Grid discovery metrics test.
+ */
+@GridCommonTest(group = "Utils")
+public class ClusterMetricsSnapshotSerializeSelfTest extends GridCommonAbstractTest {
+    /** */
+    public ClusterMetricsSnapshotSerializeSelfTest() {
+        super(false /*don't start grid*/);
+    }
+
+    /** */
+    public void testMetricsSize() {
+        byte[] data = new byte[ClusterMetricsSnapshot.METRICS_SIZE];
+
+        // Test serialization.
+        int off = ClusterMetricsSnapshot.serialize(data, 0, createMetrics());
+
+        assert off == ClusterMetricsSnapshot.METRICS_SIZE;
+
+        // Test deserialization.
+        ClusterMetrics res = ClusterMetricsSnapshot.deserialize(data, 0);
+
+        assert res != null;
+    }
+
+    /** */
+    public void testSerialization() {
+        byte[] data = new byte[ClusterMetricsSnapshot.METRICS_SIZE];
+
+        ClusterMetrics metrics1 = createMetrics();
+
+        // Test serialization.
+        int off = ClusterMetricsSnapshot.serialize(data, 0, metrics1);
+
+        assert off == ClusterMetricsSnapshot.METRICS_SIZE;
+
+        // Test deserialization.
+        ClusterMetrics metrics2 = ClusterMetricsSnapshot.deserialize(data, 0);
+
+        assert metrics2 != null;
+
+        assert metrics1.equals(metrics2);
+    }
+
+    /**
+     * @return Test metrics.
+     */
+    private ClusterMetrics createMetrics() {
+        ClusterMetricsSnapshot metrics = new ClusterMetricsSnapshot();
+
+        metrics.setAvailableProcessors(1);
+        metrics.setAverageActiveJobs(2);
+        metrics.setAverageCancelledJobs(3);
+        metrics.setAverageJobExecuteTime(4);
+        metrics.setAverageJobWaitTime(5);
+        metrics.setAverageRejectedJobs(6);
+        metrics.setAverageWaitingJobs(7);
+        metrics.setCurrentActiveJobs(8);
+        metrics.setCurrentCancelledJobs(9);
+        metrics.setCurrentIdleTime(10);
+        metrics.setCurrentIdleTime(11);
+        metrics.setCurrentJobExecuteTime(12);
+        metrics.setCurrentJobWaitTime(13);
+        metrics.setCurrentRejectedJobs(14);
+        metrics.setCurrentWaitingJobs(15);
+        metrics.setCurrentDaemonThreadCount(16);
+        metrics.setHeapMemoryCommitted(17);
+        metrics.setHeapMemoryInitialized(18);
+        metrics.setHeapMemoryMaximum(19);
+        metrics.setHeapMemoryUsed(20);
+        metrics.setLastUpdateTime(21);
+        metrics.setMaximumActiveJobs(22);
+        metrics.setMaximumCancelledJobs(23);
+        metrics.setMaximumJobExecuteTime(24);
+        metrics.setMaximumJobWaitTime(25);
+        metrics.setMaximumRejectedJobs(26);
+        metrics.setMaximumWaitingJobs(27);
+        metrics.setNonHeapMemoryCommitted(28);
+        metrics.setNonHeapMemoryInitialized(29);
+        metrics.setNonHeapMemoryMaximum(30);
+        metrics.setNonHeapMemoryUsed(31);
+        metrics.setMaximumThreadCount(32);
+        metrics.setStartTime(33);
+        metrics.setCurrentCpuLoad(34);
+        metrics.setCurrentThreadCount(35);
+        metrics.setTotalCancelledJobs(36);
+        metrics.setTotalExecutedJobs(37);
+        metrics.setTotalIdleTime(38);
+        metrics.setTotalRejectedJobs(39);
+        metrics.setTotalStartedThreadCount(40);
+        metrics.setUpTime(41);
+        metrics.setSentMessagesCount(42);
+        metrics.setSentBytesCount(43);
+        metrics.setReceivedMessagesCount(44);
+        metrics.setReceivedBytesCount(45);
+        metrics.setOutboundMessagesQueueSize(46);
+
+        return metrics;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/abe5d178/modules/core/src/test/java/org/apache/ignite/spi/discovery/GridDiscoveryMetricsHelperSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/GridDiscoveryMetricsHelperSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/GridDiscoveryMetricsHelperSelfTest.java
deleted file mode 100644
index 4aa06b7..0000000
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/GridDiscoveryMetricsHelperSelfTest.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * 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.discovery;
-
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Grid discovery metrics test.
- */
-@GridCommonTest(group = "Utils")
-public class GridDiscoveryMetricsHelperSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final int METRICS_COUNT = 500;
-
-    /** */
-    public GridDiscoveryMetricsHelperSelfTest() {
-        super(false /*don't start grid*/);
-    }
-
-    /** */
-    public void testMetricsSize() {
-        byte[] data = new byte[DiscoveryMetricsHelper.METRICS_SIZE];
-
-        // Test serialization.
-        int off = DiscoveryMetricsHelper.serialize(data, 0, createMetrics());
-
-        assert off == DiscoveryMetricsHelper.METRICS_SIZE;
-
-        // Test deserialization.
-        ClusterMetrics res = DiscoveryMetricsHelper.deserialize(data, 0);
-
-        assert res != null;
-    }
-
-    /** */
-    public void testSerialization() {
-        byte[] data = new byte[DiscoveryMetricsHelper.METRICS_SIZE];
-
-        ClusterMetrics metrics1 = createMetrics();
-
-        // Test serialization.
-        int off = DiscoveryMetricsHelper.serialize(data, 0, metrics1);
-
-        assert off == DiscoveryMetricsHelper.METRICS_SIZE;
-
-        // Test deserialization.
-        ClusterMetrics metrics2 = DiscoveryMetricsHelper.deserialize(data, 0);
-
-        assert metrics2 != null;
-
-        assert metrics1.equals(metrics2);
-    }
-
-    /**
-     * @throws IOException If I/O error occurs.
-     */
-    public void testMultipleMetricsSerialization() throws IOException {
-        Map<UUID, ClusterMetrics> metrics = new HashMap<>(METRICS_COUNT);
-
-        for (int i = 0; i < METRICS_COUNT; i++)
-            metrics.put(UUID.randomUUID(), createMetrics());
-
-        ByteArrayOutputStream bos = new ByteArrayOutputStream(1024 * 1024);
-
-        ObjectOutputStream oos = new ObjectOutputStream(bos);
-
-        oos.writeObject(metrics);
-
-        oos.close();
-
-        info(">>> Size of metrics map <UUID, GridNodeMetrics> in KB [metricsCount=" + METRICS_COUNT +
-            ", size=" + bos.size() / 1024.0 + ']');
-    }
-
-    /**
-     * @return Test metrics.
-     */
-    private ClusterMetrics createMetrics() {
-        ClusterMetricsSnapshot metrics = new ClusterMetricsSnapshot();
-
-        metrics.setAvailableProcessors(1);
-        metrics.setAverageActiveJobs(2);
-        metrics.setAverageCancelledJobs(3);
-        metrics.setAverageJobExecuteTime(4);
-        metrics.setAverageJobWaitTime(5);
-        metrics.setAverageRejectedJobs(6);
-        metrics.setAverageWaitingJobs(7);
-        metrics.setCurrentActiveJobs(8);
-        metrics.setCurrentCancelledJobs(9);
-        metrics.setCurrentIdleTime(10);
-        metrics.setCurrentIdleTime(11);
-        metrics.setCurrentJobExecuteTime(12);
-        metrics.setCurrentJobWaitTime(13);
-        metrics.setCurrentRejectedJobs(14);
-        metrics.setCurrentWaitingJobs(15);
-        metrics.setCurrentDaemonThreadCount(16);
-        metrics.setHeapMemoryCommitted(17);
-        metrics.setHeapMemoryInitialized(18);
-        metrics.setHeapMemoryMaximum(19);
-        metrics.setHeapMemoryUsed(20);
-        metrics.setLastUpdateTime(21);
-        metrics.setMaximumActiveJobs(22);
-        metrics.setMaximumCancelledJobs(23);
-        metrics.setMaximumJobExecuteTime(24);
-        metrics.setMaximumJobWaitTime(25);
-        metrics.setMaximumRejectedJobs(26);
-        metrics.setMaximumWaitingJobs(27);
-        metrics.setNonHeapMemoryCommitted(28);
-        metrics.setNonHeapMemoryInitialized(29);
-        metrics.setNonHeapMemoryMaximum(30);
-        metrics.setNonHeapMemoryUsed(31);
-        metrics.setMaximumThreadCount(32);
-        metrics.setStartTime(33);
-        metrics.setCurrentCpuLoad(34);
-        metrics.setCurrentThreadCount(35);
-        metrics.setTotalCancelledJobs(36);
-        metrics.setTotalExecutedJobs(37);
-        metrics.setTotalIdleTime(38);
-        metrics.setTotalRejectedJobs(39);
-        metrics.setTotalStartedThreadCount(40);
-        metrics.setUpTime(41);
-        metrics.setSentMessagesCount(42);
-        metrics.setSentBytesCount(43);
-        metrics.setReceivedMessagesCount(44);
-        metrics.setReceivedBytesCount(45);
-        metrics.setOutboundMessagesQueueSize(46);
-
-        return metrics;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/abe5d178/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
index fbcbdd1..d70e4b0 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
@@ -20,10 +20,10 @@ package org.apache.ignite.testframework;
 import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.events.*;
+import org.apache.ignite.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.plugin.security.*;
 import org.apache.ignite.spi.*;
-import org.apache.ignite.spi.discovery.*;
 import org.apache.ignite.spi.swapspace.*;
 import org.apache.ignite.internal.managers.communication.*;
 import org.apache.ignite.internal.managers.eventstorage.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/abe5d178/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
index 213912a..87d38b7 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
@@ -53,7 +53,7 @@ public class IgniteUtilSelfTestSuite extends TestSuite {
         suite.addTestSuite(GridCacheUtilsSelfTest.class);
 
         // Metrics.
-        suite.addTestSuite(GridDiscoveryMetricsHelperSelfTest.class);
+        suite.addTestSuite(ClusterMetricsSnapshotSerializeSelfTest.class);
 
         // Unsafe.
         suite.addTestSuite(GridUnsafeMemorySelfTest.class);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/abe5d178/modules/core/src/test/java/org/apache/ignite/util/GridTopologyHeapSizeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/util/GridTopologyHeapSizeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/util/GridTopologyHeapSizeSelfTest.java
index 8b15202..069223e 100644
--- a/modules/core/src/test/java/org/apache/ignite/util/GridTopologyHeapSizeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/util/GridTopologyHeapSizeSelfTest.java
@@ -19,7 +19,7 @@ package org.apache.ignite.util;
 
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
-import org.apache.ignite.spi.discovery.*;
+import org.apache.ignite.internal.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;


Mime
View raw message