MCPcopy Index your code
hub / github.com/processing/processing / run

Method run

app/src/processing/app/SingleInstance.java:70–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68 Messages.log("Starting SingleInstance thread");
69 new Thread(new Runnable() {
70 public void run() {
71 while (true) {
72 try {
73 Socket s = ss.accept(); // blocks (sleeps) until connection
74 final BufferedReader reader = PApplet.createReader(s.getInputStream());
75 String receivedKey = reader.readLine();
76 Messages.log(this, "key is " + key + ", received is " + receivedKey);
77
78 if (key.equals(receivedKey)) {
79 EventQueue.invokeLater(new Runnable() {
80 public void run() {
81 try {
82 Messages.log(this, "about to read line");
83 String path = reader.readLine();
84 if (path == null) {
85 // Because an attempt was made to launch the PDE again,
86 // throw the user a bone by at least opening a new
87 // Untitled window for them.
88 Messages.log(this, "opening new empty sketch");
89// platform.base.handleNew();
90 base.handleNew();
91
92 } else {
93 // loop through the sketches that were passed in
94 do {
95 Messages.log(this, "calling open with " + path);
96// platform.base.handleOpen(filename);
97 base.handleOpen(path);
98 path = reader.readLine();
99 } while (path != null);
100 }
101 } catch (IOException e) {
102 e.printStackTrace();
103 }
104 }
105 });
106 } else {
107 Messages.log(this, "keys do not match");
108 }
109// }
110 } catch (IOException e) {
111 Messages.loge("SingleInstance error while listening", e);
112 }
113 }
114 }
115 }, "SingleInstance Server").start();
116
117 } catch (IOException e) {

Callers

nothing calls this directly

Calls 8

createReaderMethod · 0.95
logMethod · 0.95
logeMethod · 0.95
handleNewMethod · 0.80
handleOpenMethod · 0.80
acceptMethod · 0.65
equalsMethod · 0.45
printStackTraceMethod · 0.45

Tested by

no test coverage detected