Package de.mhus.lib.MThread

Examples of de.mhus.lib.MThread.ThreadContainer


  }


  ThreadContainer start(MThread _task, String _name) {

    ThreadContainer tc = null;
    synchronized (pool) {
      if (housekeeper == null) {
        housekeeper = new ThreadHousekeeper();
        MSingleton.instance().getHousekeeper().register(housekeeper, SLEEP_TIME, true);
      }
      // search free thread

      for (int i = 0; i < pool.size(); i++)
        if (!pool.elementAt(i).isWorking()) {
          tc = pool.elementAt(i);
          break;
        }

      if (tc == null) {
        tc = new ThreadContainer(group, "AT" + pool.size());
        tc.start();
        pool.addElement(tc);
      }

      log.t("###: NEW THREAD",tc.getId());
      tc.setName(_name);
      tc.newWork(_task);
    }

    return tc;
  }
View Full Code Here

TOP

Related Classes of de.mhus.lib.MThread.ThreadContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.