Package org.teavm.common

Examples of org.teavm.common.FiniteExecutor


            }
            int methodsGenerated = 0;
            log.info("Generating test files");
            sourceFilesCopier = new SourceFilesCopier(sourceFileProviders);
            sourceFilesCopier.setLog(log);
            FiniteExecutor executor = new SimpleFiniteExecutor();
            if (numThreads != 1) {
                int threads = numThreads != 0 ? numThreads : Runtime.getRuntime().availableProcessors();
                final ThreadPoolFiniteExecutor threadedExecutor = new ThreadPoolFiniteExecutor(threads);
                finalizer = new Runnable() {
                    @Override public void run() {
                        threadedExecutor.stop();
                    }
                };
                executor = threadedExecutor;
            }
            for (final MethodReference method : testMethods) {
                final ClassHolderSource builderClassSource = classSource;
                executor.execute(new Runnable() {
                    @Override public void run() {
                        log.debug("Building test for " + method);
                        try {
                            decompileClassesForTest(classLoader, new CopyClassHolderSource(builderClassSource), method,
                                    fileNames.get(method));
                        } catch (IOException e) {
                            log.error("Error generating JavaScript", e);
                        }
                    }
                });
                ++methodsGenerated;
            }
            executor.complete();
            if (sourceFilesCopied) {
                sourceFilesCopier.copy(new File(new File(outputDir, "tests"), "src"));
            }
            log.info("Test files successfully generated for " + methodsGenerated + " method(s).");
        } catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.teavm.common.FiniteExecutor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.