mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Removed commented out jvmstat code from Base.
This commit is contained in:
@@ -25,8 +25,6 @@ package processing.app;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
//import java.lang.management.ManagementFactory;
|
||||
//import sun.jvmstat.monitor.*;
|
||||
import java.net.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
@@ -175,128 +173,8 @@ public class Base {
|
||||
// System.out.println("about to create base...");
|
||||
new Base(args);
|
||||
// System.out.println("done creating base...");
|
||||
|
||||
// String filename = args.length > 1 ? args[0] : null;
|
||||
// if (Preferences.get("server.port") == null
|
||||
// || !sendArgumentsToOtherInstance(filename, 1000)) {
|
||||
//
|
||||
// createSingleInstanceServer();
|
||||
// new Base(args);
|
||||
// }
|
||||
|
||||
// try {
|
||||
// String vmName = ManagementFactory.getRuntimeMXBean().getName();
|
||||
// MonitoredHost localhost = MonitoredHost.getMonitoredHost((String) null);
|
||||
// VmIdentifier runningVmId = new VmIdentifier(vmName);
|
||||
//
|
||||
// if (Base.isOnlyInstance(localhost, runningVmId)) {
|
||||
// Base.addNewPdeListener(localhost, runningVmId);
|
||||
//
|
||||
// System.out.println("about to create base...");
|
||||
// new Base(args);
|
||||
// System.out.println("done creating base...");
|
||||
// } else {
|
||||
// Base.sendArgumentsToOtherInstance(args, 500);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// }
|
||||
}
|
||||
|
||||
// /** @return true if this is the only instance of this program, false otherwise */
|
||||
// static private boolean isOnlyInstance(MonitoredHost localhost,
|
||||
// VmIdentifier runningVmId) throws Exception {
|
||||
//
|
||||
// // Search for another vm using the same fully-qualified class name for main
|
||||
// for (Object lvmidObj : localhost.activeVms()) {
|
||||
// if (lvmidObj instanceof Integer) {
|
||||
// VmIdentifier otherVmId = new VmIdentifier(lvmidObj.toString());
|
||||
// if (Base.isDifferentInstance(localhost, runningVmId, otherVmId)) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return true if runningVmId and otherLocalVmId are two different instances
|
||||
// * of the same program
|
||||
// */
|
||||
// static private boolean isDifferentInstance(MonitoredHost monitoredHost,
|
||||
// VmIdentifier runningVmId,
|
||||
// VmIdentifier otherLocalVmId)
|
||||
// throws Exception {
|
||||
//
|
||||
// if (runningVmId.getLocalVmId() != otherLocalVmId.getLocalVmId()) {
|
||||
// String runningProgram = getProgramName(monitoredHost, runningVmId);
|
||||
// String otherProgram = getProgramName(monitoredHost, otherLocalVmId);
|
||||
//
|
||||
// return runningProgram.equals(otherProgram);
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// /** @return how this program was initialized (e.g. may be a class or jar file) */
|
||||
// static private String getProgramName(MonitoredHost host,
|
||||
// VmIdentifier otherVmId)
|
||||
// throws Exception {
|
||||
//
|
||||
// MonitoredVm mvm = host.getMonitoredVm(otherVmId);
|
||||
// String name = MonitoredVmUtil.commandLine(mvm);
|
||||
// mvm.detach();
|
||||
//
|
||||
// if ("Unknown".equals(name)) {
|
||||
// throw new Exception("Unable to determine command line");
|
||||
// }
|
||||
//
|
||||
// return name.split(" ")[0];
|
||||
// }
|
||||
//
|
||||
// private static void addNewPdeListener(final MonitoredHost localhost,
|
||||
// final VmIdentifier runningVmId)
|
||||
// throws Exception {
|
||||
//
|
||||
// final ServerSocket ss = new ServerSocket(0);
|
||||
// ss.setSoTimeout(500);
|
||||
// Preferences.set("server.port", "" + ss.getLocalPort());
|
||||
//
|
||||
// localhost.addHostListener(new HostListener() {
|
||||
// public void vmStatusChanged(VmStatusChangeEvent arg) {
|
||||
// for (final Object lvmidObj : arg.getStarted()) {
|
||||
// if (lvmidObj instanceof Integer) {
|
||||
// try {
|
||||
// VmIdentifier otherVmId = new VmIdentifier(lvmidObj.toString());
|
||||
// if (Base.isDifferentInstance(localhost, runningVmId, otherVmId)
|
||||
// && platform.base != null) {
|
||||
// EventQueue.invokeLater(new Runnable() {
|
||||
// public void run() {
|
||||
// try {
|
||||
// Socket s = ss.accept();
|
||||
// BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
|
||||
// String filename = br.readLine();
|
||||
// if (filename != null) {
|
||||
// platform.base.handleOpen(filename);
|
||||
// return;
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// }
|
||||
//
|
||||
// platform.base.handleNew();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void disconnected(HostEvent arg) { }
|
||||
// });
|
||||
// }
|
||||
|
||||
private static void createSingleInstanceServer() {
|
||||
try {
|
||||
final ServerSocket ss = new ServerSocket(0, 0,
|
||||
|
||||
Reference in New Issue
Block a user