public synchronized CompilerResults process ( ) { // Create the list to hold all of the exceptions. Set < Throwable > exceptions = new TreeSet < Throwable > ( new ThrowableComparator ( ) ) ; long start = new Date ( ) . getTime ( ) ; stats . setFileCount ( files . size ( ) ) ; // Trigger the compilation of the templates via the template cache. If // no building is going on, then the compile() method is used which // doesn't actually save the templates. This reduces drastically the // memory requirements. if ( options . formatters . size ( ) > 0 ) { for ( File f : files ) { ccache . retrieve ( f . getAbsolutePath ( ) , false ) ; } } else { // FIXME: Determine if this does the correct thing (nothing) for a syntax check. for ( File f : files ) { if ( ! f . isAbsolute ( ) && options . annotationBaseDirectory != null ) { f = new File ( options . annotationBaseDirectory , f . getPath ( ) ) ; } ccache . compile ( f . getAbsolutePath ( ) ) ; } } // Now continually loop through the result queue until we have all // of the results. while ( remainingTasks . get ( ) > 0 ) { try { Future < ? extends TaskResult > future = resultsQueue . take ( ) ; try { stats . incrementFinishedTasks ( future . get ( ) . type ) ; } catch ( ExecutionException ee ) { exceptions . add ( ee . getCause ( ) ) ; } remainingTasks . decrementAndGet ( ) ; stats . updateMemoryInfo ( ) ; } catch ( InterruptedException consumed ) { } } // Shutdown the executors. In certain environments (e.g. eclipse) the // required "modifyThread" permission may not have been granted. Not // having this permission may cause a thread leak. try { SecurityManager security = System . getSecurityManager ( ) ; if ( security != null ) { security . checkPermission ( new RuntimePermission ( "modifyThread" ) ) ; } // We've got the correct permission, so tell all of the executors to // shutdown. for ( TaskResult . ResultType t : TaskResult . ResultType . values ( ) ) { executors . get ( t ) . shutdown ( ) ; } } catch ( SecurityException se ) { // Emit a warning about the missing permission. System . err . println ( "WARNING: missing modifyThread permission" ) ; } // Finalize the statistics. long end = new Date ( ) . getTime ( ) ; stats . setBuildTime ( end - start ) ; return new CompilerResults ( stats , exceptions ) ; }
Process the templates referenced by the CompilerOptions object used to initialize this instance . This will run through the complete compiling building and validation stages as requested . This method should only be invoked once per instance .