Permalink
Browse files

Improved agent support - it actually now works.

  • Loading branch information...
JonathanGiles committed Aug 24, 2014
1 parent 4b0e8ec commit 27957f316eef6f9ce5661d8a524fad9098191894
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_20"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JavaFX 8.0"/>
<classpathentry kind="var" path="tools.jar"/>
<classpathentry kind="output" path="build/classes"/>
@@ -43,9 +43,9 @@ sourceSets {
jar {
manifest {
attributes(
'Main-Class': 'org.scenicview.utils.ScenicView', /* Used for standalone Scenic View */
'Agent-Class': 'org.fxconnector.remote.RuntimeAttach', /* But the standalone Scenic View starts up this agent when in runtime attach mode */
'Premain-Class': 'org.scenicview.utils.ScenicView' /* Alternatively, this will be called if Scenic View is started as an agent */
'Main-Class': 'org.scenicview.ScenicView', /* Used for standalone Scenic View */
'Agent-Class': 'org.fxconnector.remote.RuntimeAttach',/* But the standalone Scenic View starts up this agent when in runtime attach mode */
'Premain-Class': 'org.scenicview.ScenicView' /* Alternatively, this will be called if Scenic View is started as an agent */
)
}
}
@@ -29,14 +29,15 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.scenicview.utils;
package org.scenicview;

import java.lang.instrument.Instrumentation;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.List;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
@@ -46,11 +47,14 @@
import org.fxconnector.StageControllerImpl;
import org.fxconnector.remote.FXConnector;
import org.fxconnector.remote.FXConnectorFactory;
import org.scenicview.ScenicViewGui;
import org.scenicview.update.DummyUpdateStrategy;
import org.scenicview.update.RemoteVMsUpdateStrategy;
import org.scenicview.utils.ExceptionLogger;
import org.scenicview.utils.ScenicViewDebug;
import org.scenicview.utils.attach.AttachHandlerFactory;

import com.sun.javafx.tk.Toolkit;

/**
* This is the entry point for all different versions of Scenic View.
*/
@@ -123,7 +127,20 @@ public static void show(final Parent target) {
*
*************************************************************************/
public static void premain(final String agentArgs, final Instrumentation instrumentation) {
launch(agentArgs);
// we start up a new thread to take care of initialising Scenic View
// so that we don't block the loading of the actual application.
Thread scenicViewBootThread = new Thread(() -> {
Toolkit tk = Toolkit.getToolkit();
Platform.runLater(() -> {
try {
new ScenicView().start(new Stage());
} catch (Exception e) {
e.printStackTrace();
}
});
}, "scenic-view-boot");
scenicViewBootThread.setDaemon(true);
scenicViewBootThread.start();
}

public static void main(final String[] args) {
@@ -31,9 +31,9 @@
*/
package org.scenicview.dialog;

import org.scenicview.utils.ScenicView;
import org.scenicview.utils.PropertiesUtils;
import org.scenicview.DisplayUtils;
import org.scenicview.ScenicView;
import org.scenicview.ScenicViewGui;

import java.util.Properties;
@@ -31,7 +31,7 @@
*/
package org.scenicview.utils.attach;

import static org.scenicview.utils.ScenicView.JDK_PATH_KEY;
import static org.scenicview.ScenicView.JDK_PATH_KEY;

import java.io.File;
import java.lang.reflect.Field;
@@ -47,9 +47,9 @@
import javafx.stage.Stage;

import org.fxconnector.Debugger;
import org.scenicview.ScenicView;
import org.scenicview.utils.ExceptionLogger;
import org.scenicview.utils.PropertiesUtils;
import org.scenicview.utils.ScenicView;
import org.scenicview.utils.ScenicViewDebug;
import org.scenicview.utils.Utils;

0 comments on commit 27957f3

Please sign in to comment.