Beispiel #1
0
  public void startup() throws IOException {
    SystemConfig system = CobarServer.getInstance().getConfig().getSystem();
    FrontendConnection.setServerVersion(VERSION);
    // start processors
    NIOProcessor[] processors = new NIOProcessor[system.getProcessors()];

    for (int i = 0; i < processors.length; i++) {
      processors[i] =
          new NIOProcessor(
              "Processor" + i, system.getProcessorHandler(), system.getProcessorExecutor());
      processors[i].startup();
    }

    // startup connector
    NIOConnector connector = new NIOConnector("BeeConnector");

    connector.setProcessors(processors);
    connector.start();

    // startup server
    SimpleServerConnectionFactory sf = new SimpleServerConnectionFactory();

    sf.setIdleTimeout(system.getIdleTimeout()); // one hour
    sf.setContainer(ContainerLoader.getDefaultContainer());

    NIOAcceptor server = new NIOAcceptor("BeeServer", m_port, sf);

    server.setProcessors(processors);
    server.start();

    Threads.forGroup("Bee").start(new ProcessorCheckTask(processors));

    LOGGER.info(String.format("BEE server started at %s", m_port));
  }
Beispiel #2
0
  // this should be called during application initialization time
  public static void initialize(File configFile) {
    PlexusContainer container = ContainerLoader.getDefaultContainer();

    initialize(container, configFile);
  }