Examples of EventBus


Examples of com.google.common.eventbus.EventBus

        // get options
        String zkConnectionStr = commandLine.getOptionValue('z');
        String baseZkPath = commandLine.getOptionValue('p');

        if (reload) {
          EventBus eventBus = new EventBus(agentName + "-event-bus");
          List<LifecycleAware> components = Lists.newArrayList();
          PollingZooKeeperConfigurationProvider zookeeperConfigurationProvider =
            new PollingZooKeeperConfigurationProvider(
              agentName, zkConnectionStr, baseZkPath, eventBus);
          components.add(zookeeperConfigurationProvider);
          application = new Application(components);
          eventBus.register(application);
        } else {
          StaticZooKeeperConfigurationProvider zookeeperConfigurationProvider =
            new StaticZooKeeperConfigurationProvider(
              agentName, zkConnectionStr, baseZkPath);
          application = new Application();
          application.handleConfigurationEvent(zookeeperConfigurationProvider
            .getConfiguration());
        }
      } else {
        File configurationFile = new File(commandLine.getOptionValue('f'));

        /*
         * The following is to ensure that by default the agent will fail on
         * startup if the file does not exist.
         */
        if (!configurationFile.exists()) {
          // If command line invocation, then need to fail fast
          if (System.getProperty(Constants.SYSPROP_CALLED_FROM_SERVICE) ==
            null) {
            String path = configurationFile.getPath();
            try {
              path = configurationFile.getCanonicalPath();
            } catch (IOException ex) {
              logger.error("Failed to read canonical path for file: " + path,
                ex);
            }
            throw new ParseException(
              "The specified configuration file does not exist: " + path);
          }
        }
        List<LifecycleAware> components = Lists.newArrayList();

        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();

Examples of com.google.common.eventbus.EventBus

    }
  }

  @Override
  protected void doSetUp() throws Exception {
    eb = new EventBus("test");
    es = new EventSync();
    es.reset();
    eb.register(es);
    cp = new PollingZooKeeperConfigurationProvider(AGENT_NAME, "localhost:"
        + zkServer.getPort(), null, eb);

Examples of com.google.common.eventbus.EventBus

    public OtpNodeProxy(final RuntimeData data) {
        this.data = data;

        eventHelper = new EventParser();
        final String nodeName = getNodeName();
        eventBus = new EventBus(nodeName);
        eventBus.register(this);
        registerEventListener(new LogEventHandler(nodeName));
        registerEventListener(new ErlangLogEventHandler(nodeName));

        addListener(new OtpNodeProxyListener(), executor());

Examples of com.google.common.eventbus.EventBus

       
        persistenceSession.open();
    }

    protected EventBus newEventBus() {
        return new EventBus(newEventBusSubscriberExceptionHandler());
    }

Examples of com.google.common.eventbus.EventBus

       
        persistenceSession.open();
    }

    protected EventBus newEventBus() {
        return new EventBus(newEventBusSubscriberExceptionHandler());
    }

Examples of com.google.common.eventbus.EventBus

      replay(mockFuture);
      replay(schedulerMock);

      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
            new EventBus());

      assertNull(monitor.getFuture());
      assertNull(monitor.getTimeout());

      monitor.startMonitoring(null, TimeUnit.MILLISECONDS);

Examples of com.google.common.eventbus.EventBus

   @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "timeUnit must not be null when using timeouts")
   public void testStartMonitoringWithNullTimeout() {
      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
            new EventBus());

      monitor.startMonitoring(100L, null);
   }

Examples of com.google.common.eventbus.EventBus

      replay(mockFuture);
      replay(schedulerMock);

      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
            new EventBus());

      assertNull(monitor.getFuture());
      assertNull(monitor.getTimeout());

      // If the maxWait parameter is null, timeUnit is not required

Examples of com.google.common.eventbus.EventBus

      replay(mockFuture);
      replay(schedulerMock);

      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
            new EventBus());

      assertNull(monitor.getFuture());
      assertNull(monitor.getTimeout());

      monitor.startMonitoring(100L, TimeUnit.MILLISECONDS);

Examples of com.google.common.eventbus.EventBus

      replay(mockFuture);
      replay(schedulerMock);

      AsyncMonitor<Object> monitor = mockMonitor(schedulerMock, new Object(), mockFunction(MonitorStatus.DONE),
            new EventBus());

      assertNull(monitor.getFuture());
      assertNull(monitor.getTimeout());

      monitor.startMonitoring(1L, TimeUnit.MINUTES);
TOP
Copyright © 2018 www.massapi.com. 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.