Search in sources :

Example 1 with LocalMachineSource

use of com.insightfullogic.honest_profiler.ports.sources.LocalMachineSource 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;
}
Also used : FileLogSource(com.insightfullogic.honest_profiler.ports.sources.FileLogSource) LocalMachineSource(com.insightfullogic.honest_profiler.ports.sources.LocalMachineSource) AtomicReference(java.util.concurrent.atomic.AtomicReference) MachineListener(com.insightfullogic.honest_profiler.core.MachineListener) Profile(com.insightfullogic.honest_profiler.core.profiles.Profile) VirtualMachine(com.insightfullogic.honest_profiler.core.sources.VirtualMachine)

Example 2 with LocalMachineSource

use of com.insightfullogic.honest_profiler.ports.sources.LocalMachineSource in project honest-profiler by jvm-profiling-tools.

the class RootController method initialize.

// FXML Implementation
@Override
@FXML
public void initialize() {
    super.initialize();
    setApplicationContext(new ApplicationContext(this));
    // Bind the InfoBar Node to the ApplicationContext.
    info.textProperty().bind(appCtx().getInfo());
    // Monitor running VMs on the local machine.
    machineSource = new LocalMachineSource(getLogger(getClass()), this);
    machineSource.start();
}
Also used : ApplicationContext(com.insightfullogic.honest_profiler.ports.javafx.model.ApplicationContext) LocalMachineSource(com.insightfullogic.honest_profiler.ports.sources.LocalMachineSource) FXML(javafx.fxml.FXML)

Aggregations

LocalMachineSource (com.insightfullogic.honest_profiler.ports.sources.LocalMachineSource)2 MachineListener (com.insightfullogic.honest_profiler.core.MachineListener)1 Profile (com.insightfullogic.honest_profiler.core.profiles.Profile)1 VirtualMachine (com.insightfullogic.honest_profiler.core.sources.VirtualMachine)1 ApplicationContext (com.insightfullogic.honest_profiler.ports.javafx.model.ApplicationContext)1 FileLogSource (com.insightfullogic.honest_profiler.ports.sources.FileLogSource)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 FXML (javafx.fxml.FXML)1