Source Code Cross Referenced for VMExecutionEngine.java in  » Apache-Harmony-Java-SE » java-package » java » lang » 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 » java package » java.lang 
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:         * @author Evgueni Brevnov, Roman S. Bushmanov
019:         * @version $Revision: 1.1.2.1.4.4 $
020:         */package java.lang;
021:
022:        import java.util.Properties;
023:        import java.util.Vector;
024:
025:        /**
026:         * Provides the methods to interact with VM Execution Engine that are used by
027:         * different classes from the <code>java.lang</code> package, such as System,
028:         * Runtime.
029:         * <p>
030:         * This class must be implemented according to the common policy for porting
031:         * interfaces - see the porting interface overview for more detailes.
032:         * 
033:         * @api2vm
034:         */
035:        final class VMExecutionEngine {
036:
037:            /**
038:             * keeps Runnable objects of the shutdown sequence 
039:             */
040:            private static Vector<Runnable> shutdownActions = new Vector<Runnable>();
041:
042:            /**
043:             * This class is not supposed to be instantiated.
044:             */
045:            private VMExecutionEngine() {
046:            }
047:
048:            /**
049:             * Terminates a Virtual Machine with possible invocation of finilization
050:             * methods. This method is used by the {@link Runtime#exit(int)
051:             * Runtime.exit(int status)} and {@link Runtime#halt(int)
052:             * Runtime.halt(int satus)} methods implementation. When it is called by the
053:             * <code>Runtime.exit(int status)</code> method all shutdown hook threads
054:             * should have been already finished. The needFinilization argument must
055:             * be true if uninvoked finilizers should be called on VM exit. The
056:             * implementation simply calls the 
057:             * {@link VMExecutionEngine#exit(int, boolean, Runnable[]) 
058:             * VMExecutionEngine.exit(int status, boolean needFinalization, 
059:             * Runnable[] shutdownSequence)} method with an array of
060:             * <code>Runnable</code> objects which were registered before by means of
061:             * the {@link VMExecutionEngine#registerShutdownAction(Runnable) 
062:             * VMExecutionEngine.registerShutdownAction(Runnable action)} method.  
063:             * 
064:             * @param status exit status
065:             * @param needFinalize specifies that finalization must be performed. If
066:             *        true then it perfoms finalization of all not finalized objects
067:             *        that have finalizers
068:             * @api2vm
069:             */
070:            static void exit(int status, boolean needFinalization) {
071:                exit(status, needFinalization, shutdownActions
072:                        .toArray(new Runnable[0]));
073:            }
074:
075:            /**
076:             * Call to this method forces VM to
077:             * <ol>
078:             *   <li> Execute uninvoked finilizers if needFinalization is true </li>
079:             *   <li> Forcibly stop all running non-system threads
080:             *   <li> Sequentially execute the <code>run</code> method for each object
081:             *        of the shutdownSequence array. The execution starts from the last
082:             *        element of the array. No threads will be created to perform
083:             *        execution. If uncatched exception occurs it's stack trace is
084:             *        printed to the error stream and the next element of the array if
085:             *        any will be executed
086:             *   <li> Exit  
087:             * </ol>    
088:             * 
089:             * @param status exit status
090:             * @param needFinalization indicates that finilization should be performed 
091:             * @param shutdownSequence array of shutdown actions
092:             * @api2vm
093:             */
094:            private static native void exit(int status,
095:                    boolean needFinalization, Runnable[] shutdownSequence);
096:
097:            /**
098:             * This method provides an information about the assertion status specified
099:             * via command line options.
100:             * <p>
101:             *  
102:             * @see java.lang.Class#desiredAssertionStatus()
103:             * 
104:             * @param clss the class to be initialized with the assertion status. Note, 
105:             * assertion status is applicable to top-level classes only, therefore
106:             * any member/local class passed is a subject to conversion to corresponding
107:             * top-level declaring class. Also, <code>null</code> argument can be used to 
108:             * check if any assertion was specified through command line options.
109:             * @param recursive controls whether this method should check exact match
110:             * with name of the class, or check (super)packages recursively 
111:             * (most specific one has precedence).
112:             * @param defaultStatus if no specific package setting found, 
113:             * this value may override command-line defaults. This parameter is
114:             * actual only when <code>recursive == true</code>. 
115:             * @see java.lang.ClassLoader#setDefaultAssertionStatus(boolean) 
116:             * @return 0 - unspecified, &lt; 0 - false, &gt; 0 - true
117:             * @api2vm
118:             */
119:            static native int getAssertionStatus(Class clss, boolean recursive,
120:                    int defaultStatus);
121:
122:            /**
123:             * This method satisfies the requirements of the specification for the
124:             * {@link Runtime#availableProcessors() Runtime.availableProcessors()}
125:             * method.
126:             * @api2vm
127:             */
128:            static native int getAvailableProcessors();
129:
130:            /**
131:             * This method satisfies the requirements of the specification for the
132:             * {@link System#getProperties() System.getProperties()} method.
133:             * <p>
134:             * Additionally a class library implementation may relay on existance of
135:             * the following properties "vm.boot.class.path" & "vm.boot.library.path".
136:             * The "vm.boot.class.path" property can be used to load classes and
137:             * resources which reside in the bootstrap sequence of the VM.
138:             * The "vm.boot.library.path" property can be used to find libraries that
139:             * should be obtatined by classes which were loaded by bootstrap class loader.      
140:             * @api2vm
141:             */
142:            static native Properties getProperties();
143:
144:            /**
145:             * Adds the specified action to the list of shutdown actions. The
146:             * {@link Runnable#run() Runnable.run()} method of the specified action 
147:             * object is executed after all non-system threads have been stopped. Last
148:             * registered action is executed before previously registered actions. Each
149:             * action should not create threads inside. It is expected that registered 
150:             * actions doesn't requre a lot of time to complete.
151:             * <p>
152:             * Typicily one may use this method to close open files, connections etc. on
153:             * Virtual Machine exit       
154:             * @param action action which should be performed on VM exit
155:             * @api2vm
156:             */
157:            public static void registerShutdownAction(Runnable action) {
158:                shutdownActions.add(action);
159:            }
160:
161:            /**
162:             * This method satisfies the requirements of the specification for the
163:             * {@link Runtime#traceInstructions(boolean)
164:             * Runtime.traceInstructions(boolean on)} method.
165:             * @api2vm
166:             */
167:            static native void traceInstructions(boolean enable);
168:
169:            /**
170:             * This method satisfies the requirements of the specification for the
171:             * {@link Runtime#traceMethodCalls(boolean)
172:             * Runtime.traceMethodCalls(boolean on)} method.
173:             * @api2vm
174:             */
175:            static native void traceMethodCalls(boolean enable);
176:
177:            /**
178:             * Returns the current system time in milliseconds since 
179:             * the Unix epoch (midnight, 1 Jan, 1970).
180:             * @api2vm
181:             */
182:            static native long currentTimeMillis();
183:
184:            /**
185:             * Returns the current value of a system timer with the best accuracy
186:             * the OS can provide, in nanoseconds.
187:             * @api2vm
188:             */
189:            static native long nanoTime();
190:
191:            /**
192:             * Returns platform-specific name of the specified library.
193:             * @api2vm
194:             */
195:            static native String mapLibraryName(String libname);
196:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.