Package com.google.common.eventbus

Examples of com.google.common.eventbus.EventBus$EventWithHandler


    log("Forked JVM process command line (may need escape sequences for your shell):\n" +
        slave.slaveCommandLine, Project.MSG_VERBOSE);

    commandline.createArgument().setValue(SlaveMain.OPTION_STDIN);

    final EventBus eventBus = new EventBus("slave-" + slave.id);
    final DiagnosticsListener diagnosticsListener = new DiagnosticsListener(slave, this);
    eventBus.register(diagnosticsListener);
    eventBus.register(new AggregatingListener(aggregatedBus, slave));

    final AtomicReference<Charset> clientCharset = new AtomicReference<Charset>();
    final AtomicBoolean clientWithLimitedCharset = new AtomicBoolean();
    final PrintWriter w = new PrintWriter(Files.newWriter(classNamesDynamic, Charsets.UTF_8));
    eventBus.register(new Object() {
      @SuppressWarnings("unused")
      @Subscribe
      public void onIdleSlave(final SlaveIdle idleSlave) {
        aggregatedBus.post(new SlaveIdle() {
          @Override
View Full Code Here


        }
      }
      List<LifecycleAware> components = Lists.newArrayList();
      Application application;
      if(reload) {
        EventBus eventBus = new EventBus(agentName + "-event-bus");
        PollingPropertiesFileConfigurationProvider configurationProvider =
            new PollingPropertiesFileConfigurationProvider(agentName,
                configurationFile, eventBus, 30);
        components.add(configurationProvider);
        application = new Application(components);
        eventBus.register(application);
      } else {
        PropertiesFileConfigurationProvider configurationProvider =
            new PropertiesFileConfigurationProvider(agentName,
                configurationFile);
        application = new Application();
View Full Code Here

  }

  @Test
  public void testBasicConfiguration() throws Exception {

    EventBus eventBus = new EventBus("test-event-bus");

    MaterializedConfiguration materializedConfiguration = new
        SimpleMaterializedConfiguration();

    SourceRunner sourceRunner = mockLifeCycle(SourceRunner.class);
    materializedConfiguration.addSourceRunner("test", sourceRunner);

    SinkRunner sinkRunner = mockLifeCycle(SinkRunner.class);
    materializedConfiguration.addSinkRunner("test", sinkRunner);

    Channel channel = mockLifeCycle(Channel.class);
    materializedConfiguration.addChannel("test", channel);


    ConfigurationProvider configurationProvider = mock(ConfigurationProvider.class);
    when(configurationProvider.getConfiguration()).thenReturn(materializedConfiguration);

    Application application = new Application();
    eventBus.register(application);
    eventBus.post(materializedConfiguration);
    application.start();

    Thread.sleep(1000L);

    verify(sourceRunner).start();
View Full Code Here

    File configFile = new File(baseDir, "flume-conf.properties");
    Files.copy(new File(getClass().getClassLoader()
        .getResource("flume-conf.properties").getFile()), configFile);
    Random random = new Random();
    for (int i = 0; i < 3; i++) {
      EventBus eventBus = new EventBus("test-event-bus");
      PollingPropertiesFileConfigurationProvider configurationProvider =
          new PollingPropertiesFileConfigurationProvider("host1",
              configFile, eventBus, 1);
      List<LifecycleAware> components = Lists.newArrayList();
      components.add(configurationProvider);
      Application application = new Application(components);
      eventBus.register(application);
      application.start();
      Thread.sleep(random.nextInt(10000));
      application.stop();
    }
  }
View Full Code Here

    baseDir = Files.createTempDir();

    configFile = new File(baseDir, TESTFILE.getName());
    Files.copy(TESTFILE, configFile);

    eventBus = new EventBus("test");
    provider =
        new PollingPropertiesFileConfigurationProvider("host1",
            configFile, eventBus, 1);
    provider.start();
    LifecycleController.waitForOneOf(provider, LifecycleState.START_OR_ERROR);
View Full Code Here

    private EventBus eventBus;

    @Override
    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
        EventBus resolvedEventBus = eventBus;
        if (resolvedEventBus == null) {
            resolvedEventBus = CamelContextHelper.mandatoryLookup(getCamelContext(), remaining, EventBus.class);
        }
        return new GuavaEventBusEndpoint(uri, this, resolvedEventBus);
    }
View Full Code Here

    @Test
    public void testLocalProvider() throws GFacException,GFacProviderException {
        LocalDirectorySetupHandler localDirectorySetupHandler = new LocalDirectorySetupHandler();
        localDirectorySetupHandler.invoke(jobExecutionContext);
        LocalProvider localProvider = new LocalProvider();
        localProvider.setMonitorPublisher(new MonitorPublisher(new EventBus()));
        localProvider.initialize(jobExecutionContext);
        localProvider.execute(jobExecutionContext);
        localProvider.dispose(jobExecutionContext);
    }
View Full Code Here

        this.finishQueue = finishQueue;          // these will be initialized by the MonitorManager
        this.availableChannels = new HashMap<String, Channel>();
        this.connectionName = connectionName;
        this.proxyPath = proxyPath;
        this.amqpHosts = hosts;
        this.localPublisher = new MonitorPublisher(new EventBus());
        this.localPublisher.registerListener(this);
    }
View Full Code Here

    public void initialize(String proxyPath, String connectionName, List<String> hosts) {
        this.availableChannels = new HashMap<String, Channel>();
        this.connectionName = connectionName;
        this.proxyPath = proxyPath;
        this.amqpHosts = hosts;
        this.localPublisher = new MonitorPublisher(new EventBus());
        this.localPublisher.registerListener(this);
    }
View Full Code Here

    private MonitorPublisher publisher;

    public HPCPullMonitor(){
        connections = new HashMap<String, ResourceConnection>();
        this.queue = new LinkedBlockingDeque<UserMonitorData>();
        publisher = new MonitorPublisher(new EventBus());
    }
View Full Code Here

TOP

Related Classes of com.google.common.eventbus.EventBus$EventWithHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.