Source Code Cross Referenced for MemoryManagerMXBeanImpl.java in  » Apache-Harmony-Java-SE » org-package » org » apache » harmony » lang » management » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » org package » org.apache.harmony.lang.management 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        package org.apache.harmony.lang.management;
019:
020:        import java.lang.management.MemoryManagerMXBean;
021:        import java.lang.management.MemoryPoolMXBean;
022:        import java.lang.management.MemoryType;
023:        import java.util.Iterator;
024:        import java.util.LinkedList;
025:        import java.util.List;
026:
027:        /**
028:         * Runtime type for {@link MemoryManagerMXBean}
029:         * 
030:         * @since 1.5
031:         */
032:        public class MemoryManagerMXBeanImpl extends DynamicMXBeanImpl
033:                implements  MemoryManagerMXBean {
034:            protected final String name;
035:
036:            protected final int id;
037:
038:            private List<MemoryPoolMXBean> managedPoolList;
039:
040:            /**
041:             * Sets the metadata for this bean.
042:             * 
043:             * @param name
044:             * @param id
045:             * @param memBean
046:             */
047:            MemoryManagerMXBeanImpl(String name, int id,
048:                    MemoryMXBeanImpl memBean) {
049:                this .name = name;
050:                this .id = id;
051:                initializeInfo();
052:                managedPoolList = new LinkedList<MemoryPoolMXBean>();
053:                createMemoryPools(id, memBean);
054:            }
055:
056:            /**
057:             * 
058:             */
059:            protected void initializeInfo() {
060:                setMBeanInfo(ManagementUtils
061:                        .getMBeanInfo(MemoryManagerMXBean.class.getName()));
062:            }
063:
064:            /**
065:             * Instantiate the MemoryPoolMXBeans representing the memory managed by this
066:             * manager, and store them in the managedPoolList.
067:             * 
068:             * @param managerID
069:             * @param memBean
070:             */
071:            private native void createMemoryPools(int managerID,
072:                    MemoryMXBeanImpl memBean);
073:
074:            /**
075:             * A helper method called from within the native
076:             * {@link #createMemoryPools(int, MemoryMXBeanImpl)} method to construct new
077:             * MemoryPoolMXBeans representing memory managed by this manager and add
078:             * them to the {@link #managedPoolList}.
079:             * 
080:             * @param name
081:             *            the name of the corresponding memory pool
082:             * @param isHeap
083:             *            boolean indication of the memory pool type. <code>true</code>
084:             *            indicates that the memory is heap memory while
085:             *            <code>false</code> indicates non-heap memory
086:             * @param internalID
087:             *            numerical identifier associated with the memory pool for the
088:             *            benefit of the VM
089:             * @param memBean
090:             *            the {@link MemoryMXBeanImpl} that will send event
091:             *            notifications related to this memory pool
092:             */
093:            @SuppressWarnings("unused")
094:            // IMPORTANT: for use by VM
095:            private void createMemoryPoolHelper(String name, boolean isHeap,
096:                    int internalID, MemoryMXBeanImpl memBean) {
097:                managedPoolList.add(new MemoryPoolMXBeanImpl(name,
098:                        isHeap ? MemoryType.HEAP : MemoryType.NON_HEAP,
099:                        internalID, memBean));
100:            }
101:
102:            /**
103:             * Retrieves the list of memory pool beans managed by this manager.
104:             * 
105:             * @return the list of <code>MemoryPoolMXBean</code> instances
106:             */
107:            List<MemoryPoolMXBean> getMemoryPoolMXBeans() {
108:                return managedPoolList;
109:            }
110:
111:            /*
112:             * (non-Javadoc)
113:             * 
114:             * @see java.lang.management.MemoryManagerMXBean#getMemoryPoolNames()
115:             */
116:            public String[] getMemoryPoolNames() {
117:                String[] names = new String[managedPoolList.size()];
118:                int idx = 0;
119:                Iterator<MemoryPoolMXBean> iter = managedPoolList.iterator();
120:                while (iter.hasNext()) {
121:                    names[idx++] = iter.next().getName();
122:                }
123:                return names;
124:            }
125:
126:            /*
127:             * (non-Javadoc)
128:             * 
129:             * @see java.lang.management.MemoryManagerMXBean#getName()
130:             */
131:            public String getName() {
132:                return this .name;
133:            }
134:
135:            /**
136:             * @return <code>true</code> if the memory manager is still valid in the
137:             *         virtual machine ; otherwise <code>false</code>.
138:             * @see #isValid()
139:             */
140:            private native boolean isValidImpl();
141:
142:            /*
143:             * (non-Javadoc)
144:             * 
145:             * @see java.lang.management.MemoryManagerMXBean#isValid()
146:             */
147:            public boolean isValid() {
148:                return this.isValidImpl();
149:            }
150:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.