Exemplo n.º 1
0
 private static CdiContainer startContainer() {
   CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
   cdiContainer.boot();
   ContextControl contextControl = cdiContainer.getContextControl();
   contextControl.startContext(ApplicationScoped.class);
   return cdiContainer;
 }
  public static void main(String[] args) {
    LOG.info("Argument list is " + args.length + " items long");
    Configuration config = new Configuration();
    config.setArgs(args);

    CdiContainer container = CdiContainerLoader.getCdiContainer();
    container.boot();
    ContextControl ctxControl = container.getContextControl();
    ctxControl.startContexts();

    LOG.info("Sending event");
    container.getBeanManager().fireEvent(config);

    try {
      LOG.info("Sleeping for 50 seconds");
      Thread.sleep(50000);
    } catch (InterruptedException ex) {
      LOG.error("Thread sleep error.");
    }
  }