< prev index next >

src/java.base/share/native/libjava/Shutdown.c

Updates after review: remove status argument completely from beforeHalt

8041626: Shutdown tracing event

0 /*                                                                                                                         
1  * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.                                            
2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.                                                           
3  *                                                                                                                         
4  * This code is free software; you can redistribute it and/or modify it                                                    
5  * under the terms of the GNU General Public License version 2 only, as                                                    
6  * published by the Free Software Foundation.  Oracle designates this                                                      
7  * particular file as subject to the "Classpath" exception as provided                                                     
8  * by Oracle in the LICENSE file that accompanied this code.                                                               
9  *                                                                                                                         
10  * This code is distributed in the hope that it will be useful, but WITHOUT                                                
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or                                                   
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License                                                   
13  * version 2 for more details (a copy is included in the LICENSE file that                                                 
14  * accompanied this code).                                                                                                 
15  *                                                                                                                         
16  * You should have received a copy of the GNU General Public License version                                               
17  * 2 along with this work; if not, write to the Free Software Foundation,                                                  
18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.                                                           
19  *                                                                                                                         
20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA                                                 
21  * or visit www.oracle.com if you need additional information or have any                                                  
22  * questions.                                                                                                              
23  */                                                                                                                        
24 
25 #include "jni.h"                                                                                                           
26 #include "jni_util.h"                                                                                                      
27 #include "jvm.h"                                                                                                           
28 
29 #include "java_lang_Shutdown.h"                                                                                            
30 
                                                                                                                           
                                                                                                                           
                                                                                                                           
                                                                                                                           
                                                                                                                           
31 
32 JNIEXPORT void JNICALL                                                                                                     
33 Java_java_lang_Shutdown_halt0(JNIEnv *env, jclass ignored, jint code)                                                      
34 {                                                                                                                          
35     JVM_Halt(code);                                                                                                        
36 }                                                                                                                          
37 
38 
39 JNIEXPORT void JNICALL                                                                                                     
40 Java_java_lang_Shutdown_runAllFinalizers(JNIEnv *env, jclass ignored)                                                      
41 {                                                                                                                          
42     jclass cl;                                                                                                             
43     jmethodID mid;                                                                                                         
44 
45     if ((cl = (*env)->FindClass(env, "java/lang/ref/Finalizer"))                                                           
46         && (mid = (*env)->GetStaticMethodID(env, cl,                                                                       
47                                             "runAllFinalizers", "()V"))) {                                                 
48         (*env)->CallStaticVoidMethod(env, cl, mid);                                                                        
49     }                                                                                                                      

0 /*
1  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3  *
4  * This code is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 only, as
6  * published by the Free Software Foundation.  Oracle designates this
7  * particular file as subject to the "Classpath" exception as provided
8  * by Oracle in the LICENSE file that accompanied this code.
9  *
10  * This code is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13  * version 2 for more details (a copy is included in the LICENSE file that
14  * accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License version
17  * 2 along with this work; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19  *
20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21  * or visit www.oracle.com if you need additional information or have any
22  * questions.
23  */
24 
25 #include "jni.h"
26 #include "jni_util.h"
27 #include "jvm.h"
28 
29 #include "java_lang_Shutdown.h"
30 
31 JNIEXPORT void JNICALL
32 Java_java_lang_Shutdown_beforeHalt(JNIEnv *env, jclass ignored)
33 {
34     JVM_BeforeHalt();
35 }
36 
37 JNIEXPORT void JNICALL
38 Java_java_lang_Shutdown_halt0(JNIEnv *env, jclass ignored, jint code)
39 {
40     JVM_Halt(code);
41 }
42 
43 
44 JNIEXPORT void JNICALL
45 Java_java_lang_Shutdown_runAllFinalizers(JNIEnv *env, jclass ignored)
46 {
47     jclass cl;
48     jmethodID mid;
49 
50     if ((cl = (*env)->FindClass(env, "java/lang/ref/Finalizer"))
51         && (mid = (*env)->GetStaticMethodID(env, cl,
52                                             "runAllFinalizers", "()V"))) {
53         (*env)->CallStaticVoidMethod(env, cl, mid);
54     }
< prev index next >