public static synchronized void initializeEnvironment ( ) { if ( _isStaticInit ) return ; _isStaticInit = true ; ClassLoader systemLoader = ClassLoader . getSystemClassLoader ( ) ; Thread thread = Thread . currentThread ( ) ; ClassLoader oldLoader = thread . getContextClassLoader ( ) ; try { thread . setContextClassLoader ( systemLoader ) ; if ( "1.8." . compareTo ( System . getProperty ( "java.runtime.version" ) ) > 0 ) throw new ConfigException ( "Baratine requires JDK 1.8 or later" ) ; // #2281 // PolicyImpl.init(); //EnvironmentStream.setStdout(System.out); //EnvironmentStream.setStderr(System.err); /* try { Vfs.initJNI(); } catch (Throwable e) { } */ Properties props = System . getProperties ( ) ; ClassLoader envClassLoader = EnvironmentClassLoader . class . getClassLoader ( ) ; /* boolean isGlobalLoadableJndi = false; try { Class<?> cl = Class.forName("com.caucho.v5.naming.InitialContextFactoryImpl", false, systemLoader); isGlobalLoadableJndi = (cl != null); } catch (Exception e) { log().log(Level.FINER, e.toString(), e); } // #3486 String namingPkgs = (String) props.get("java.naming.factory.url.pkgs"); if (namingPkgs == null) namingPkgs = "com.caucho.v5.naming"; else namingPkgs = namingPkgs + ":" + "com.caucho.v5.naming"; props.put("java.naming.factory.url.pkgs", namingPkgs); if (isGlobalLoadableJndi) { // These properties require the server to be at the system loader if (props.get("java.naming.factory.initial") == null) { props.put("java.naming.factory.initial", "com.caucho.v5.naming.InitialContextFactoryImpl"); } } */ /* boolean isGlobalLoadableJmx = false; try { Class<?> cl = Class.forName("com.caucho.v5.jmx.MBeanServerBuilderImpl", false, systemLoader); isGlobalLoadableJmx = (cl != null); } catch (Exception e) { log().log(Level.FINER, e.toString(), e); } if (isGlobalLoadableJmx) { // props.put("java.naming.factory.url.pkgs", "com.caucho.naming"); EnvironmentProperties.enableEnvironmentSystemProperties(true); String oldBuilder = props.getProperty("javax.management.builder.initial"); if (oldBuilder == null) { oldBuilder = "com.caucho.v5.jmx.MBeanServerBuilderImpl"; props.put("javax.management.builder.initial", oldBuilder); } Object value = ManagementFactory.getPlatformMBeanServer(); } */ } catch ( Throwable e ) { log ( ) . log ( Level . FINE , e . toString ( ) , e ) ; } finally { thread . setContextClassLoader ( oldLoader ) ; _isInitComplete = true ; } }
Initializes the environment