示例#1
0
 /** Shuts down all the containers initialized by this builder. */
 public void shutdown() {
   if (!initializedContainers.isEmpty()) {
     for (WeldContainer container : initializedContainers.values()) {
       container.shutdown();
     }
   }
 }
示例#2
0
 @Override
 public void run() {
   for (String id : getRunningContainerIds()) {
     WeldContainer container = instance(id);
     if (container != null) {
       container.shutdown();
       // At this time the logger service may not be available - print some basic info to the
       // standard output
       System.out.println(String.format("Weld SE container %s shut down by shutdown hook", id));
     }
   }
 }
示例#3
0
  public static void main(String[] args) {
    // MyFactory m = MyFactory.getInstance();

    // MyService service = m.getMyServiceImpl();

    Weld weld = new Weld();
    WeldContainer container = weld.initialize();

    MyService service = container.select(MyService.class).get();
    System.out.println(service.getValue());

    Scanner s = new Scanner(System.in);
    s.nextInt();

    container.shutdown();
  }
示例#4
0
 @Override
 public void close() {
   shutdown();
 }