src/share/classes/java/lang/System.java

Print this page




1154         // classes are used.
1155         sun.misc.VM.initializeOSEnvironment();
1156 
1157         // Subsystems that are invoked during initialization can invoke
1158         // sun.misc.VM.isBooted() in order to avoid doing things that should
1159         // wait until the application class loader has been set up.
1160         sun.misc.VM.booted();
1161 
1162         // The main thread is not added to its thread group in the same
1163         // way as other threads; we must do it ourselves here.
1164         Thread current = Thread.currentThread();
1165         current.getThreadGroup().add(current);
1166 
1167         // register shared secrets
1168         setJavaLangAccess();
1169     }
1170 
1171     private static void setJavaLangAccess() {
1172         // Allow privileged classes outside of java.lang
1173         sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess(){
1174             public sun.reflect.ConstantPool getConstantPool(Class klass) {
1175                 return klass.getConstantPool();
1176             }
1177             public void setAnnotationType(Class klass, AnnotationType type) {
1178                 klass.setAnnotationType(type);
1179             }
1180             public AnnotationType getAnnotationType(Class klass) {
1181                 return klass.getAnnotationType();
1182             }
1183             public <E extends Enum<E>>
1184                     E[] getEnumConstantsShared(Class<E> klass) {
1185                 return klass.getEnumConstantsShared();
1186             }
1187             public void blockedOn(Thread t, Interruptible b) {
1188                 t.blockedOn(b);
1189             }
1190             public void registerShutdownHook(int slot, boolean registerShutdownInProgress, Runnable hook) {
1191                 Shutdown.add(slot, registerShutdownInProgress, hook);
1192             }
1193             public int getStackTraceDepth(Throwable t) {
1194                 return t.getStackTraceDepth();
1195             }
1196             public StackTraceElement getStackTraceElement(Throwable t, int i) {
1197                 return t.getStackTraceElement(i);
1198             }
1199         });
1200     }


1154         // classes are used.
1155         sun.misc.VM.initializeOSEnvironment();
1156 
1157         // Subsystems that are invoked during initialization can invoke
1158         // sun.misc.VM.isBooted() in order to avoid doing things that should
1159         // wait until the application class loader has been set up.
1160         sun.misc.VM.booted();
1161 
1162         // The main thread is not added to its thread group in the same
1163         // way as other threads; we must do it ourselves here.
1164         Thread current = Thread.currentThread();
1165         current.getThreadGroup().add(current);
1166 
1167         // register shared secrets
1168         setJavaLangAccess();
1169     }
1170 
1171     private static void setJavaLangAccess() {
1172         // Allow privileged classes outside of java.lang
1173         sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess(){
1174             public sun.reflect.ConstantPool getConstantPool(Class<?> klass) {
1175                 return klass.getConstantPool();
1176             }
1177             public void setAnnotationType(Class<?> klass, AnnotationType type) {
1178                 klass.setAnnotationType(type);
1179             }
1180             public AnnotationType getAnnotationType(Class<?> klass) {
1181                 return klass.getAnnotationType();
1182             }
1183             public <E extends Enum<E>>
1184                     E[] getEnumConstantsShared(Class<E> klass) {
1185                 return klass.getEnumConstantsShared();
1186             }
1187             public void blockedOn(Thread t, Interruptible b) {
1188                 t.blockedOn(b);
1189             }
1190             public void registerShutdownHook(int slot, boolean registerShutdownInProgress, Runnable hook) {
1191                 Shutdown.add(slot, registerShutdownInProgress, hook);
1192             }
1193             public int getStackTraceDepth(Throwable t) {
1194                 return t.getStackTraceDepth();
1195             }
1196             public StackTraceElement getStackTraceElement(Throwable t, int i) {
1197                 return t.getStackTraceElement(i);
1198             }
1199         });
1200     }