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

Print this page
rev 5061 : 7149320: Move sun.misc.VM.booted() to end of System.initializeSystemClass()


1151         FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
1152         FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
1153         FileOutputStream fdErr = new FileOutputStream(FileDescriptor.err);
1154         setIn0(new BufferedInputStream(fdIn));
1155         setOut0(newPrintStream(fdOut, props.getProperty("sun.stdout.encoding")));
1156         setErr0(newPrintStream(fdErr, props.getProperty("sun.stderr.encoding")));
1157 
1158         // Load the zip library now in order to keep java.util.zip.ZipFile
1159         // from trying to use itself to load this library later.
1160         loadLibrary("zip");
1161 
1162         // Setup Java signal handlers for HUP, TERM, and INT (where available).
1163         Terminator.setup();
1164 
1165         // Initialize any miscellenous operating system settings that need to be
1166         // set for the class libraries. Currently this is no-op everywhere except
1167         // for Windows where the process-wide error mode is set before the java.io
1168         // classes are used.
1169         sun.misc.VM.initializeOSEnvironment();
1170 
1171         // Subsystems that are invoked during initialization can invoke
1172         // sun.misc.VM.isBooted() in order to avoid doing things that should
1173         // wait until the application class loader has been set up.
1174         sun.misc.VM.booted();
1175 
1176         // The main thread is not added to its thread group in the same
1177         // way as other threads; we must do it ourselves here.
1178         Thread current = Thread.currentThread();
1179         current.getThreadGroup().add(current);
1180 
1181         // register shared secrets
1182         setJavaLangAccess();





1183     }
1184 
1185     private static void setJavaLangAccess() {
1186         // Allow privileged classes outside of java.lang
1187         sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess(){
1188             public sun.reflect.ConstantPool getConstantPool(Class<?> klass) {
1189                 return klass.getConstantPool();
1190             }
1191             public void setAnnotationType(Class<?> klass, AnnotationType type) {
1192                 klass.setAnnotationType(type);
1193             }
1194             public AnnotationType getAnnotationType(Class<?> klass) {
1195                 return klass.getAnnotationType();
1196             }
1197             public <E extends Enum<E>>
1198                     E[] getEnumConstantsShared(Class<E> klass) {
1199                 return klass.getEnumConstantsShared();
1200             }
1201             public void blockedOn(Thread t, Interruptible b) {
1202                 t.blockedOn(b);


1151         FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
1152         FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
1153         FileOutputStream fdErr = new FileOutputStream(FileDescriptor.err);
1154         setIn0(new BufferedInputStream(fdIn));
1155         setOut0(newPrintStream(fdOut, props.getProperty("sun.stdout.encoding")));
1156         setErr0(newPrintStream(fdErr, props.getProperty("sun.stderr.encoding")));
1157 
1158         // Load the zip library now in order to keep java.util.zip.ZipFile
1159         // from trying to use itself to load this library later.
1160         loadLibrary("zip");
1161 
1162         // Setup Java signal handlers for HUP, TERM, and INT (where available).
1163         Terminator.setup();
1164 
1165         // Initialize any miscellenous operating system settings that need to be
1166         // set for the class libraries. Currently this is no-op everywhere except
1167         // for Windows where the process-wide error mode is set before the java.io
1168         // classes are used.
1169         sun.misc.VM.initializeOSEnvironment();
1170 





1171         // The main thread is not added to its thread group in the same
1172         // way as other threads; we must do it ourselves here.
1173         Thread current = Thread.currentThread();
1174         current.getThreadGroup().add(current);
1175 
1176         // register shared secrets
1177         setJavaLangAccess();
1178 
1179         // Subsystems that are invoked during initialization can invoke
1180         // sun.misc.VM.isBooted() in order to avoid doing things that should
1181         // wait until the application class loader has been set up.
1182         sun.misc.VM.booted();
1183     }
1184 
1185     private static void setJavaLangAccess() {
1186         // Allow privileged classes outside of java.lang
1187         sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess(){
1188             public sun.reflect.ConstantPool getConstantPool(Class<?> klass) {
1189                 return klass.getConstantPool();
1190             }
1191             public void setAnnotationType(Class<?> klass, AnnotationType type) {
1192                 klass.setAnnotationType(type);
1193             }
1194             public AnnotationType getAnnotationType(Class<?> klass) {
1195                 return klass.getAnnotationType();
1196             }
1197             public <E extends Enum<E>>
1198                     E[] getEnumConstantsShared(Class<E> klass) {
1199                 return klass.getEnumConstantsShared();
1200             }
1201             public void blockedOn(Thread t, Interruptible b) {
1202                 t.blockedOn(b);