use of com.insightfullogic.honest_profiler.core.MachineListener in project honest-profiler by jvm-profiling-tools.
the class AgentIntegrationTest method discoverVirtualMachines.
private AtomicReference<Profile> discoverVirtualMachines() {
AtomicReference<Profile> lastProfile = new AtomicReference<>();
parkNanos(SECONDS.toNanos(1));
new LocalMachineSource(logger, new MachineListener() {
@Override
public void onNewMachine(final VirtualMachine machine) {
if (machine.isAgentLoaded()) {
final FileLogSource logSource = (FileLogSource) machine.getLogSource();
file.set(logSource);
Monitor.pipeFile(logSource, lastProfile::set);
}
}
@Override
public void onClosedMachine(final VirtualMachine machine) {
}
}).discoverVirtualMachines();
return lastProfile;
}
Aggregations