Java example source code file (JvmMemPoolTableMetaImpl.java)
This example Java source code file (JvmMemPoolTableMetaImpl.java) is included in the alvinalexander.com
"Java Source Code
Warehouse" project. The intent of this project is to help you "Learn
Java by Example" TM.
The JvmMemPoolTableMetaImpl.java Java example source code
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import com.sun.jmx.mbeanserver.Util;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import java.lang.management.MemoryPoolMXBean;
import java.lang.management.ManagementFactory;
import sun.management.snmp.jvmmib.JvmMemPoolTableMeta;
import sun.management.snmp.util.SnmpTableCache;
import sun.management.snmp.util.SnmpNamedListTableCache;
import sun.management.snmp.util.SnmpTableHandler;
import sun.management.snmp.util.MibLogger;
import sun.management.snmp.util.JvmContextFactory;
/**
* The class is used for implementing the "JvmMemPoolTable" group.
*/
public class JvmMemPoolTableMetaImpl extends JvmMemPoolTableMeta {
static final long serialVersionUID = -2525820976094284957L;
/**
* A concrete implementation of {@link SnmpNamedListTableCache}, for the
* jvmMemPoolTable.
**/
private static class JvmMemPoolTableCache extends SnmpNamedListTableCache {
static final long serialVersionUID = -1755520683086760574L;
/**
* Create a weak cache for the jvmMemPoolTable.
* @param validity validity of the cached data, in ms.
**/
JvmMemPoolTableCache(long validity) {
this.validity = validity;
}
/**
* Use the MemoryPoolMXBean name as key.
* @param context A {@link TreeMap} as allocated by the parent
* {@link SnmpNamedListTableCache} class.
* @param rawDatas List of {@link MemoryPoolMXBean}, as
* returned by
* <code>ManagementFactory.getMemoryPoolMXBeans()
* @param rank The <var>rank of item in the list.
* @param item The <var>rankth
* <code>MemoryPoolMXBean in the list.
* @return <code>((MemoryPoolMXBean)item).getName()
**/
protected String getKey(Object context, List<?> rawDatas,
int rank, Object item) {
if (item == null) return null;
final String name = ((MemoryPoolMXBean)item).getName();
log.debug("getKey", "key=" + name);
return name;
}
/**
* Call <code>getTableDatas(JvmContextFactory.getUserData()).
**/
public SnmpTableHandler getTableHandler() {
final Map<Object, Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData);
}
/**
* Return the key used to cache the raw data of this table.
**/
protected String getRawDatasKey() {
return "JvmMemManagerTable.getMemoryPools";
}
/**
* Call ManagementFactory.getMemoryPoolMXBeans() to
* load the raw data of this table.
**/
protected List<MemoryPoolMXBean> loadRawDatas(Map
Other Java examples (source code examples)
Here is a short list of links related to this Java JvmMemPoolTableMetaImpl.java source code file: