Esempio n. 1
0
File: Main.java Progetto: osi/nanjy
  public Main(Options options) throws MalformedURLException {
    Fibers fibers = new Fibers();
    Channels channels = new Channels();

    Fiber core = fibers.core();

    new Connector(
            channels.added(),
            channels.removed(),
            core,
            new VirtualMachineFactory(
                new AgentHolder(),
                new MainClassOrJarFile(),
                new GroovyScriptMonitorFactories(options.monitorScriptsSource.toURI().toURL()),
                channels.samples(),
                fibers.sampler()))
        .start();

    new VirtualMachineLogger(core, channels.added(), channels.removed());

    channels.samples().subscribe(fibers.emitter(), new CollectdEmitter());

    core.scheduleWithFixedDelay(
        new Scanner(channels.added(), channels.removed()),
        0,
        options.virtualMachineScanInterval,
        TimeUnit.SECONDS);
  }