Package com.google.common.eventbus

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


        // 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();
View Full Code Here


    }
  }

  @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);
View Full Code Here

    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());
View Full Code Here

       
        persistenceSession.open();
    }

    protected EventBus newEventBus() {
        return new EventBus(newEventBusSubscriberExceptionHandler());
    }
View Full Code Here

       
        persistenceSession.open();
    }

    protected EventBus newEventBus() {
        return new EventBus(newEventBusSubscriberExceptionHandler());
    }
View Full Code Here

      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);
View Full Code Here

   @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);
   }
View Full Code Here

      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
View Full Code Here

      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);
View Full Code Here

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