org.jvnet.hk2.config.Dom.addListener()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中org.jvnet.hk2.config.Dom.addListener()方法的一些代码示例,展示了Dom.addListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dom.addListener()方法的具体详情如下:
包路径:org.jvnet.hk2.config.Dom
类名称:Dom
方法名:addListener

Dom.addListener介绍

暂无

代码示例

代码示例来源:origin: com.sun.enterprise/config

protected void injectInto(Dom injectable, Object target) {
  for (Class intf : target.getClass().getInterfaces()) {
    if (ConfigListener.class.isAssignableFrom(intf)) {
      ConfigListener listener = (ConfigListener) target;
      addListener(listener);
      return;
    }
  }
}

代码示例来源:origin: org.glassfish.hk2/config

protected void injectInto(Dom injectable, Object target) {
  for (Class intf : target.getClass().getInterfaces()) {
    if (ConfigListener.class.isAssignableFrom(intf)) {
      ConfigListener listener = (ConfigListener) target;
      addListener(listener);
      return;
    }
  }
}

代码示例来源:origin: org.glassfish.main.cluster/gms-adapter

private void initializeHealthHistory(Cluster cluster) {
  try {
    /*
     * Should not fail, but we need to make sure it doesn't
     * affect GMS just in case.
     */
    hHistory = new HealthHistory(cluster);
    Dom.unwrap(cluster).addListener(hHistory);
  } catch (Throwable t) {
    GMS_LOGGER.log(LogLevel.WARNING, GMS_EXCEPTION_NEW_HEALTH_HISTORY,
      t.getLocalizedMessage());
  }
}

代码示例来源:origin: org.glassfish.main.virtualization/virt-core

@Override
  public UnprocessedChangeEvents changed(PropertyChangeEvent[] propertyChangeEvents) {
    Virtualizations virts = services.forContract(Virtualizations.class).get();
    for (Virtualization virt : virts.getVirtualizations()) {
      processVirtualization(virt);
    }
    Dom.unwrap(virts).addListener(IAASImpl.this);
    return null;
  }
});

代码示例来源:origin: org.glassfish.main.virtualization/virt-core

private void processVirtualization(Virtualization virtualization) {
  if (virtConfigs.containsKey(virtualization.getName())) return;
  virtConfigs.put(virtualization.getName(), virtualization);
  Dom.unwrap(virtualization).addListener(new VirtualizationListener(virtualization));
  for (ServerPoolConfig groupConfig : virtualization.getServerPools()) {
    try {
      ServerPool group = addServerPool(groupConfig);
      System.out.println("I have a serverPool " + group.getName());
      if (group instanceof PhysicalServerPool) {
        for (Machine machine : ((PhysicalServerPool) group).machines()) {
          System.out.println("LibVirtMachine  " + machine.getName() + " is at " + machine.getIpAddress() + " state is " + machine.getState());
          if (machine.getState().equals(Machine.State.READY)) {
            try {
              System.out.println(machine.toString());
            } catch (Exception e) {
              e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: org.glassfish.main.virtualization/virt-core

public IAASImpl(@Inject(optional = true) Virtualizations virtualizations,
        @Inject Transactions transactions,
        @Inject ServerEnvironment env,
        @Inject final Services services) {
  this.services = services;
  // first executeAndWait the fping command to populate our arp table.
  transactions.addListenerForType(Virtualization.class, this);
  if (virtualizations==null) {
    transactions.addListenerForType(Virtualizations.class, new ConfigListener() {
      @Override
      public UnprocessedChangeEvents changed(PropertyChangeEvent[] propertyChangeEvents) {
        Virtualizations virts = services.forContract(Virtualizations.class).get();
        for (Virtualization virt : virts.getVirtualizations()) {
          processVirtualization(virt);
        }
        Dom.unwrap(virts).addListener(IAASImpl.this);
        return null;
      }
    });
  } else {
    Dom.unwrap(virtualizations).addListener(this);
  }
  if (virtualizations==null || env.isInstance() ) return;
  for (Virtualization virt : virtualizations.getVirtualizations()) {
    processVirtualization(virt);
  }
}

相关文章