MCPcopy Create free account
hub / github.com/andytill/erlyberly / retrieveProcessInfo

Method retrieveProcessInfo

src/main/java/erlyberly/node/NodeAPI.java:209–231  ·  view source on GitHub ↗
(ArrayList<ProcInfo> processes)

Source from the content-addressed store, hash-verified

207 }
208
209 public synchronized void retrieveProcessInfo(ArrayList<ProcInfo> processes) throws Exception {
210 assert !Platform.isFxApplicationThread() : "cannot run this method from the FX thread";
211
212 OtpErlangObject receiveRPC = null;
213
214 try {
215 sendRPC("erlyberly", "process_info", new OtpErlangList());
216 receiveRPC = receiveRPC();
217 OtpErlangList received = (OtpErlangList) receiveRPC;
218
219 for (OtpErlangObject recv : received) {
220 if(recv instanceof OtpErlangList) {
221 OtpErlangList pinfo = (OtpErlangList) recv;
222 HashMap<Object, Object> propsToMap = OtpUtil.propsToMap(pinfo);
223 processes.add(ProcInfo.toProcessInfo(propsToMap));
224 }
225 }
226
227 Platform.runLater(() -> { appProcs.set(new AppProcs(processes.size(), LocalDateTime.now())); });
228 } catch (ClassCastException e) {
229 throw new RuntimeException("unexpected result: " + receiveRPC, e);
230 }
231 }
232
233 private boolean ensureAlive() {
234 if(connection.isAlive())

Callers 1

runMethod · 0.80

Calls 4

sendRPCMethod · 0.95
receiveRPCMethod · 0.95
propsToMapMethod · 0.95
toProcessInfoMethod · 0.95

Tested by

no test coverage detected