ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [15/31] incubator-ignite git commit: #ignite-128: All classes are moved.
Date Tue, 03 Feb 2015 14:18:42 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b5b2f309/modules/core/src/main/java/org/apache/ignite/client/impl/GridClientNodeMetricsAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/client/impl/GridClientNodeMetricsAdapter.java b/modules/core/src/main/java/org/apache/ignite/client/impl/GridClientNodeMetricsAdapter.java
deleted file mode 100644
index a4e4ba3..0000000
--- a/modules/core/src/main/java/org/apache/ignite/client/impl/GridClientNodeMetricsAdapter.java
+++ /dev/null
@@ -1,990 +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.client.impl;
-
-import org.apache.ignite.internal.client.*;
-
-/**
- * Node metrics adapter.
- */
-public class GridClientNodeMetricsAdapter implements GridClientNodeMetrics {
-    /** Serial version UID. */
-    private static final long serialVersionUID = 9162377764800501071L;
-
-    /** */
-    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 fileSysFreeSpace = -1;
-
-    /** */
-    private long fileSysTotalSpace = -1;
-
-    /** */
-    private long fileSysUsableSpace = -1;
-
-    /** */
-    private long lastDataVer = -1;
-
-    /** */
-    private int sentMsgsCnt = -1;
-
-    /** */
-    private long sentBytesCnt = -1;
-
-    /** */
-    private int rcvdMsgsCnt = -1;
-
-    /** */
-    private long rcvdBytesCnt = -1;
-
-    /** {@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;
-    }
-
-    /**
-     * Gets maximum number of jobs rejected during a single collision resolution event.
-     *
-     * @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;
-    }
-
-    /**
-     * Sets number of jobs rejected during most recent collision resolution.
-     *
-     * @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;
-    }
-
-    /**
-     * Sets average number of jobs this node rejects.
-     *
-     * @param avgRejectedJobs Average number of jobs this node rejects.
-     */
-    public void setAverageRejectedJobs(float avgRejectedJobs) {
-        this.avgRejectedJobs = avgRejectedJobs;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTotalRejectedJobs() {
-        return totalRejectedJobs;
-    }
-
-    /**
-     * Sets total number of jobs this node ever rejected.
-     *
-     * @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 number of tasks handled by the node.
-     *
-     * @param totalExecTasks Total number of tasks handled by the node.
-     */
-    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 getFileSystemFreeSpace() {
-        return fileSysFreeSpace;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getFileSystemTotalSpace() {
-        return fileSysTotalSpace;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getFileSystemUsableSpace() {
-        return fileSysUsableSpace;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getLastDataVersion() {
-        return lastDataVer;
-    }
-
-    /**
-     * Sets available processors.
-     *
-     * @param availProcs Available processors.
-     */
-    public void setTotalCpus(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 CPU 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 VN 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 the number of unallocated bytes in the partition.
-     *
-     * @param fileSysFreeSpace The number of unallocated bytes in the partition.
-     */
-    public void setFileSystemFreeSpace(long fileSysFreeSpace) {
-        this.fileSysFreeSpace = fileSysFreeSpace;
-    }
-
-    /**
-     * Sets size of the partition.
-     *
-     * @param fileSysTotalSpace Size of the partition.
-     */
-    public void setFileSystemTotalSpace(long fileSysTotalSpace) {
-        this.fileSysTotalSpace = fileSysTotalSpace;
-    }
-
-    /**
-     * Sets the number of bytes available to this virtual machine on the partition.
-     *
-     * @param fileSysUsableSpace The number of bytes available to
-     *      this virtual machine on the partition.
-     */
-    public void setFileSystemUsableSpace(long fileSysUsableSpace) {
-        this.fileSysUsableSpace = fileSysUsableSpace;
-    }
-
-    /**
-     * Sets last data version.
-     *
-     * @param lastDataVer Last data version.
-     */
-    public void setLastDataVersion(long lastDataVer) {
-        this.lastDataVer = lastDataVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getSentMessagesCount() {
-        return sentMsgsCnt;
-    }
-
-    /**
-     * Sets sent messages count.
-     *
-     * @param sentMsgsCnt Sent messages count.
-     */
-    public void setSentMessagesCount(int sentMsgsCnt) {
-        this.sentMsgsCnt = sentMsgsCnt;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getSentBytesCount() {
-        return sentBytesCnt;
-    }
-
-    /**
-     * Sets sent bytes count.
-     *
-     * @param sentBytesCnt Sent bytes count.
-     */
-    public void setSentBytesCount(long sentBytesCnt) {
-        this.sentBytesCnt = sentBytesCnt;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getReceivedMessagesCount() {
-        return rcvdMsgsCnt;
-    }
-
-    /**
-     * Sets received messages count.
-     *
-     * @param rcvdMsgsCnt Received messages count.
-     */
-    public void setReceivedMessagesCount(int rcvdMsgsCnt) {
-        this.rcvdMsgsCnt = rcvdMsgsCnt;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getReceivedBytesCount() {
-        return rcvdBytesCnt;
-    }
-
-    /**
-     * Sets received bytes count.
-     *
-     * @param rcvdBytesCnt Received bytes count.
-     */
-    public void setReceivedBytesCount(long rcvdBytesCnt) {
-        this.rcvdBytesCnt = rcvdBytesCnt;
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("StringBufferReplaceableByString")
-    @Override public String toString() {
-        return new StringBuilder().
-            append("GridClientNodeMetricsAdapter [lastUpdateTime=").
-            append(lastUpdateTime).
-            append(", maxActiveJobs=").append(maxActiveJobs).
-            append(", curActiveJobs=").append(curActiveJobs).
-            append(", avgActiveJobs=").append(avgActiveJobs).
-            append(", maxWaitingJobs=").append(maxWaitingJobs).
-            append(", curWaitingJobs=").append(curWaitingJobs).
-            append(", avgWaitingJobs=").append(avgWaitingJobs).
-            append(", maxRejectedJobs=").append(maxRejectedJobs).
-            append(", curRejectedJobs=").append(curRejectedJobs).
-            append(", avgRejectedJobs=").append(avgRejectedJobs).
-            append(", maxCancelledJobs=").append(maxCancelledJobs).
-            append(", curCancelledJobs=").append(curCancelledJobs).
-            append(", avgCancelledJobs=").append(avgCancelledJobs).
-            append(", totalRejectedJobs=").append(totalRejectedJobs).
-            append(", totalCancelledJobs=").append(totalCancelledJobs).
-            append(", totalExecutedJobs=").append(totalExecutedJobs).
-            append(", maxJobWaitTime=").append(maxJobWaitTime).
-            append(", curJobWaitTime=").append(curJobWaitTime).
-            append(", avgJobWaitTime=").append(avgJobWaitTime).
-            append(", maxJobExecTime=").append(maxJobExecTime).
-            append(", curJobExecTime=").append(curJobExecTime).
-            append(", avgJobExecTime=").append(avgJobExecTime).
-            append(", totalExecTasks=").append(totalExecTasks).
-            append(", totalIdleTime=").append(totalIdleTime).
-            append(", curIdleTime=").append(curIdleTime).
-            append(", availProcs=").append(availProcs).
-            append(", load=").append(load).
-            append(", avgLoad=").append(avgLoad).
-            append(", gcLoad=").append(gcLoad).
-            append(", heapInit=").append(heapInit).
-            append(", heapUsed=").append(heapUsed).
-            append(", heapCommitted=").append(heapCommitted).
-            append(", heapMax=").append(heapMax).
-            append(", nonHeapInit=").append(nonHeapInit).
-            append(", nonHeapUsed=").append(nonHeapUsed).
-            append(", nonHeapCommitted=").append(nonHeapCommitted).
-            append(", nonHeapMax=").append(nonHeapMax).
-            append(", upTime=").append(upTime).
-            append(", startTime=").append(startTime).
-            append(", nodeStartTime=").append(nodeStartTime).
-            append(", threadCnt=").append(threadCnt).
-            append(", peakThreadCnt=").append(peakThreadCnt).
-            append(", startedThreadCnt=").append(startedThreadCnt).
-            append(", daemonThreadCnt=").append(daemonThreadCnt).
-            append(", fileSysFreeSpace=").append(fileSysFreeSpace).
-            append(", fileSysTotalSpace=").append(fileSysTotalSpace).
-            append(", fileSysUsableSpace=").append(fileSysUsableSpace).
-            append(", lastDataVer=").append(lastDataVer).
-            append(", sentMsgsCnt=").append(sentMsgsCnt).
-            append(", sentBytesCnt=").append(sentBytesCnt).
-            append(", rcvdMsgsCnt=").append(rcvdMsgsCnt).
-            append(", rcvdBytesCnt=").append(rcvdBytesCnt).
-
-            append("]").
-            toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b5b2f309/modules/core/src/main/java/org/apache/ignite/client/impl/GridClientThreadFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/client/impl/GridClientThreadFactory.java b/modules/core/src/main/java/org/apache/ignite/client/impl/GridClientThreadFactory.java
deleted file mode 100644
index ba6fdde..0000000
--- a/modules/core/src/main/java/org/apache/ignite/client/impl/GridClientThreadFactory.java
+++ /dev/null
@@ -1,62 +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.client.impl;
-
-import org.jetbrains.annotations.*;
-
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-
-/**
- * Delegating thread factory which forces all spawned thread to be daemons.
- */
-public class GridClientThreadFactory implements ThreadFactory {
-    /** Pool number. */
-    private static final AtomicInteger poolCtr = new AtomicInteger(1);
-
-    /** Thread number. */
-    private final AtomicInteger threadCtr = new AtomicInteger(1);
-
-    /** Prefix. */
-    private final String prefix;
-
-    /** Daemon flag. */
-    private final boolean daemon;
-
-    /**
-     * Constructor.
-     *
-     * @param name Name prefix.
-     * @param daemon Daemon flag.
-     */
-    public GridClientThreadFactory(String name, boolean daemon) {
-        this.daemon = daemon;
-
-        prefix = "gridgain-client-" + name + "-" + poolCtr.getAndIncrement() + "-";
-    }
-
-    /** {@inheritDoc} */
-    @Override public Thread newThread(@NotNull Runnable r) {
-        Thread thread = new Thread(r, prefix + threadCtr.incrementAndGet());
-
-        if (daemon)
-            thread.setDaemon(true);
-
-        return thread;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b5b2f309/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnection.java b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnection.java
deleted file mode 100644
index a5ce91d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnection.java
+++ /dev/null
@@ -1,531 +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.client.impl.connection;
-
-import org.apache.ignite.client.impl.*;
-import org.apache.ignite.internal.client.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.jetbrains.annotations.*;
-
-import javax.net.ssl.*;
-import java.net.*;
-import java.util.*;
-
-import static org.apache.ignite.client.impl.connection.GridClientConnectionCloseReason.*;
-
-/**
- * Facade for all possible network communications between client and server. Introduced to hide
- * protocol implementation (TCP, HTTP) from client code.
- */
-public abstract class GridClientConnection {
-    /** Topology */
-    protected GridClientTopology top;
-
-    /** Client id. */
-    protected final UUID clientId;
-
-    /** Server address this connection connected to */
-    private InetSocketAddress srvAddr;
-
-    /** SSL context to use if ssl is enabled. */
-    private SSLContext sslCtx;
-
-    /** Client credentials. */
-    private Object cred;
-
-    /** Reason why connection was closed. {@code null} means connection is still alive. */
-    protected volatile GridClientConnectionCloseReason closeReason;
-
-    /**
-     * Creates a facade.
-     *
-     * @param clientId Client identifier.
-     * @param srvAddr Server address this connection connected to.
-     * @param sslCtx SSL context to use if SSL is enabled, {@code null} otherwise.
-     * @param top Topology.
-     * @param cred Client credentials.
-     */
-    protected GridClientConnection(UUID clientId, InetSocketAddress srvAddr, SSLContext sslCtx, GridClientTopology top,
-        Object cred) {
-        assert top != null;
-
-        this.clientId = clientId;
-        this.srvAddr = srvAddr;
-        this.top = top;
-        this.sslCtx = sslCtx;
-        this.cred = cred;
-    }
-
-    /**
-     * Closes connection facade.
-     *
-     * @param reason Why this connection should be closed.
-     * @param waitCompletion If {@code true} this method will wait until all pending requests are handled.
-     */
-    abstract void close(GridClientConnectionCloseReason reason, boolean waitCompletion);
-
-    /**
-     * Closes connection facade if no requests are in progress.
-     *
-     * @param idleTimeout Idle timeout.
-     * @return {@code True} if no requests were in progress and client was closed, {@code false} otherwise.
-     */
-    abstract boolean closeIfIdle(long idleTimeout);
-
-    /**
-     * Gets server address this connection connected to.
-     *
-     * @return Server address this connection connected to.
-     */
-    public InetSocketAddress serverAddress() {
-        return srvAddr;
-    }
-
-    /**
-     * Encodes cache flags to bit map.
-     *
-     * @param flagSet Set of flags to be encoded.
-     * @return Bit map.
-     */
-    public static int encodeCacheFlags(Collection<GridClientCacheFlag> flagSet) {
-        int bits = 0;
-
-        if (flagSet.contains(GridClientCacheFlag.SKIP_STORE))
-            bits |= 1;
-
-        if (flagSet.contains(GridClientCacheFlag.SKIP_SWAP))
-            bits |= 1 << 1;
-
-        if (flagSet.contains(GridClientCacheFlag.SYNC_COMMIT))
-            bits |= 1 << 2;
-
-        if (flagSet.contains(GridClientCacheFlag.INVALIDATE))
-            bits |= 1 << 4;
-
-        return bits;
-    }
-
-    /**
-     * Puts key-value pair into cache.
-     *
-     * @param cacheName Cache name.
-     * @param key Key.
-     * @param val Value.
-     * @param flags Cache flags to be enabled.
-     * @param destNodeId Destination node ID.
-     * @return If value was actually put.
-     * @throws GridClientConnectionResetException In case of error.
-     * @throws GridClientClosedException If client was manually closed before request was sent over network.
-     */
-    public <K, V> GridClientFutureAdapter<Boolean> cachePut(String cacheName, K key, V val,
-        Set<GridClientCacheFlag> flags, UUID destNodeId)
-        throws GridClientConnectionResetException, GridClientClosedException {
-        return cachePutAll(cacheName, Collections.singletonMap(key, val), flags, destNodeId);
-    }
-
-    /**
-     * Gets entry from the cache for specified key.
-     *
-     * @param cacheName Cache name.
-     * @param key Key.
-     * @param flags Cache flags to be enabled.
-     * @param destNodeId Destination node ID.
-     * @return Value.
-     * @throws GridClientConnectionResetException In case of error.
-     * @throws GridClientClosedException If client was manually closed before request was sent over network.
-     */
-    public <K, V> GridClientFutureAdapter<V> cacheGet(String cacheName, final K key, Set<GridClientCacheFlag> flags,
-        UUID destNodeId) throws GridClientConnectionResetException, GridClientClosedException {
-        final GridClientFutureAdapter<Map<K, V>> res = cacheGetAll(cacheName, Collections.singleton(key), flags,
-            destNodeId);
-
-        return res.chain(new GridClientFutureCallback<Map<K, V>, V>() {
-            @Override public V onComplete(GridClientFuture<Map<K, V>> fut) throws GridClientException {
-                Map<K, V> map = fut.get();
-
-                return F.firstValue(map);
-            }
-        });
-    }
-
-    /**
-     * Removes entry from the cache for specified key.
-     *
-     * @param cacheName Cache name.
-     * @param key Key.
-     * @param flags Cache flags to be enabled.
-     * @param destNodeId Destination node ID.
-     * @return Whether entry was actually removed.
-     * @throws GridClientConnectionResetException In case of error.
-     * @throws org.apache.ignite.internal.client.GridClientClosedException If client was manually closed before request was sent over network.
-     */
-    public abstract <K> GridClientFutureAdapter<Boolean> cacheRemove(String cacheName, K key,
-        Set<GridClientCacheFlag> flags, UUID destNodeId)
-        throws GridClientConnectionResetException, GridClientClosedException;
-
-    /**
-     * Puts bundle of entries into cache.
-     *
-     * @param cacheName Cache name.
-     * @param entries Entries.
-     * @param flags Cache flags to be enabled.
-     * @param destNodeId Destination node ID.
-     * @return {@code True} if map contained more then one entry or if put succeeded in case of one entry,
-     *      {@code false} otherwise
-     * @throws GridClientConnectionResetException In case of error.
-     * @throws GridClientClosedException If client was manually closed before request was sent over network.
-     */
-    public abstract <K, V> GridClientFutureAdapter<Boolean> cachePutAll(String cacheName, Map<K, V> entries,
-        Set<GridClientCacheFlag> flags, UUID destNodeId)
-        throws GridClientConnectionResetException, GridClientClosedException;
-
-    /**
-     * Gets bundle of entries for specified keys from the cache.
-     *
-     * @param cacheName Cache name.
-     * @param keys Keys.
-     * @param flags Cache flags to be enabled.
-     * @param destNodeId Destination node ID.
-     * @return Entries.
-     * @throws GridClientConnectionResetException In case of error.
-     * @throws GridClientClosedException If client was manually closed before request was sent over network.
-     */
-    public abstract <K, V> GridClientFutureAdapter<Map<K, V>> cacheGetAll(String cacheName, Collection<K> keys,
-        Set<GridClientCacheFlag> flags, UUID destNodeId)
-        throws GridClientConnectionResetException, GridClientClosedException;
-
-    /**
-     * Removes bundle of entries for specified keys from the cache.
-     *
-     * @param cacheName Cache name.
-     * @param keys Keys.
-     * @param flags Cache flags to be enabled.
-     * @param destNodeId Destination node ID.
-     * @return Whether entries were actually removed
-     * @throws GridClientConnectionResetException In case of error.
-     * @throws GridClientClosedException If client was manually closed before request was sent over network.
-     */
-    public abstract <K> GridClientFutureAdapter<Boolean> cacheRemoveAll(String cacheName, Collection<K> keys,
-        Set<GridClientCacheFlag> flags, UUID destNodeId)
-        throws GridClientConnectionResetException, GridClientClosedException;
-
-    /**
-     * Replace key-value pair in cache if already exist.
-     *
-     * @param cacheName Cache name.
-     * @param key Key.
-     * @param val Value.
-     * @param flags Cache flags to be enabled.
-     * @param destNodeId Destination node ID.
-     * @return Whether value was actually replaced.
-     * @throws GridClientConnectionResetException In case of error.
-     * @throws GridClientClosedException If client was manually closed before request was sent over network.
-     */
-    public abstract <K, V> GridClientFutureAdapter<Boolean> cacheReplace(String cacheName, K key, V val,
-        Set<GridClientCacheFlag> flags, UUID destNodeId)
-        throws GridClientConnectionResetException, GridClientClosedException;
-
-    /**
-     * <table>
-     *     <tr><th>New value</th><th>Actual/old value</th><th>Behaviour</th></tr>
-     *     <tr><td>null     </td><td>null   </td><td>Remove entry for key.</td></tr>
-     *     <tr><td>newVal   </td><td>null   </td><td>Put newVal into cache if such key doesn't exist.</td></tr>
-     *     <tr><td>null     </td><td>oldVal </td><td>Remove if actual value oldVal is equals to value in cache.</td></tr>
-     *     <tr><td>newVal   </td><td>oldVal </td><td>Replace if actual value oldVal is equals to value in cache.</td></tr>
-     * </table>
-     *
-     * @param cacheName Cache name.
-     * @param key Key.
-     * @param newVal Value 1.
-     * @param oldVal Value 2.
-     * @param flags Cache flags to be enabled.
-     * @param destNodeId Destination node ID.
-     * @return Whether new value was actually set.
-     * @throws GridClientConnectionResetException In case of error.
-     * @throws GridClientClosedException If client was manually closed before request was sent over network.
-     */
-    public abstract <K, V> GridClientFutureAdapter<Boolean> cacheCompareAndSet(String cacheName, K key, V newVal,
-        V oldVal, Set<GridClientCacheFlag> flags, UUID destNodeId)
-        throws GridClientConnectionResetException, GridClientClosedException;
-
-    /**
-     * Gets cache metrics for the key.
-     *
-     * @param cacheName Cache name.
-     * @param destNodeId Destination node ID.
-     * @return Metrics.
-     * @throws GridClientConnectionResetException In case of error.
-     * @throws GridClientClosedException If client was manually closed before request was sent over network.
-     */
-    public abstract <K> GridClientFutureAdapter<GridClientDataMetrics> cacheMetrics(String cacheName, UUID destNodeId)
-        throws GridClientConnectionResetException, GridClientClosedException;
-
-    /**
-     * Append requested value to already cached one.
-     *
-     * @param cacheName Cache name.
-     * @param key Key.
-     * @param val Value to append to the cached one.
-     * @param flags Cache flags to be enabled.
-     * @param destNodeId Destination node ID.
-     * @return Whether new value was actually set.
-     * @throws GridClientConnectionResetException In case of error.
-     * @throws GridClientClosedException If client was manually closed before request was sent over network.
-     */
-    public abstract <K, V> GridClientFutureAdapter<Boolean> cacheAppend(String cacheName, K key, V val,
-        Set<GridClientCacheFlag> flags, UUID destNodeId)
-        throws GridClientConnectionResetException, GridClientClosedException;
-
-    /**
-     * Prepend requested value to already cached one.
-     *
-     * @param cacheName Cache name.
-     * @param key Key.
-     * @param val Value to prepend to the cached one.
-     * @param flags Cache flags to be enabled.
-     * @param destNodeId Destination node ID.
-     * @return Whether new value was actually set.
-     * @throws GridClientConnectionResetException In case of error.
-     * @throws GridClientClosedException If client was manually closed before request was sent over network.
-     */
-    public abstract <K, V> GridClientFutureAdapter<Boolean> cachePrepend(String cacheName, K key, V val,
-        Set<GridClientCacheFlag> flags, UUID destNodeId)
-        throws GridClientConnectionResetException, GridClientClosedException;
-
-    /**
-     * Execute task in the grid.
-     *
-     * @param taskName Task name.
-     * @param arg Task argument.
-     * @param destNodeId Destination node ID.
-     * @param keepPortables Keep portables flag.
-     * @return Task execution result.
-     * @throws GridClientConnectionResetException In case of error.
-     * @throws GridClientClosedException If client was manually closed before request was sent over network.
-     */
-    public abstract <R> GridClientFutureAdapter<R> execute(String taskName, Object arg, UUID destNodeId,
-        boolean keepPortables) throws GridClientConnectionResetException, GridClientClosedException;
-
-    /**
-     * Gets node by node ID.
-     *
-     * @param id Node ID.
-     * @param inclAttrs Whether to include attributes.
-     * @param inclMetrics Whether to include metrics.
-     * @param destNodeId Destination node ID.
-     * @return Node.
-     * @throws GridClientConnectionResetException In case of error.
-     * @throws GridClientClosedException If client was manually closed before request was sent over network.
-     */
-    public abstract GridClientFuture<GridClientNode> node(UUID id, boolean inclAttrs, boolean inclMetrics,
-        UUID destNodeId) throws GridClientConnectionResetException, GridClientClosedException;
-
-    /**
-     * Gets node by node IP.
-     *
-     * @param ipAddr IP address.
-     * @param inclAttrs Whether to include attributes.
-     * @param includeMetrics Whether to include metrics.
-     * @param destNodeId Destination node ID.
-     * @return Node.
-     * @throws GridClientConnectionResetException In case of error.
-     * @throws GridClientClosedException If client was manually closed before request was sent over network.
-     */
-    public abstract GridClientFuture<GridClientNode> node(String ipAddr, boolean inclAttrs,
-        boolean includeMetrics, UUID destNodeId)
-        throws GridClientConnectionResetException, GridClientClosedException;
-
-    /**
-     * Gets grid topology nodes.
-     *
-     * @param inclAttrs Whether to include attributes.
-     * @param inclMetrics Whether to include metrics.
-     * @param destNodeId Destination node ID.
-     * @return Nodes.
-     * @throws GridClientConnectionResetException In case of error.
-     * @throws GridClientClosedException If client was manually closed before request was sent over network.
-     */
-    public abstract GridClientFuture<List<GridClientNode>> topology(boolean inclAttrs, boolean inclMetrics,
-        @Nullable UUID destNodeId) throws GridClientConnectionResetException, GridClientClosedException;
-
-    /**
-     * Gets log entries.
-     *
-     * @param path Log file path.  If {@code null}, then default path will be used.
-     * @param fromLine Index of start line that should be retrieved.
-     * @param toLine Index of end line that should be retrieved.
-     * @param destNodeId Destination node ID.
-     * @return Log file contents.
-     * @throws GridClientConnectionResetException In case of error.
-     * @throws GridClientClosedException If client was manually closed before request was sent over network.
-     */
-    public abstract GridClientFuture<List<String>> log(@Nullable String path, int fromLine, int toLine, UUID destNodeId)
-        throws GridClientConnectionResetException, GridClientClosedException;
-
-    /**
-     * Forwards a message in raw form to the connected node. This method supposed to be used only inside router.
-     * The exact types of acceptable arguments and return values depend on connection implementation.
-     *
-     * @param body A raw message to send.
-     * @return Future holding server's response.
-     * @throws GridClientException If message forwarding failed.
-     */
-    public abstract GridClientFutureAdapter<?> forwardMessage(Object body) throws GridClientException;
-
-    /**
-     * @return {@code True} if connection is closed.
-     */
-    public boolean isClosed() {
-        return closeReason != null;
-    }
-
-    /**
-     * Gets SSLContext of this client connection.
-     *
-     * @return {@link SSLContext} instance.
-     */
-    protected SSLContext sslContext() {
-        return sslCtx;
-    }
-
-    /**
-     * Returns credentials for this client connection.
-     *
-     * @return Credentials.
-     */
-    protected Object credentials() {
-        return cred;
-    }
-
-    /**
-     * Safely gets long value by given key.
-     *
-     * @param map Map to get value from.
-     * @param key Metrics name.
-     * @return Value or -1, if not found.
-     */
-    protected long safeLong(Map<String, Number> map, String key) {
-        Number val = map.get(key);
-
-        if (val == null)
-            return -1;
-
-        return val.longValue();
-    }
-
-    /**
-     * Safely gets double value by given key.
-     *
-     * @param map Map to get value from.
-     * @param key Metrics name.
-     * @return Value or -1, if not found.
-     */
-    protected double safeDouble(Map<String, Number> map, String key) {
-        Number val = map.get(key);
-
-        if (val == null)
-            return -1;
-
-        return val.doubleValue();
-    }
-
-    /**
-     * Converts metrics map to metrics object.
-     *
-     * @param metricsMap Map to convert.
-     * @return Metrics object.
-     */
-    protected GridClientDataMetrics metricsMapToMetrics(Map<String, Number> metricsMap) {
-        GridClientDataMetricsAdapter metrics = new GridClientDataMetricsAdapter();
-
-        metrics.createTime(safeLong(metricsMap, "createTime"));
-        metrics.readTime(safeLong(metricsMap, "readTime"));
-        metrics.writeTime(safeLong(metricsMap, "writeTime"));
-        metrics.reads((int)safeLong(metricsMap, "reads"));
-        metrics.writes((int)safeLong(metricsMap, "writes"));
-        metrics.hits((int)safeLong(metricsMap, "hits"));
-        metrics.misses((int)safeLong(metricsMap, "misses"));
-
-        return metrics;
-    }
-
-    /**
-     * Check if this connection was closed and throws appropriate exception.
-     * This method should be used for synchronous connection state check.
-     *
-     * @param reason Close reason.
-     * @throws GridConnectionIdleClosedException If connection was closed as idle.
-     * @throws GridClientClosedException If client was closed by by external call.
-     * @throws GridClientConnectionResetException If connection was closed because of failure.
-     */
-    protected void checkClosed(GridClientConnectionCloseReason reason)
-        throws GridConnectionIdleClosedException, GridClientConnectionResetException, GridClientClosedException {
-        if (reason == CONN_IDLE)
-            throw new GridConnectionIdleClosedException("Connection was closed by idle thread (will " +
-                "reconnect): " + serverAddress());
-
-        if (reason == FAILED)
-            throw new GridClientConnectionResetException("Failed to perform request (connection failed before " +
-                "message is sent): " + serverAddress());
-
-        if (reason == CLIENT_CLOSED)
-            throw new GridClientClosedException("Failed to perform request (connection was closed before " +
-                "message is sent): " + serverAddress());
-    }
-
-    /**
-     * Build appropriate exception from the given close reason.
-     * This method should be used as a factory for exception to finish futures asynchronously.
-     *
-     * @param reason Close reason.
-     * @param cause Cause of connection close, or {@code null} in case of regular close.
-     * @return Exception.
-     */
-    protected GridClientException getCloseReasonAsException(GridClientConnectionCloseReason reason,
-        @Nullable Throwable cause) {
-        if (reason == CONN_IDLE)
-            return new GridConnectionIdleClosedException("Connection was closed by idle thread: " + serverAddress());
-
-        if (reason == FAILED)
-            return new GridClientConnectionResetException("Failed to perform request (connection failed): " +
-                serverAddress(), cause);
-
-        if (reason == CLIENT_CLOSED)
-            return new GridClientClosedException("Failed to perform request (client was closed): " + serverAddress());
-
-        return null;
-    }
-
-    /**
-     * @param reason Close reason.
-     * @param cause Cause of connection close, or {@code null} in case of regular close.
-     * @return Description of close reason for logging purpose.
-     */
-    protected String getCloseReasonMessage(GridClientConnectionCloseReason reason, @Nullable Throwable cause) {
-        if (reason == CONN_IDLE)
-            return "Connection was closed by idle thread";
-
-        if (reason == FAILED)
-            return cause != null ? "Connection failed, cause: " + cause.getMessage() : "Connection failed";
-
-        if (reason == CLIENT_CLOSED)
-            return "Client was closed";
-
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b5b2f309/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionCloseReason.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionCloseReason.java b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionCloseReason.java
deleted file mode 100644
index c82925a..0000000
--- a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionCloseReason.java
+++ /dev/null
@@ -1,32 +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.client.impl.connection;
-
-/**
- * Set of reasons why connection closed.
- */
-enum GridClientConnectionCloseReason {
-    /** Connection failed, IO exception or other unexpected result of request execution. */
-    FAILED,
-
-    /** Connection closed as idle. */
-    CONN_IDLE,
-
-    /** Client is closed and connection also shouldn't be used for new requests. */
-    CLIENT_CLOSED
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b5b2f309/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManager.java b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManager.java
deleted file mode 100644
index 2e0b535..0000000
--- a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManager.java
+++ /dev/null
@@ -1,71 +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.client.impl.connection;
-
-import org.apache.ignite.internal.client.*;
-import org.jetbrains.annotations.*;
-
-import java.net.*;
-import java.util.*;
-
-/**
- * Common interface for client connection managers.
- */
-public interface GridClientConnectionManager {
-    /**
-     * Tries to open initial connection and fetch topology using given server addresses.
-     *
-     * @param srvs Collection<InetSocketAddress> server addresses.
-     * @throws GridClientAuthenticationException If connection failed to authenticate on server.
-     * @throws GridClientException If manager failed to initialise,
-     * @throws InterruptedException If manager was interrupted while waiting for connection.
-     */
-    public void init(Collection<InetSocketAddress> srvs) throws GridClientException, InterruptedException;
-
-    /**
-     * Returns connection to the given node.
-     *
-     * @param node Node to connect with.
-     * @return Connection to use for operations, targeted for the given node.
-     * @throws GridServerUnreachableException If connection can't be established.
-     * @throws InterruptedException If manager was interrupted while waiting for connection
-     * to be established.
-     * @throws org.apache.ignite.internal.client.GridClientClosedException If connection manager has been closed.
-     */
-    public GridClientConnection connection(GridClientNode node)
-        throws GridServerUnreachableException, GridClientClosedException, InterruptedException;
-
-    /**
-     * Callback method, which should be called by clients when they get connectivity errors.
-     * It's main purpose is to allow connection manager to terminate broken connection
-     * early and, try to establish a new one for the consequent
-     * {@link #connection(GridClientNode)} calls.
-     *
-     * @param conn Failed connection.
-     * @param node Connected node.
-     * @param e Error that caused connection termination.
-     */
-    public void terminateConnection(GridClientConnection conn, @Nullable GridClientNode node, Throwable e);
-
-    /**
-     * Stops this instance of connection manager and terminates all connections.
-     * @param waitCompletion If {@code true} this method awaits termination of all connections
-     *      (and receiving responses for all pending requests), otherwise it will return immediately.
-     */
-    public void stop(boolean waitCompletion);
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b5b2f309/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java
deleted file mode 100644
index 5d58806..0000000
--- a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java
+++ /dev/null
@@ -1,763 +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.client.impl.connection;
-
-import org.apache.ignite.*;
-import org.apache.ignite.internal.client.*;
-import org.apache.ignite.internal.client.util.*;
-import org.apache.ignite.logger.java.*;
-import org.apache.ignite.client.impl.*;
-import org.apache.ignite.internal.processors.rest.client.message.*;
-import org.apache.ignite.plugin.security.*;
-import org.apache.ignite.internal.util.direct.*;
-import org.apache.ignite.internal.util.nio.*;
-import org.apache.ignite.internal.util.nio.ssl.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.jetbrains.annotations.*;
-
-import javax.net.ssl.*;
-import java.io.*;
-import java.net.*;
-import java.nio.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.logging.*;
-
-import static java.util.logging.Level.*;
-import static org.apache.ignite.client.impl.connection.GridClientConnectionCloseReason.*;
-import static org.apache.ignite.internal.GridNodeAttributes.*;
-
-/**
- * Cached connections manager.
- */
-abstract class GridClientConnectionManagerAdapter implements GridClientConnectionManager {
-    /** Count of reconnect retries before init considered failed. */
-    private static final int INIT_RETRY_CNT = 3;
-
-    /** Initialization retry interval. */
-    private static final int INIT_RETRY_INTERVAL = 1000;
-
-    /** Class logger. */
-    private final Logger log;
-
-    /** NIO server. */
-    private GridNioServer srv;
-
-    /** Active connections. */
-    private final ConcurrentMap<InetSocketAddress, GridClientConnection> conns = new ConcurrentHashMap<>();
-
-    /** Active connections of nodes. */
-    private final ConcurrentMap<UUID, GridClientConnection> nodeConns = new ConcurrentHashMap<>();
-
-    /** SSL context. */
-    private final SSLContext sslCtx;
-
-    /** Client configuration. */
-    protected final GridClientConfiguration cfg;
-
-    /** Topology. */
-    private final GridClientTopology top;
-
-    /** Client id. */
-    private final UUID clientId;
-
-    /** Router endpoints to use instead of topology info. */
-    private final Collection<InetSocketAddress> routers;
-
-    /** Closed flag. */
-    private volatile boolean closed;
-
-    /** Shared executor service. */
-    private final ExecutorService executor;
-
-    /** Endpoint striped lock. */
-    private final GridClientStripedLock endpointStripedLock = new GridClientStripedLock(16);
-
-    /** Service for ping requests, {@code null} if HTTP protocol is used. */
-    private final ScheduledExecutorService pingExecutor;
-
-    /** Marshaller ID. */
-    private final Byte marshId;
-
-    /** Message writer. */
-    @SuppressWarnings("FieldCanBeLocal")
-    private final GridNioMessageWriter msgWriter = new GridNioMessageWriter() {
-        @Override public boolean write(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, ByteBuffer buf) {
-            assert msg != null;
-            assert buf != null;
-
-            msg.messageWriter(this, nodeId);
-
-            return msg.writeTo(buf);
-        }
-
-        @Override public int writeFully(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, OutputStream out,
-            ByteBuffer buf) throws IOException {
-            assert msg != null;
-            assert out != null;
-            assert buf != null;
-            assert buf.hasArray();
-
-            msg.messageWriter(this, nodeId);
-
-            boolean finished = false;
-            int cnt = 0;
-
-            while (!finished) {
-                finished = msg.writeTo(buf);
-
-                out.write(buf.array(), 0, buf.position());
-
-                cnt += buf.position();
-
-                buf.clear();
-            }
-
-            return cnt;
-        }
-    };
-
-    /**
-     * @param clientId Client ID.
-     * @param sslCtx SSL context to enable secured connection or {@code null} to use unsecured one.
-     * @param cfg Client configuration.
-     * @param routers Routers or empty collection to use endpoints from topology info.
-     * @param top Topology.
-     * @param marshId Marshaller ID.
-     * @throws GridClientException In case of error.
-     */
-    @SuppressWarnings("unchecked")
-    protected GridClientConnectionManagerAdapter(UUID clientId,
-        SSLContext sslCtx,
-        GridClientConfiguration cfg,
-        Collection<InetSocketAddress> routers,
-        GridClientTopology top,
-        @Nullable Byte marshId)
-        throws GridClientException {
-        assert clientId != null : "clientId != null";
-        assert cfg != null : "cfg != null";
-        assert routers != null : "routers != null";
-        assert top != null : "top != null";
-
-        this.clientId = clientId;
-        this.sslCtx = sslCtx;
-        this.cfg = cfg;
-        this.routers = new ArrayList<>(routers);
-        this.top = top;
-
-        log = Logger.getLogger(getClass().getName());
-
-        executor = cfg.getExecutorService() != null ? cfg.getExecutorService() :
-            Executors.newCachedThreadPool(new GridClientThreadFactory("exec", true));
-
-        pingExecutor = cfg.getProtocol() == GridClientProtocol.TCP ? Executors.newScheduledThreadPool(
-            Runtime.getRuntime().availableProcessors(), new GridClientThreadFactory("exec", true)) : null;
-
-        this.marshId = marshId;
-
-        if (marshId == null && cfg.getMarshaller() == null)
-            throw new GridClientException("Failed to start client (marshaller is not configured).");
-
-        if (cfg.getProtocol() == GridClientProtocol.TCP) {
-            try {
-                IgniteLogger gridLog = new IgniteJavaLogger(false);
-
-                GridNioFilter[] filters;
-
-                GridNioMessageReader msgReader = new GridNioMessageReader() {
-                    @Override public boolean read(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg,
-                        ByteBuffer buf) {
-                        assert msg != null;
-                        assert buf != null;
-
-                        msg.messageReader(this, nodeId);
-
-                        return msg.readFrom(buf);
-                    }
-
-                    @Nullable @Override public GridTcpMessageFactory messageFactory() {
-                        return null;
-                    }
-                };
-
-                GridNioFilter codecFilter = new GridNioCodecFilter(new NioParser(msgReader), gridLog, true);
-
-                if (sslCtx != null) {
-                    GridNioSslFilter sslFilter = new GridNioSslFilter(sslCtx, gridLog);
-
-                    sslFilter.directMode(true);
-                    sslFilter.clientMode(true);
-
-                    filters = new GridNioFilter[]{codecFilter, sslFilter};
-                }
-                else
-                    filters = new GridNioFilter[]{codecFilter};
-
-                srv = GridNioServer.builder().address(U.getLocalHost())
-                    .port(-1)
-                    .listener(new NioListener(log))
-                    .filters(filters)
-                    .logger(gridLog)
-                    .selectorCount(Runtime.getRuntime().availableProcessors())
-                    .sendQueueLimit(1024)
-                    .byteOrder(ByteOrder.nativeOrder())
-                    .tcpNoDelay(cfg.isTcpNoDelay())
-                    .directBuffer(true)
-                    .directMode(true)
-                    .socketReceiveBufferSize(0)
-                    .socketSendBufferSize(0)
-                    .idleTimeout(Long.MAX_VALUE)
-                    .gridName("gridClient")
-                    .messageWriter(msgWriter)
-                    .daemon(cfg.isDaemon())
-                    .build();
-
-                srv.start();
-            }
-            catch (IOException | IgniteCheckedException e) {
-                throw new GridClientException("Failed to start connection server.", e);
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("BusyWait")
-    @Override public void init(Collection<InetSocketAddress> srvs) throws GridClientException, InterruptedException {
-        init0();
-
-        GridClientException firstEx = null;
-
-        for (int i = 0; i < INIT_RETRY_CNT; i++) {
-            Collection<InetSocketAddress> srvsCp = new ArrayList<>(srvs);
-
-            while (!srvsCp.isEmpty()) {
-                GridClientConnection conn = null;
-
-                try {
-                    conn = connect(null, srvsCp);
-
-                    conn.topology(cfg.isAutoFetchAttributes(), cfg.isAutoFetchMetrics(), null).get();
-
-                    return;
-                }
-                catch (GridServerUnreachableException e) {
-                    // No connection could be opened to any of initial addresses - exit to retry loop.
-                    assert conn == null :
-                        "GridClientConnectionResetException was thrown from GridClientConnection#topology";
-
-                    if (firstEx == null)
-                        firstEx = e;
-
-                    break;
-                }
-                catch (GridClientConnectionResetException e) {
-                    // Connection was established but topology update failed -
-                    // trying other initial addresses if any.
-                    assert conn != null : "GridClientConnectionResetException was thrown from connect()";
-
-                    if (firstEx == null)
-                        firstEx = e;
-
-                    if (!srvsCp.remove(conn.serverAddress()))
-                        // We have misbehaving collection or equals - just exit to avoid infinite loop.
-                        break;
-                }
-            }
-
-            Thread.sleep(INIT_RETRY_INTERVAL);
-        }
-
-        for (GridClientConnection c : conns.values()) {
-            conns.remove(c.serverAddress(), c);
-
-            c.close(FAILED, false);
-        }
-
-        throw firstEx;
-    }
-
-    /**
-     * Additional initialization.
-     *
-     * @throws GridClientException In case of error.
-     */
-    protected abstract void init0() throws GridClientException;
-
-    /**
-     * Gets active communication facade.
-     *
-     * @param node Remote node to which connection should be established.
-     * @throws GridServerUnreachableException If none of the servers can be reached after the exception.
-     * @throws GridClientClosedException If client was closed manually.
-     * @throws InterruptedException If connection was interrupted.
-     */
-    @Override public GridClientConnection connection(GridClientNode node)
-        throws GridClientClosedException, GridServerUnreachableException, InterruptedException {
-        assert node != null;
-
-        // Use router's connections if defined.
-        if (!routers.isEmpty())
-            return connection(null, routers);
-
-        GridClientConnection conn = nodeConns.get(node.nodeId());
-
-        if (conn != null) {
-            // Ignore closed connections.
-            if (conn.closeIfIdle(cfg.getMaxConnectionIdleTime()))
-                closeIdle();
-            else
-                return conn;
-        }
-
-        // Use node's connection, if node is available over rest.
-        Collection<InetSocketAddress> endpoints = node.availableAddresses(cfg.getProtocol(), true);
-
-        List<InetSocketAddress> resolvedEndpoints = new ArrayList<>(endpoints.size());
-
-        for (InetSocketAddress endpoint : endpoints)
-            if (!endpoint.isUnresolved())
-                resolvedEndpoints.add(endpoint);
-
-        if (resolvedEndpoints.isEmpty()) {
-            throw new GridServerUnreachableException("No available endpoints to connect " +
-                "(is rest enabled for this node?): " + node);
-        }
-
-        boolean sameHost = node.attributes().isEmpty() ||
-            F.containsAny(U.allLocalMACs(), node.attribute(ATTR_MACS).toString().split(", "));
-
-        Collection<InetSocketAddress> srvs = new LinkedHashSet<>();
-
-        if (sameHost) {
-            Collections.sort(resolvedEndpoints, U.inetAddressesComparator(true));
-
-            srvs.addAll(resolvedEndpoints);
-        }
-        else {
-            for (InetSocketAddress endpoint : resolvedEndpoints)
-                if (!endpoint.getAddress().isLoopbackAddress())
-                    srvs.add(endpoint);
-        }
-
-        return connection(node.nodeId(), srvs);
-    }
-
-    /**
-     * Returns connection to one of the given addresses.
-     *
-     * @param nodeId {@code UUID} of node for mapping with connection.
-     *      {@code null} if no need of mapping.
-     * @param srvs Collection of addresses to connect to.
-     * @return Connection to use for operations, targeted for the given node.
-     * @throws GridServerUnreachableException If connection can't be established.
-     * @throws GridClientClosedException If connections manager has been closed already.
-     * @throws InterruptedException If connection was interrupted.
-     */
-    public GridClientConnection connection(@Nullable UUID nodeId, Collection<InetSocketAddress> srvs)
-        throws GridServerUnreachableException, GridClientClosedException, InterruptedException {
-        if (srvs == null || srvs.isEmpty())
-            throw new GridServerUnreachableException("Failed to establish connection to the grid" +
-                " (address list is empty).");
-
-        checkClosed();
-
-        // Search for existent connection.
-        for (InetSocketAddress endPoint : srvs) {
-            assert endPoint != null;
-
-            GridClientConnection conn = conns.get(endPoint);
-
-            if (conn == null)
-                continue;
-
-            // Ignore closed connections.
-            if (conn.closeIfIdle(cfg.getMaxConnectionIdleTime())) {
-                closeIdle();
-
-                continue;
-            }
-
-            if (nodeId != null)
-                nodeConns.put(nodeId, conn);
-
-            return conn;
-        }
-
-        return connect(nodeId, srvs);
-    }
-
-    /**
-     * Creates a connected facade and returns it. Called either from constructor or inside
-     * a write lock.
-     *
-     * @param nodeId {@code UUID} of node for mapping with connection.
-     *      {@code null} if no need of mapping.
-     * @param srvs List of server addresses that this method will try to connect to.
-     * @return Established connection.
-     * @throws GridServerUnreachableException If none of the servers can be reached.
-     * @throws InterruptedException If connection was interrupted.
-     */
-    protected GridClientConnection connect(@Nullable UUID nodeId, Collection<InetSocketAddress> srvs)
-        throws GridServerUnreachableException, InterruptedException {
-        if (srvs.isEmpty())
-            throw new GridServerUnreachableException("Failed to establish connection to the grid node (address " +
-                "list is empty).");
-
-        Exception cause = null;
-
-        for (InetSocketAddress srv : srvs) {
-            try {
-                return connect(nodeId, srv);
-            }
-            catch (InterruptedException e) {
-                throw e;
-            }
-            catch (Exception e) {
-                if (cause == null)
-                    cause = e;
-                else if (log.isLoggable(INFO))
-                    log.info("Unable to connect to grid node [srvAddr=" + srv + ", msg=" + e.getMessage() + ']');
-            }
-        }
-
-        assert cause != null;
-
-        throw new GridServerUnreachableException("Failed to connect to any of the servers in list: " + srvs, cause);
-    }
-
-    /**
-     * Create new connection to specified server.
-     *
-     * @param nodeId {@code UUID} of node for mapping with connection.
-     *      {@code null} if no need of mapping.
-     * @param addr Remote socket to connect.
-     * @return Established connection.
-     * @throws IOException If connection failed.
-     * @throws GridClientException If protocol error happened.
-     * @throws InterruptedException If thread was interrupted before connection was established.
-     */
-    protected GridClientConnection connect(@Nullable UUID nodeId, InetSocketAddress addr)
-        throws IOException, GridClientException, InterruptedException {
-        endpointStripedLock.lock(addr);
-
-        try {
-            GridClientConnection old = conns.get(addr);
-
-            if (old != null) {
-                if (old.isClosed()) {
-                    conns.remove(addr, old);
-
-                    if (nodeId != null)
-                        nodeConns.remove(nodeId, old);
-                }
-                else {
-                    if (nodeId != null)
-                        nodeConns.put(nodeId, old);
-
-                    return old;
-                }
-            }
-
-            GridSecurityCredentials cred = null;
-
-            try {
-                if (cfg.getSecurityCredentialsProvider() != null)
-                    cred = cfg.getSecurityCredentialsProvider().credentials();
-            }
-            catch (IgniteCheckedException e) {
-                throw new GridClientException("Failed to obtain client credentials.", e);
-            }
-
-            GridClientConnection conn;
-
-            if (cfg.getProtocol() == GridClientProtocol.TCP) {
-                conn = new GridClientNioTcpConnection(srv, clientId, addr, sslCtx, pingExecutor,
-                    cfg.getConnectTimeout(), cfg.getPingInterval(), cfg.getPingTimeout(),
-                    cfg.isTcpNoDelay(), cfg.getMarshaller(), marshId, top, cred, keepPortablesThreadLocal());
-            }
-            else
-                throw new GridServerUnreachableException("Failed to create client (protocol is not supported): " +
-                    cfg.getProtocol());
-
-            old = conns.putIfAbsent(addr, conn);
-
-            assert old == null;
-
-            if (nodeId != null)
-                nodeConns.put(nodeId, conn);
-
-            return conn;
-        }
-        finally {
-            endpointStripedLock.unlock(addr);
-        }
-    }
-
-    /**
-     * @return Get thread local used to enable keep portables mode.
-     */
-    protected ThreadLocal<Boolean> keepPortablesThreadLocal() {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void terminateConnection(GridClientConnection conn, GridClientNode node, Throwable e) {
-        if (log.isLoggable(Level.FINE))
-            log.fine("Connection with remote node was terminated [node=" + node + ", srvAddr=" +
-                conn.serverAddress() + ", errMsg=" + e.getMessage() + ']');
-
-        closeIdle();
-
-        conn.close(FAILED, false);
-    }
-
-    /**
-     * Closes all opened connections.
-     *
-     * @param waitCompletion If {@code true} waits for all pending requests to be proceeded.
-     */
-    @SuppressWarnings("TooBroadScope")
-    @Override public void stop(boolean waitCompletion) {
-        Collection<GridClientConnection> closeConns;
-
-        if (closed)
-            return;
-
-        // Mark manager as closed.
-        closed = true;
-
-        // Remove all connections from cache.
-        closeConns = new ArrayList<>(conns.values());
-
-        conns.clear();
-
-        nodeConns.clear();
-
-        // Close old connection outside the writer lock.
-        for (GridClientConnection conn : closeConns)
-            conn.close(CLIENT_CLOSED, waitCompletion);
-
-        if (pingExecutor != null)
-            GridClientUtils.shutdownNow(GridClientConnectionManager.class, pingExecutor, log);
-
-        GridClientUtils.shutdownNow(GridClientConnectionManager.class, executor, log);
-
-        if (srv != null)
-            srv.stop();
-    }
-
-    /**
-     * Close all connections idling for more then
-     * {@link GridClientConfiguration#getMaxConnectionIdleTime()} milliseconds.
-     */
-    @SuppressWarnings("ForLoopReplaceableByForEach")
-    private void closeIdle() {
-        for (Iterator<Map.Entry<UUID, GridClientConnection>> it = nodeConns.entrySet().iterator(); it.hasNext(); ) {
-            Map.Entry<UUID, GridClientConnection> entry = it.next();
-
-            GridClientConnection conn = entry.getValue();
-
-            if (conn.closeIfIdle(cfg.getMaxConnectionIdleTime())) {
-                conns.remove(conn.serverAddress(), conn);
-
-                nodeConns.remove(entry.getKey(), conn);
-            }
-        }
-
-        for (GridClientConnection conn : conns.values())
-            if (conn.closeIfIdle(cfg.getMaxConnectionIdleTime()))
-                conns.remove(conn.serverAddress(), conn);
-    }
-
-    /**
-     * Checks and throws an exception if this client was closed.
-     *
-     * @throws GridClientClosedException If client was closed.
-     */
-    private void checkClosed() throws GridClientClosedException {
-        if (closed)
-            throw new GridClientClosedException("Client was closed (no public methods of client can be used anymore).");
-    }
-
-    /**
-     */
-    private static class NioListener implements GridNioServerListener {
-        /** */
-        private final Logger log;
-
-        /**
-         * @param log Logger.
-         */
-        private NioListener(Logger log) {
-            this.log = log;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void onConnected(GridNioSession ses) {
-            if (log.isLoggable(Level.FINE))
-                log.fine("Session connected: " + ses);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void onDisconnected(GridNioSession ses, @Nullable Exception e) {
-            if (log.isLoggable(Level.FINE))
-                log.fine("Session disconnected: " + ses);
-
-            GridClientFutureAdapter<Boolean> handshakeFut =
-                ses.removeMeta(GridClientNioTcpConnection.SES_META_HANDSHAKE);
-
-            if (handshakeFut != null)
-                handshakeFut.onDone(
-                    new GridClientConnectionResetException("Failed to perform handshake (connection failed)."));
-            else {
-                GridClientNioTcpConnection conn = ses.meta(GridClientNioTcpConnection.SES_META_CONN);
-
-                if (conn != null)
-                    conn.close(FAILED, false);
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override public void onMessage(GridNioSession ses, Object msg) {
-            GridClientFutureAdapter<Boolean> handshakeFut =
-                ses.removeMeta(GridClientNioTcpConnection.SES_META_HANDSHAKE);
-
-            if (handshakeFut != null) {
-                assert msg instanceof GridClientHandshakeResponse;
-
-                handleHandshakeResponse(handshakeFut, (GridClientHandshakeResponse)msg);
-            }
-            else {
-                GridClientNioTcpConnection conn = ses.meta(GridClientNioTcpConnection.SES_META_CONN);
-
-                assert conn != null;
-
-                if (msg instanceof GridClientMessageWrapper) {
-                    GridClientMessageWrapper req = (GridClientMessageWrapper)msg;
-
-                    if (req.messageSize() != 0) {
-                        assert req.message() != null;
-
-                        conn.handleResponse(req);
-                    }
-                    else
-                        conn.handlePingResponse();
-                }
-                else {
-                    assert msg instanceof GridClientPingPacket : msg;
-
-                    conn.handlePingResponse();
-                }
-            }
-        }
-
-        /**
-         * Handles client handshake response.
-         *
-         * @param handshakeFut Future.
-         * @param msg A handshake response.
-         */
-        private void handleHandshakeResponse(GridClientFutureAdapter<Boolean> handshakeFut,
-            GridClientHandshakeResponse msg) {
-            byte rc = msg.resultCode();
-
-            if (rc != GridClientHandshakeResponse.OK.resultCode()) {
-                handshakeFut.onDone(new GridClientHandshakeException(rc,
-                    "Handshake failed due to internal error (see server log for more details)."));
-            }
-            else
-                handshakeFut.onDone(true);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void onSessionWriteTimeout(GridNioSession ses) {
-            if (log.isLoggable(Level.FINE))
-                log.fine("Closing NIO session because of write timeout.");
-
-            ses.close();
-        }
-
-        /** {@inheritDoc} */
-        @Override public void onSessionIdleTimeout(GridNioSession ses) {
-            if (log.isLoggable(Level.FINE))
-                log.fine("Closing NIO session because of idle timeout.");
-
-            ses.close();
-        }
-    }
-
-    /**
-     *
-     */
-    private static class NioParser implements GridNioParser {
-        /** Message metadata key. */
-        private static final int MSG_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
-
-        /** Message reader. */
-        private final GridNioMessageReader msgReader;
-
-        /**
-         * @param msgReader Message reader.
-         */
-        NioParser(GridNioMessageReader msgReader) {
-            this.msgReader = msgReader;
-        }
-
-        /** {@inheritDoc} */
-        @Nullable @Override public Object decode(GridNioSession ses, ByteBuffer buf) throws IOException, IgniteCheckedException {
-            GridClientFutureAdapter<?> handshakeFut = ses.meta(GridClientNioTcpConnection.SES_META_HANDSHAKE);
-
-            if (handshakeFut != null) {
-                byte code = buf.get();
-
-                return new GridClientHandshakeResponse(code);
-            }
-
-            GridTcpCommunicationMessageAdapter msg = ses.removeMeta(MSG_META_KEY);
-
-            if (msg == null && buf.hasRemaining()) {
-                byte type = buf.get();
-
-                if (type == GridClientMessageWrapper.REQ_HEADER)
-                    msg = new GridClientMessageWrapper();
-                else
-                    throw new IOException("Invalid message type: " + type);
-            }
-
-            boolean finished = false;
-
-            if (buf.hasRemaining())
-                finished = msgReader.read(null, msg, buf);
-
-            if (finished)
-                return msg;
-            else {
-                ses.addMeta(MSG_META_KEY, msg);
-
-                return null;
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override public ByteBuffer encode(GridNioSession ses, Object msg) throws IOException, IgniteCheckedException {
-            // No encoding needed for direct messages.
-            throw new UnsupportedEncodingException();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b5b2f309/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerOsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerOsImpl.java b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerOsImpl.java
deleted file mode 100644
index 968bee6..0000000
--- a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerOsImpl.java
+++ /dev/null
@@ -1,47 +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.client.impl.connection;
-
-import org.apache.ignite.internal.client.*;
-
-import javax.net.ssl.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * Open source version of connection manager.
- */
-public class GridClientConnectionManagerOsImpl extends GridClientConnectionManagerAdapter {
-    /**
-     * @param clientId Client ID.
-     * @param sslCtx SSL context to enable secured connection or {@code null} to use unsecured one.
-     * @param cfg Client configuration.
-     * @param routers Routers or empty collection to use endpoints from topology info.
-     * @param top Topology.
-     * @throws GridClientException In case of error.
-     */
-    public GridClientConnectionManagerOsImpl(UUID clientId, SSLContext sslCtx, GridClientConfiguration cfg,
-        Collection<InetSocketAddress> routers, GridClientTopology top, Byte marshId) throws GridClientException {
-        super(clientId, sslCtx, cfg, routers, top, marshId);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void init0() throws GridClientException {
-        // No-op.
-    }
-}


Mime
View raw message