ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [37/50] [abbrv] incubator-ignite git commit: IGNITE-49 Fixed notes
Date Wed, 28 Jan 2015 09:16:28 GMT
IGNITE-49 Fixed notes


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

Branch: refs/heads/ignite-72
Commit: 8be6dbe9bd934f4a1125225186e75b560639d920
Parents: 8b6cd80
Author: nikolay_tikhonov <ntikhonov@gridgain.com>
Authored: Tue Jan 27 18:29:28 2015 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Tue Jan 27 18:29:28 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/ClusterMetricsSnapshot.java | 155 ++++-------
 .../ignite/mxbean/IgniteStandardMBean.java      | 275 -------------------
 2 files changed, 49 insertions(+), 381 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8be6dbe9/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsSnapshot.java
b/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsSnapshot.java
index b50ab60..1bfe6a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsSnapshot.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsSnapshot.java
@@ -35,55 +35,55 @@ import static java.lang.Math.*;
 public class ClusterMetricsSnapshot implements ClusterMetrics {
     /** 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*/;
+        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*/;
 
     /** */
     private long lastUpdateTime = -1;
@@ -1391,63 +1391,6 @@ public class ClusterMetricsSnapshot implements ClusterMetrics {
     }
 
     /** {@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/8be6dbe9/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteStandardMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteStandardMBean.java
b/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteStandardMBean.java
deleted file mode 100644
index 4789bc6..0000000
--- a/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteStandardMBean.java
+++ /dev/null
@@ -1,275 +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.mxbean;
-
-import org.apache.ignite.internal.util.typedef.internal.*;
-import javax.management.*;
-import java.lang.reflect.*;
-import java.util.*;
-
-/**
- * Extension of standard Java MBean. Overrides some hooks to return
- * annotation based descriptions.
- */
-public class IgniteStandardMBean extends StandardMBean {
-    /**
-     * Objects maps from primitive classes to primitive object classes.
-     */
-    private static final Map<String, Class<?>> primCls = new HashMap<>();
-
-    /**
-     * Static constructor.
-     */
-    static{
-        primCls.put(Boolean.TYPE.toString().toLowerCase(), Boolean.TYPE);
-        primCls.put(Character.TYPE.toString().toLowerCase(), Character.TYPE);
-        primCls.put(Byte.TYPE.toString().toLowerCase(), Byte.TYPE);
-        primCls.put(Short.TYPE.toString().toLowerCase(), Short.TYPE);
-        primCls.put(Integer.TYPE.toString().toLowerCase(), Integer.TYPE);
-        primCls.put(Long.TYPE.toString().toLowerCase(), Long.TYPE);
-        primCls.put(Float.TYPE.toString().toLowerCase(), Float.TYPE);
-        primCls.put(Double.TYPE.toString().toLowerCase(), Double.TYPE);
-    }
-
-    /**
-     * Make a DynamicMBean out of the object implementation, using the specified
-     * mbeanInterface class.
-     *
-     * @param implementation The implementation of this MBean.
-     * @param mbeanInterface The Management Interface exported by this
-     *      MBean's implementation. If {@code null}, then this
-     *      object will use standard JMX design pattern to determine
-     *      the management interface associated with the given
-     *      implementation.
-     *      If {@code null} value passed then information will be built by
-     *      {@link StandardMBean}
-     *
-     * @exception NotCompliantMBeanException if the {@code mbeanInterface}
-     *    does not follow JMX design patterns for Management Interfaces, or
-     *    if the given {@code implementation} does not implement the
-     *    specified interface.
-     */
-    public <T> IgniteStandardMBean(T implementation, Class<T> mbeanInterface)
-        throws NotCompliantMBeanException {
-        super(implementation, mbeanInterface);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected String getDescription(MBeanAttributeInfo info) {
-        String str = super.getDescription(info);
-
-        String methodName = (info.isIs() ? "is" : "get") + info.getName();
-
-        try {
-            // Recursively get method.
-            Method mtd = findMethod(getMBeanInterface(), methodName, new Class[]{});
-
-            if (mtd != null) {
-                IgniteMBeanDescription desc = mtd.getAnnotation(IgniteMBeanDescription.class);
-
-                if (desc != null) {
-                    str = desc.value();
-
-                    assert str != null : "Failed to find method: " + mtd;
-                    assert str.trim().length() > 0 : "Method description cannot be empty:
" + mtd;
-
-                    // Enforce proper English.
-                    assert Character.isUpperCase(str.charAt(0)) == true :
-                        "Description must start with upper case: " + str;
-
-                    assert str.charAt(str.length() - 1) == '.' : "Description must end with
period: " + str;
-                }
-            }
-        }
-        catch (SecurityException e) {
-            // No-op. Default value will be returned.
-        }
-
-        return str;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected String getDescription(MBeanInfo info) {
-        String str = super.getDescription(info);
-
-        // Return either default one or given by annotation.
-        IgniteMBeanDescription desc = U.getAnnotation(getMBeanInterface(), IgniteMBeanDescription.class);
-
-        if (desc != null) {
-            str = desc.value();
-
-            assert str != null;
-            assert str.trim().length() > 0;
-
-            // Enforce proper English.
-            assert Character.isUpperCase(str.charAt(0)) == true : str;
-            assert str.charAt(str.length() - 1) == '.' : str;
-        }
-
-        return str;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected String getDescription(MBeanOperationInfo info) {
-        String str = super.getDescription(info);
-
-        try {
-            Method m = getMethod(info);
-
-            IgniteMBeanDescription desc = m.getAnnotation(IgniteMBeanDescription.class);
-
-            if (desc != null) {
-                str = desc.value();
-
-                assert str != null;
-                assert str.trim().length() > 0;
-
-                // Enforce proper English.
-                assert Character.isUpperCase(str.charAt(0)) == true : str;
-                assert str.charAt(str.length() - 1) == '.' : str;
-            }
-        }
-        catch (SecurityException | ClassNotFoundException e) {
-            // No-op. Default value will be returned.
-        }
-
-        return str;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected String getDescription(MBeanOperationInfo op, MBeanParameterInfo param,
int seq) {
-        String str = super.getDescription(op, param, seq);
-
-        try {
-            Method m = getMethod(op);
-
-            IgniteMBeanParametersDescriptions decsAnn = m.getAnnotation(IgniteMBeanParametersDescriptions.class);
-
-            if (decsAnn != null) {
-                assert decsAnn.value() != null;
-                assert seq < decsAnn.value().length;
-
-                str = decsAnn.value()[seq];
-
-                assert str != null;
-                assert str.trim().length() > 0;
-
-                // Enforce proper English.
-                assert Character.isUpperCase(str.charAt(0)) == true : str;
-                assert str.charAt(str.length() - 1) == '.' : str;
-            }
-        }
-        catch (SecurityException | ClassNotFoundException e) {
-            // No-op. Default value will be returned.
-        }
-
-        return str;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected String getParameterName(MBeanOperationInfo op, MBeanParameterInfo
param, int seq) {
-        String str = super.getParameterName(op, param, seq);
-
-        try {
-            Method m = getMethod(op);
-
-            IgniteMBeanParametersNames namesAnn = m.getAnnotation(IgniteMBeanParametersNames.class);
-
-            if (namesAnn != null) {
-                assert namesAnn.value() != null;
-                assert seq < namesAnn.value().length;
-
-                str = namesAnn.value()[seq];
-
-                assert str != null;
-                assert str.trim().length() > 0;
-            }
-        }
-        catch (SecurityException | ClassNotFoundException e) {
-            // No-op. Default value will be returned.
-        }
-
-        return str;
-    }
-
-    /**
-     * Gets method by operation info.
-     *
-     * @param op MBean operation info.
-     * @return Method.
-     * @throws ClassNotFoundException Thrown if parameter type is unknown.
-     * @throws SecurityException Thrown if method access is not allowed.
-     */
-    private Method getMethod(MBeanOperationInfo op) throws ClassNotFoundException, SecurityException
{
-        String methodName = op.getName();
-
-        MBeanParameterInfo[] signature = op.getSignature();
-
-        Class<?>[] params = new Class<?>[signature.length];
-
-        for (int i = 0; i < signature.length; i++) {
-            // Parameter type is either a primitive type or class. Try both.
-            Class<?> type = primCls.get(signature[i].getType().toLowerCase());
-
-            if (type == null)
-                type = Class.forName(signature[i].getType());
-
-            params[i] = type;
-        }
-
-        return findMethod(getMBeanInterface(), methodName, params);
-    }
-
-    /**
-     * Finds method for the given interface.
-     *
-     * @param itf MBean interface.
-     * @param methodName Method name.
-     * @param params Method parameters.
-     * @return Method.
-     */
-    @SuppressWarnings("unchecked")
-    private Method findMethod(Class itf, String methodName, Class[] params) {
-        assert itf.isInterface() == true;
-
-        Method res = null;
-
-        // Try to get method from given interface.
-        try {
-            res = itf.getDeclaredMethod(methodName, params);
-
-            if (res != null)
-                return res;
-        }
-        catch (NoSuchMethodException e) {
-            // No-op. Default value will be returned.
-        }
-
-        // Process recursively super interfaces.
-        Class[] superItfs = itf.getInterfaces();
-
-        for (Class superItf: superItfs) {
-            res = findMethod(superItf, methodName, params);
-
-            if (res != null)
-                return res;
-        }
-
-        return res;
-    }
-}


Mime
View raw message