mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Merge branch 'gradle-loggin' into gradle-welcome-screen
This commit is contained in:
@@ -563,14 +563,12 @@ public class Base {
|
|||||||
cl.downloadAvailableList(this, new ContribProgress(null));
|
cl.downloadAvailableList(this, new ContribProgress(null));
|
||||||
long t9 = System.currentTimeMillis();
|
long t9 = System.currentTimeMillis();
|
||||||
|
|
||||||
if (DEBUG) {
|
Messages.log("core modes: " + (t2b-t2) +
|
||||||
System.out.println("core modes: " + (t2b-t2) +
|
", contrib modes: " + (t2c-t2b) +
|
||||||
", contrib modes: " + (t2c-t2b) +
|
", contrib ex: " + (t2c-t2b));
|
||||||
", contrib ex: " + (t2c-t2b));
|
Messages.log("base took " + (t2-t1) + " " + (t3-t2) + " " + (t4-t3) +
|
||||||
System.out.println("base took " + (t2-t1) + " " + (t3-t2) + " " + (t4-t3) +
|
|
||||||
" " + (t5-t4) + " t6-t5=" + (t6-t5) + " " + (t7-t6) +
|
" " + (t5-t4) + " t6-t5=" + (t6-t5) + " " + (t7-t6) +
|
||||||
" handleNew=" + (t8-t7) + " " + (t9-t8) + " ms");
|
" handleNew=" + (t8-t7) + " " + (t9-t8) + " ms");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -330,6 +330,7 @@ public class Library extends LocalContribution {
|
|||||||
* imports to specific libraries.
|
* imports to specific libraries.
|
||||||
* @param importToLibraryTable mapping from package names to Library objects
|
* @param importToLibraryTable mapping from package names to Library objects
|
||||||
*/
|
*/
|
||||||
|
static boolean instruced = false;
|
||||||
// public void addPackageList(HashMap<String,Library> importToLibraryTable) {
|
// public void addPackageList(HashMap<String,Library> importToLibraryTable) {
|
||||||
public void addPackageList(Map<String, List<Library>> importToLibraryTable) {
|
public void addPackageList(Map<String, List<Library>> importToLibraryTable) {
|
||||||
// PApplet.println(packages);
|
// PApplet.println(packages);
|
||||||
@@ -342,18 +343,20 @@ public class Library extends LocalContribution {
|
|||||||
libraries = new ArrayList<>();
|
libraries = new ArrayList<>();
|
||||||
importToLibraryTable.put(pkg, libraries);
|
importToLibraryTable.put(pkg, libraries);
|
||||||
} else {
|
} else {
|
||||||
if (Base.DEBUG) {
|
if(!instruced) {
|
||||||
System.err.println("The library found in");
|
instruced = true;
|
||||||
System.err.println(getPath());
|
Messages.err("The library found in");
|
||||||
System.err.println("conflicts with");
|
Messages.err(getPath());
|
||||||
|
Messages.err("conflicts with");
|
||||||
for (Library library : libraries) {
|
for (Library library : libraries) {
|
||||||
System.err.println(library.getPath());
|
Messages.err(library.getPath());
|
||||||
}
|
}
|
||||||
System.err.println("which already define(s) the package " + pkg);
|
Messages.err("which already define(s) the package " + pkg);
|
||||||
System.err.println("If you have a line in your sketch that reads");
|
Messages.err("If you have a line in your sketch that reads");
|
||||||
System.err.println("import " + pkg + ".*;");
|
Messages.err("import " + pkg + ".*;");
|
||||||
System.err.println("Then you'll need to first remove one of those libraries.");
|
Messages.err("Then you'll need to first remove one of those libraries.");
|
||||||
System.err.println();
|
}else{
|
||||||
|
Messages.err("\tPackage ("+pkg+")\t conflict found in [" + name + "] with libraries: " + libraries.stream().map(Library::getName).reduce((a, b) -> a + ", " + b).orElse(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
libraries.add(this);
|
libraries.add(this);
|
||||||
|
|||||||
@@ -0,0 +1,282 @@
|
|||||||
|
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /*
|
||||||
|
Part of the Processing project - http://processing.org
|
||||||
|
|
||||||
|
Copyright (c) 2015 The Processing Foundation
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
version 2, as published by the Free Software Foundation.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
package processing.app
|
||||||
|
|
||||||
|
import processing.app.ui.Toolkit
|
||||||
|
import java.awt.EventQueue
|
||||||
|
import java.awt.Frame
|
||||||
|
import java.io.PrintWriter
|
||||||
|
import java.io.StringWriter
|
||||||
|
import javax.swing.JFrame
|
||||||
|
import javax.swing.JOptionPane
|
||||||
|
|
||||||
|
class Messages {
|
||||||
|
companion object {
|
||||||
|
/**
|
||||||
|
* "No cookie for you" type messages. Nothing fatal or all that
|
||||||
|
* much of a bummer, but something to notify the user about.
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun showMessage(title: String = "Message", message: String) {
|
||||||
|
if (Base.isCommandLine()) {
|
||||||
|
println("$title: $message")
|
||||||
|
} else {
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
Frame(), message, title,
|
||||||
|
JOptionPane.INFORMATION_MESSAGE
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Non-fatal error message with optional stack trace side dish.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Non-fatal error message.
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
@JvmOverloads
|
||||||
|
fun showWarning(title: String = "Warning", message: String, e: Throwable? = null) {
|
||||||
|
if (Base.isCommandLine()) {
|
||||||
|
println("$title: $message")
|
||||||
|
} else {
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
Frame(), message, title,
|
||||||
|
JOptionPane.WARNING_MESSAGE
|
||||||
|
)
|
||||||
|
}
|
||||||
|
e?.printStackTrace()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Non-fatal error message with two levels of formatting.
|
||||||
|
* Unlike the others, this is non-blocking and will run later on the EDT.
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun showWarningTiered(
|
||||||
|
title: String,
|
||||||
|
primary: String, secondary: String,
|
||||||
|
e: Throwable?
|
||||||
|
) {
|
||||||
|
if (Base.isCommandLine()) {
|
||||||
|
// TODO All these messages need to be handled differently for
|
||||||
|
// proper parsing on the command line. Many have \n in them.
|
||||||
|
println("$title: $primary\n$secondary")
|
||||||
|
} else {
|
||||||
|
EventQueue.invokeLater {
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
JFrame(),
|
||||||
|
Toolkit.formatMessage(primary, secondary),
|
||||||
|
title, JOptionPane.WARNING_MESSAGE
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e?.printStackTrace()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show an error message that's actually fatal to the program.
|
||||||
|
* This is an error that can't be recovered. Use showWarning()
|
||||||
|
* for errors that allow P5 to continue running.
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun showError(title: String = "Error", message: String, e: Throwable?) {
|
||||||
|
if (Base.isCommandLine()) {
|
||||||
|
System.err.println("$title: $message")
|
||||||
|
} else {
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
Frame(), message, title,
|
||||||
|
JOptionPane.ERROR_MESSAGE
|
||||||
|
)
|
||||||
|
}
|
||||||
|
e?.printStackTrace()
|
||||||
|
System.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Warning window that includes the stack trace.
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun showTrace(
|
||||||
|
title: String?,
|
||||||
|
message: String,
|
||||||
|
t: Throwable?,
|
||||||
|
fatal: Boolean
|
||||||
|
) {
|
||||||
|
val title = title ?: if (fatal) "Error" else "Warning"
|
||||||
|
|
||||||
|
if (Base.isCommandLine()) {
|
||||||
|
System.err.println("$title: $message")
|
||||||
|
t?.printStackTrace()
|
||||||
|
} else {
|
||||||
|
val sw = StringWriter()
|
||||||
|
t!!.printStackTrace(PrintWriter(sw))
|
||||||
|
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
Frame(), // first <br/> clears to the next line
|
||||||
|
// second <br/> is a shorter height blank space before the trace
|
||||||
|
Toolkit.formatMessage("$message<br/><tt><br/>$sw</tt>"),
|
||||||
|
title,
|
||||||
|
if (fatal) JOptionPane.ERROR_MESSAGE else JOptionPane.WARNING_MESSAGE
|
||||||
|
)
|
||||||
|
|
||||||
|
if (fatal) {
|
||||||
|
System.exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun showYesNoQuestion(
|
||||||
|
editor: Frame?, title: String?,
|
||||||
|
primary: String?, secondary: String?
|
||||||
|
): Int {
|
||||||
|
if (!Platform.isMacOS()) {
|
||||||
|
return JOptionPane.showConfirmDialog(
|
||||||
|
editor,
|
||||||
|
Toolkit.formatMessage(primary, secondary), //"<html><body>" +
|
||||||
|
//"<b>" + primary + "</b>" +
|
||||||
|
//"<br>" + secondary,
|
||||||
|
title,
|
||||||
|
JOptionPane.YES_NO_OPTION,
|
||||||
|
JOptionPane.QUESTION_MESSAGE
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
val result = showCustomQuestion(
|
||||||
|
editor, title, primary, secondary,
|
||||||
|
0, "Yes", "No"
|
||||||
|
)
|
||||||
|
return if (result == 0) {
|
||||||
|
JOptionPane.YES_OPTION
|
||||||
|
} else if (result == 1) {
|
||||||
|
JOptionPane.NO_OPTION
|
||||||
|
} else {
|
||||||
|
JOptionPane.CLOSED_OPTION
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param highlight A valid array index for options[] that specifies the
|
||||||
|
* default (i.e. safe) choice.
|
||||||
|
* @return The (zero-based) index of the selected value, -1 otherwise.
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun showCustomQuestion(
|
||||||
|
editor: Frame?, title: String?,
|
||||||
|
primary: String?, secondary: String?,
|
||||||
|
highlight: Int, vararg options: String
|
||||||
|
): Int {
|
||||||
|
val result: Any
|
||||||
|
if (!Platform.isMacOS()) {
|
||||||
|
return JOptionPane.showOptionDialog(
|
||||||
|
editor,
|
||||||
|
Toolkit.formatMessage(primary, secondary), title,
|
||||||
|
JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null,
|
||||||
|
options, options[highlight]
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
val pane =
|
||||||
|
JOptionPane(
|
||||||
|
Toolkit.formatMessage(primary, secondary),
|
||||||
|
JOptionPane.QUESTION_MESSAGE
|
||||||
|
)
|
||||||
|
|
||||||
|
pane.options = options
|
||||||
|
|
||||||
|
// highlight the safest option ala apple hig
|
||||||
|
pane.initialValue = options[highlight]
|
||||||
|
|
||||||
|
val dialog = pane.createDialog(editor, null)
|
||||||
|
dialog.isVisible = true
|
||||||
|
|
||||||
|
result = pane.value
|
||||||
|
}
|
||||||
|
for (i in options.indices) {
|
||||||
|
if (result != null && result == options[i]) return i
|
||||||
|
}
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||||
|
@JvmStatic
|
||||||
|
@Deprecated("Use log() instead")
|
||||||
|
fun log(from: Any, message: String) {
|
||||||
|
if (Base.DEBUG) {
|
||||||
|
val callingClass = Throwable()
|
||||||
|
.stackTrace[2]
|
||||||
|
.className
|
||||||
|
.formatClassName()
|
||||||
|
println("$callingClass: $message")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun log(message: String?) {
|
||||||
|
if (Base.DEBUG) {
|
||||||
|
val callingClass = Throwable()
|
||||||
|
.stackTrace[2]
|
||||||
|
.className
|
||||||
|
.formatClassName()
|
||||||
|
println("$callingClass$message")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun logf(message: String?, vararg args: Any?) {
|
||||||
|
if (Base.DEBUG) {
|
||||||
|
val callingClass = Throwable()
|
||||||
|
.stackTrace[2]
|
||||||
|
.className
|
||||||
|
.formatClassName()
|
||||||
|
System.out.printf("$callingClass$message", *args)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@JvmOverloads
|
||||||
|
fun err(message: String?, e: Throwable? = null) {
|
||||||
|
if (Base.DEBUG) {
|
||||||
|
if (message != null) {
|
||||||
|
val callingClass = Throwable()
|
||||||
|
.stackTrace[4]
|
||||||
|
.className
|
||||||
|
.formatClassName()
|
||||||
|
System.err.println("$callingClass$message")
|
||||||
|
}
|
||||||
|
e?.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper functions to give the base classes a color
|
||||||
|
fun String.formatClassName() = this
|
||||||
|
.replace("processing.", "")
|
||||||
|
.replace(".", "/")
|
||||||
|
.padEnd(40)
|
||||||
|
.colorizePathParts()
|
||||||
|
fun String.colorizePathParts() = split("/").joinToString("/") { part ->
|
||||||
|
"\u001B[${31 + (part.hashCode() and 0x7).rem(6)}m$part\u001B[0m"
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ import java.util.concurrent.ExecutorService;
|
|||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
import processing.app.Base;
|
import processing.app.Base;
|
||||||
|
import processing.app.Messages;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,8 +80,7 @@ public class StreamPump implements Runnable {
|
|||||||
}
|
}
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
if (Base.DEBUG) {
|
if (Base.DEBUG) {
|
||||||
System.err.println("StreamPump: " + name);
|
Messages.err("StreamPump: " + name, e);
|
||||||
e.printStackTrace(System.err);
|
|
||||||
// removing for 0190, but need a better way to handle these
|
// removing for 0190, but need a better way to handle these
|
||||||
throw new RuntimeException("Inside " + this + " for " + name, e);
|
throw new RuntimeException("Inside " + this + " for " + name, e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,9 +79,7 @@ public class InputMethodSupport implements InputMethodRequests, InputMethodListe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Rectangle getTextLocation(TextHitInfo offset) {
|
public Rectangle getTextLocation(TextHitInfo offset) {
|
||||||
if (Base.DEBUG) {
|
Messages.log("#Called getTextLocation:" + offset);
|
||||||
Messages.log("#Called getTextLocation:" + offset);
|
|
||||||
}
|
|
||||||
int line = textArea.getCaretLine();
|
int line = textArea.getCaretLine();
|
||||||
int offsetX = textArea.getCaretPosition() - textArea.getLineStartOffset(line);
|
int offsetX = textArea.getCaretPosition() - textArea.getLineStartOffset(line);
|
||||||
// '+1' mean textArea.lineToY(line) + textArea.getPainter().getFontMetrics().getHeight().
|
// '+1' mean textArea.lineToY(line) + textArea.getPainter().getFontMetrics().getHeight().
|
||||||
@@ -238,9 +236,7 @@ public class InputMethodSupport implements InputMethodRequests, InputMethodListe
|
|||||||
RenderingHints.VALUE_TEXT_ANTIALIAS_ON :
|
RenderingHints.VALUE_TEXT_ANTIALIAS_ON :
|
||||||
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
|
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
|
||||||
FontRenderContext frc = g2d.getFontRenderContext();
|
FontRenderContext frc = g2d.getFontRenderContext();
|
||||||
if (Base.DEBUG) {
|
Messages.log("debug: FontRenderContext is Antialiased = " + frc.getAntiAliasingHint());
|
||||||
Messages.log("debug: FontRenderContext is Antialiased = " + frc.getAntiAliasingHint());
|
|
||||||
}
|
|
||||||
|
|
||||||
return new TextLayout(composedTextString.getIterator(), frc);
|
return new TextLayout(composedTextString.getIterator(), frc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -276,7 +276,9 @@ public class EditorConsole extends JScrollPane {
|
|||||||
// components, causing deadlock. Updates are buffered to the console and
|
// components, causing deadlock. Updates are buffered to the console and
|
||||||
// displayed at regular intervals on Swing's event-dispatching thread.
|
// displayed at regular intervals on Swing's event-dispatching thread.
|
||||||
// (patch by David Mellis)
|
// (patch by David Mellis)
|
||||||
consoleDoc.appendString(what, err ? errStyle : stdStyle);
|
// Remove ANSI escape codes from the text before adding it to the console
|
||||||
|
String clean = what.replaceAll("\u001B\\[[0-9;]*m", "");
|
||||||
|
consoleDoc.appendString(clean, err ? errStyle : stdStyle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ public class CompletionPanel {
|
|||||||
int x = ta.getCaretPosition() - ta.getLineStartOffset(line) - 1, x1 = x - 1;
|
int x = ta.getCaretPosition() - ta.getLineStartOffset(line) - 1, x1 = x - 1;
|
||||||
if (x >= s.length() || x < 0)
|
if (x >= s.length() || x < 0)
|
||||||
return null; //TODO: Does this check cause problems? Verify.
|
return null; //TODO: Does this check cause problems? Verify.
|
||||||
if (Base.DEBUG) System.out.print(" x char: " + s.charAt(x));
|
Messages.log(" x char: " + s.charAt(x));
|
||||||
|
|
||||||
String word = String.valueOf(s.charAt(x));
|
String word = String.valueOf(s.charAt(x));
|
||||||
if (s.trim().length() == 1) {
|
if (s.trim().length() == 1) {
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class PreprocService {
|
|||||||
running = true;
|
running = true;
|
||||||
PreprocSketch prevResult = null;
|
PreprocSketch prevResult = null;
|
||||||
CompletableFuture<?> runningCallbacks = null;
|
CompletableFuture<?> runningCallbacks = null;
|
||||||
Messages.log("PPS: Hi!");
|
Messages.log("Hi!");
|
||||||
while (running) {
|
while (running) {
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
@@ -127,7 +127,7 @@ public class PreprocService {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Messages.log("PPS: Starting");
|
Messages.log("Starting");
|
||||||
|
|
||||||
prevResult = preprocessSketch(prevResult);
|
prevResult = preprocessSketch(prevResult);
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ public class PreprocService {
|
|||||||
synchronized (requestLock) {
|
synchronized (requestLock) {
|
||||||
if (requestQueue.isEmpty()) {
|
if (requestQueue.isEmpty()) {
|
||||||
runningCallbacks = lastCallback;
|
runningCallbacks = lastCallback;
|
||||||
Messages.log("PPS: Done");
|
Messages.log("Done");
|
||||||
preprocessingTask.complete(prevResult);
|
preprocessingTask.complete(prevResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,7 @@ public class PreprocService {
|
|||||||
Messages.err("problem in preprocessor service loop", e);
|
Messages.err("problem in preprocessor service loop", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Messages.log("PPS: Bye!");
|
Messages.log("Bye!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -188,7 +188,7 @@ public class PreprocService {
|
|||||||
* Indicate to this service that the sketch libraries have changed.
|
* Indicate to this service that the sketch libraries have changed.
|
||||||
*/
|
*/
|
||||||
public void notifyLibrariesChanged() {
|
public void notifyLibrariesChanged() {
|
||||||
Messages.log("PPS: notified libraries changed");
|
Messages.log("notified libraries changed");
|
||||||
librariesChanged.set(true);
|
librariesChanged.set(true);
|
||||||
notifySketchChanged();
|
notifySketchChanged();
|
||||||
}
|
}
|
||||||
@@ -197,7 +197,7 @@ public class PreprocService {
|
|||||||
* Indicate to this service that the folder housing sketch code has changed.
|
* Indicate to this service that the folder housing sketch code has changed.
|
||||||
*/
|
*/
|
||||||
public void notifyCodeFolderChanged() {
|
public void notifyCodeFolderChanged() {
|
||||||
Messages.log("PPS: notified code folder changed");
|
Messages.log("notified code folder changed");
|
||||||
codeFolderChanged.set(true);
|
codeFolderChanged.set(true);
|
||||||
notifySketchChanged();
|
notifySketchChanged();
|
||||||
}
|
}
|
||||||
@@ -216,7 +216,7 @@ public class PreprocService {
|
|||||||
.thenAcceptBothAsync(lastCallback, (ps, a) -> callback.accept(ps))
|
.thenAcceptBothAsync(lastCallback, (ps, a) -> callback.accept(ps))
|
||||||
// Make sure exception in callback won't cancel whole callback chain
|
// Make sure exception in callback won't cancel whole callback chain
|
||||||
.handleAsync((res, e) -> {
|
.handleAsync((res, e) -> {
|
||||||
if (e != null) Messages.err("PPS: exception in callback", e);
|
if (e != null) Messages.err("exception in callback", e);
|
||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
return lastCallback;
|
return lastCallback;
|
||||||
|
|||||||
@@ -253,19 +253,19 @@ public class Runner implements MessageConsumer {
|
|||||||
// while (!available) {
|
// while (!available) {
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
Messages.log(getClass().getName() + " attempting to attach to VM");
|
Messages.log("attempting to attach to VM");
|
||||||
synchronized (cancelLock) {
|
synchronized (cancelLock) {
|
||||||
vm = connector.attach(arguments);
|
vm = connector.attach(arguments);
|
||||||
if (cancelled && vm != null) {
|
if (cancelled && vm != null) {
|
||||||
// cancelled and connected to the VM, handle closing now
|
// cancelled and connected to the VM, handle closing now
|
||||||
Messages.log(getClass().getName() + " aborting, launch cancelled");
|
Messages.log("aborting, launch cancelled");
|
||||||
close();
|
close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// vm = connector.attach(arguments);
|
// vm = connector.attach(arguments);
|
||||||
if (vm != null) {
|
if (vm != null) {
|
||||||
Messages.log(getClass().getName() + " attached to the VM");
|
Messages.log("attached to the VM");
|
||||||
// generateTrace();
|
// generateTrace();
|
||||||
// available = true;
|
// available = true;
|
||||||
return true;
|
return true;
|
||||||
@@ -273,17 +273,17 @@ public class Runner implements MessageConsumer {
|
|||||||
} catch (ConnectException ce) {
|
} catch (ConnectException ce) {
|
||||||
// This will fire ConnectException (socket not available) until
|
// This will fire ConnectException (socket not available) until
|
||||||
// the VM finishes starting up and opens its socket for us.
|
// the VM finishes starting up and opens its socket for us.
|
||||||
Messages.log(getClass().getName() + " socket for VM not ready");
|
Messages.log("socket for VM not ready");
|
||||||
// System.out.println("waiting");
|
// System.out.println("waiting");
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
try {
|
try {
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
Messages.err(getClass().getName() + " interrupted", ie);
|
Messages.err("interrupted", ie);
|
||||||
// ie.printStackTrace(sketchErr);
|
// ie.printStackTrace(sketchErr);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Messages.err(getClass().getName() + " while attaching to VM", e);
|
Messages.err("while attaching to VM", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// } catch (IOException exc) {
|
// } catch (IOException exc) {
|
||||||
|
|||||||
Reference in New Issue
Block a user