本文整理汇总了Java中com.sun.tools.sjavac.Log.debug方法的典型用法代码示例。如果您正苦于以下问题:Java Log.debug方法的具体用法?Java Log.debug怎么用?Java Log.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.sjavac.Log
的用法示例。
在下文中一共展示了Log.debug方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
}
示例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");
}
示例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();
}
示例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;
}
}
示例6: 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;
}
示例7: 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;
}
示例8: 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));
}
}
示例9: 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);
}
}
示例10: startServer
import com.sun.tools.sjavac.Log; //导入方法依赖的package包/类
/**
* Start a server using a settings string. Typically: "--startserver:portfile=/tmp/myserver,poolsize=3" and the string "portfile=/tmp/myserver,poolsize=3"
* is sent as the settings parameter. Returns 0 on success, -1 on failure.
*/
public int startServer() throws IOException, InterruptedException {
long serverStart = System.currentTimeMillis();
// The port file is locked and the server port and cookie is written into it.
portFile = getPortFile(portfilename);
synchronized (portFile) {
portFile.lock();
portFile.getValues();
if (portFile.containsPortInfo()) {
Log.debug("Javac server not started because portfile exists!");
portFile.unlock();
return Result.ERROR.exitCode;
}
// .-----------. .--------. .------.
// socket -->| IdleReset |-->| Pooled |-->| Impl |--> javac
// '-----------' '--------' '------'
sjavac = new SjavacImpl();
sjavac = new PooledSjavac(sjavac, poolsize);
sjavac = new IdleResetSjavac(sjavac,
this,
keepalive * 1000);
serverSocket = new ServerSocket();
InetAddress localhost = InetAddress.getByName(null);
serverSocket.bind(new InetSocketAddress(localhost, 0));
// At this point the server accepts connections, so it is now safe
// to publish the port / cookie information
portFile.setValues(getPort(), getCookie());
portFile.unlock();
}
portFileMonitor = new PortFileMonitor(portFile, this);
portFileMonitor.start();
Log.debug("Sjavac server started. Accepting connections...");
Log.debug(" port: " + getPort());
Log.debug(" time: " + new java.util.Date());
Log.debug(" poolsize: " + poolsize);
keepAcceptingRequests.set(true);
do {
try {
Socket socket = serverSocket.accept();
new RequestHandler(socket, sjavac).start();
} catch (SocketException se) {
// Caused by serverSocket.close() and indicates shutdown
}
} while (keepAcceptingRequests.get());
Log.debug("Shutting down.");
// No more connections accepted. If any client managed to connect after
// the accept() was interrupted but before the server socket is closed
// here, any attempt to read or write to the socket will result in an
// IOException on the client side.
long realTime = System.currentTimeMillis() - serverStart;
Log.debug("Total wall clock time " + realTime + "ms build time " + totalBuildTime + "ms");
// Shut down
sjavac.shutdown();
return Result.OK.exitCode;
}
示例11: printRound
import com.sun.tools.sjavac.Log; //导入方法依赖的package包/类
private static void printRound(int round) {
Log.debug("****************************************");
Log.debug("* Round " + round + " *");
Log.debug("****************************************");
}