示例#1
0
  public Dispatcher(List args) {
    log.info(toString() + " starting up...");

    Thread aliveThread =
        new Thread("alive thread") {
          public final void run() {
            try {
              synchronized (this) {
                wait();
              }
            } catch (InterruptedException e) {
              /* игнорируется. */
            }
          }
        };
    Map<String, Object> tmp = new HashMap<String, Object>();
    tmp.put("runthr", aliveThread);
    oman.loadObject(DispatcherHandler5.class.getName(), tmp);

    cman.setCommandLineArguments(args);
    if (getConfigurationManager().supportComponentListing()) {
      List resources = getConfigurationManager().getResourceList();
      List objects = getConfigurationManager().getObjectList();
      Iterator it = resources.iterator();
      while (it.hasNext()) {
        ConfigurationManager.ComponentConfiguration element =
            (ConfigurationManager.ComponentConfiguration) it.next();
        int mult = -1;
        if (element.getConfiguration() != null && element.getConfiguration().containsKey("mult")) {
          mult = new Integer((String) (element.getConfiguration().get("mult"))).intValue();
        }
        rman.loadResource(element.getClassName(), mult, element.getConfiguration());
      }
      it = objects.iterator();
      while (it.hasNext()) {
        ConfigurationManager.ComponentConfiguration element =
            (ConfigurationManager.ComponentConfiguration) it.next();
        oman.loadObject(element.getClassName(), element.getConfiguration());
      }

      oman.loadPending();

      aliveThread.start();
      try {
        aliveThread.join();
      } catch (InterruptedException e) {
        /* игнорируется. */
      }
    } else {
      log.severe("Default configuration manager does not support component listing. Bailing out.");
    }
  }
示例#2
0
 /** @see org.valabs.odisp.common.Dispatcher#send(org.valabs.odisp.common.Message) */
 public void send(Message message) {
   oman.send(message);
 }