当前位置: 首页>>代码示例>>Java>>正文


Java Log类代码示例

本文整理汇总了Java中com.sun.tools.sjavac.Log的典型用法代码示例。如果您正苦于以下问题:Java Log类的具体用法?Java Log怎么用?Java Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Log类属于com.sun.tools.sjavac包,在下文中一共展示了Log类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: waitForValidValues

import com.sun.tools.sjavac.Log; //导入依赖的package包/类
/**
 * Wait for the port file to contain values that look valid.
 * Return true, if a-ok, false if the valid values did not materialize within 5 seconds.
 */
public synchronized boolean waitForValidValues() throws IOException, FileNotFoundException {
    for (int tries = 0; tries < 50; tries++) {
        lock();
        getValues();
        unlock();
        if (containsPortInfo) {
            Log.debug("Found valid values in port file after waiting "+(tries*100)+"ms");
            return true;
        }
        try {
            Thread.sleep(100);
        } catch (InterruptedException e)
        {}
    }
    Log.debug("Gave up waiting for valid values in port file");
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:PortFile.java

示例2: tryConnect

import com.sun.tools.sjavac.Log; //导入依赖的package包/类
private Socket tryConnect() throws IOException, InterruptedException {
    makeSureServerIsRunning(portFile);
    int attempt = 0;
    while (true) {
        Log.debug("Trying to connect. Attempt " + (++attempt) + " of " + MAX_CONNECT_ATTEMPTS);
        try {
            return makeConnectionAttempt();
        } catch (IOException ex) {
            Log.error("Connection attempt failed: " + ex.getMessage());
            if (attempt >= MAX_CONNECT_ATTEMPTS) {
                Log.error("Giving up");
                throw new IOException("Could not connect to server", ex);
            }
        }
        Thread.sleep(WAIT_BETWEEN_CONNECT_ATTEMPTS);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:SjavacClient.java

示例3: waitForValidValues

import com.sun.tools.sjavac.Log; //导入依赖的package包/类
/**
 * Wait for the port file to contain values that look valid.
 */
public void waitForValidValues() throws IOException, InterruptedException {
    final int MS_BETWEEN_ATTEMPTS = 500;
    long startTime = System.currentTimeMillis();
    long timeout = startTime + getServerStartupTimeoutSeconds() * 1000;
    while (true) {
        Log.debug("Looking for valid port file values...");
        if (exists()) {
            lock();
            getValues();
            unlock();
        }
        if (containsPortInfo) {
            Log.debug("Valid port file values found after " + (System.currentTimeMillis() - startTime) + " ms");
            return;
        }
        if (System.currentTimeMillis() > timeout) {
            break;
        }
        Thread.sleep(MS_BETWEEN_ATTEMPTS);
    }
    throw new IOException("No port file values materialized. Giving up after " +
                                  (System.currentTimeMillis() - startTime) + " ms");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:PortFile.java

示例4: shutdown

import com.sun.tools.sjavac.Log; //导入依赖的package包/类
@Override
public void shutdown() {
    Log.debug("Shutting down PooledSjavac");
    pool.shutdown(); // Disable new tasks from being submitted
    try {
        // Wait a while for existing tasks to terminate
        if (!pool.awaitTermination(60, TimeUnit.SECONDS)) {
            pool.shutdownNow(); // Cancel currently executing tasks
            // Wait a while for tasks to respond to being cancelled
            if (!pool.awaitTermination(60, TimeUnit.SECONDS))
                Log.error("ThreadPool did not terminate");
        }
    } catch (InterruptedException ie) {
      // (Re-)Cancel if current thread also interrupted
      pool.shutdownNow();
      // Preserve interrupt status
      Thread.currentThread().interrupt();
    }

    delegate.shutdown();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:PooledSjavac.java

示例5: finished

import com.sun.tools.sjavac.Log; //导入依赖的package包/类
@Override
@DefinedBy(Api.COMPILER_TREE)
public void finished(TaskEvent e) {
    switch (e.getKind()) {
    case ANALYZE:
        collectClassSymbols((JCCompilationUnit) e.getCompilationUnit());
        break;
    case COMPILATION:
        Log.debug("Compilation finished");
        Log.debug("Extracting pub APIs for the following symbols:");
        for (ClassSymbol cs : classSymbols)
            Log.debug("    " + cs.fullname);
        extractPubApis();

        // Save result for later retrieval. (Important that we do this
        // before we return from this method, because we may not access
        // symbols after compilation is finished.)
        PubAPIs pa = PubAPIs.instance(context);
        explicitPubApis = pa.getPubapis(explicitJFOs, true);
        nonExplicitPubApis = pa.getPubapis(explicitJFOs, false);

        Log.debug("done");
        break;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:PublicApiCollector.java

示例6: validateOptions

import com.sun.tools.sjavac.Log; //导入依赖的package包/类
private static boolean validateOptions(Options options) {

        String err = null;

        if (options.getDestDir() == null) {
            err = "Please specify output directory.";
        } else if (options.isJavaFilesAmongJavacArgs()) {
            err = "Sjavac does not handle explicit compilation of single .java files.";
        } else if (!options.getImplicitPolicy().equals("none")) {
            err = "The only allowed setting for sjavac is -implicit:none";
        } else if (options.getSources().isEmpty() && options.getStateDir() != null) {
            err = "You have to specify -src when using --state-dir.";
        } else if (options.getTranslationRules().size() > 1
                && options.getGenSrcDir() == null) {
            err = "You have translators but no gensrc dir (-s) specified!";
        }

        if (err != null)
            Log.error(err);

        return err == null;

    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:SjavacImpl.java

示例7: createIfMissing

import com.sun.tools.sjavac.Log; //导入依赖的package包/类
private static boolean createIfMissing(Path dir) {

        if (Files.isDirectory(dir))
            return true;

        if (Files.exists(dir)) {
            Log.error(dir + " is not a directory.");
            return false;
        }

        try {
            Files.createDirectories(dir);
        } catch (IOException e) {
            Log.error("Could not create directory: " + e.getMessage());
            return false;
        }

        return true;
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:SjavacImpl.java

示例8: run

import com.sun.tools.sjavac.Log; //导入依赖的package包/类
public static int run(String[] args, Writer out, Writer err) {

        Log.setLogForCurrentThread(new Log(out, err));

        Options options;
        try {
            options = Options.parseArgs(args);
        } catch (IllegalArgumentException e) {
            Log.error(e.getMessage());
            return Result.CMDERR.exitCode;
        }

        Log.setLogLevel(options.getLogLevel());

        Log.debug("==========================================================");
        Log.debug("Launching sjavac client with the following parameters:");
        Log.debug("    " + options.getStateArgsString());
        Log.debug("==========================================================");

        // Prepare sjavac object
        boolean useServer = options.getServerConf() != null;
        Sjavac sjavac = useServer ? new SjavacClient(options) : new SjavacImpl();

        // Perform compilation
        Result result = sjavac.compile(args);

        // If sjavac is running in the foreground we should shut it down at this point
        if (!useServer) {
            sjavac.shutdown();
        }

        return result.exitCode;
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:ClientMain.java

示例9: makeConnectionAttempt

import com.sun.tools.sjavac.Log; //导入依赖的package包/类
private Socket makeConnectionAttempt() throws IOException {
    Socket socket = new Socket();
    InetAddress localhost = InetAddress.getByName(null);
    InetSocketAddress address = new InetSocketAddress(localhost, portFile.getPort());
    socket.connect(address, CONNECTION_TIMEOUT);
    Log.debug("Connected");
    return socket;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:SjavacClient.java

示例10: write

import com.sun.tools.sjavac.Log; //导入依赖的package包/类
@Override
public void write(int b) throws IOException {
    super.write(b);
    buf.write(b);
    if (buf.isLineComplete()) {
        String line = new String(buf.toByteArray(), 0, buf.size() - LINE_SEP.length);
        Log.log(level, linePrefix + line);
        buf = new EolTrackingByteArrayOutputStream();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:LoggingOutputStream.java

示例11: checkInternalErrorLog

import com.sun.tools.sjavac.Log; //导入依赖的package包/类
private void checkInternalErrorLog() {
    Path errorLog = ServerMain.getErrorLog().getLogDestination();
    if (errorLog != null) {
        Log.error("Server has encountered an internal error. See " + errorLog.toAbsolutePath()
                + " for details.");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:RequestHandler.java

示例12: close

import com.sun.tools.sjavac.Log; //导入依赖的package包/类
public void close() throws IOException {
    if (closed) return;
    closed = true;
    String s = newContent.toString();
    if (!oldContent.equals(s)) {
        int p = file.getName().lastIndexOf(File.separatorChar);
        try (Writer writer = file.openWriter()) {
            writer.write(s);
        }
        Log.debug("Writing " + file.getName().substring(p + 1));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:SmartWriter.java

示例13: compile

import com.sun.tools.sjavac.Log; //导入依赖的package包/类
@Override
public Result compile(String[] args) {
    Log log = Log.get();
    try {
        return pool.submit(() -> {
            Log.setLogForCurrentThread(log);
            return delegate.compile(args);
        }).get();
    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException("Error during compile", e);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:PooledSjavac.java

示例14: srcDstOverlap

import com.sun.tools.sjavac.Log; //导入依赖的package包/类
private static boolean srcDstOverlap(List<SourceLocation> locs, Path dest) {
    for (SourceLocation loc : locs) {
        if (isOverlapping(loc.getPath(), dest)) {
            Log.error("Source location " + loc.getPath() + " overlaps with destination " + dest);
            return true;
        }
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:SjavacImpl.java

示例15: logJavacInvocation

import com.sun.tools.sjavac.Log; //导入依赖的package包/类
private void logJavacInvocation(String[] args) {
    Log.debug("Invoking javac with args");
    Iterator<String> argIter = Arrays.asList(args).iterator();
    while (argIter.hasNext()) {
        String arg = argIter.next();
        String line = "    " + arg;
        if (arg.matches("\\-(d|cp|classpath|sourcepath|source|target)")
                && argIter.hasNext()) {
            line += " " + argIter.next();
        }
        Log.debug(line);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:CompilationService.java


注:本文中的com.sun.tools.sjavac.Log类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。