@Override public String getName() { return fiber.getName(); }
@Override public String getName() { return fiber.getName(); }
private FiberInfo makeFiberInfo(State state, Object blocker, StackTraceElement[] stackTrace) { return new FiberInfo(fid, getName(), state, blocker, threadToFiberStack(stackTrace)); }
@Override public void setRunawayFibers(Collection<Fiber> fs) { if (fs == null || fs.isEmpty()) this.problemFibers = null; else { Map<Fiber, StackTraceElement[]> map = new HashMap<>(); for (Fiber f : fs) { Thread t = f.getRunningThread(); final String status; if (t == null) status = "hogging the CPU or blocking a thread"; else if (t.getState() == Thread.State.RUNNABLE) status = "hogging the CPU (" + t + ")"; else status = "blocking a thread (" + t + ")"; StackTraceElement[] st = f.getStackTrace(); Map<Fiber, StackTraceElement[]> pf = problemFibers; if (pf == null || !pf.containsKey(f)) { Notification n = new RunawayFiberNotification(this, notificationSequenceNumber++, System.currentTimeMillis(), "Runaway fiber " + f.getName() + " is " + status + ":\n" + Strand.toString(st)); sendNotification(n); } map.put(f, st); } this.problemFibers = map; } }