/** * Constructs a new DistThreadPool. * * @param strategy for job processing. * @param size of the pool. * @param mfile machine file. */ public DistThreadPool(StrategyEnumeration strategy, int size, String mfile) { this.strategy = strategy; if (size < 0) { this.threads = 0; } else { this.threads = size; } if (mfile == null || mfile.length() == 0) { this.mfile = DEFAULT_MFILE; } else { this.mfile = mfile; } jobstack = new LinkedList<Runnable>(); // ok for all strategies ? try { ec = new ExecutableChannels(this.mfile); } catch (FileNotFoundException e) { e.printStackTrace(); throw new IllegalArgumentException("DistThreadPool " + e); } if (debug) { logger.debug("ExecutableChannels = " + ec); } try { ec.open(threads); } catch (IOException e) { e.printStackTrace(); throw new IllegalArgumentException("DistThreadPool " + e); } if (debug) { logger.debug("ExecutableChannels = " + ec); } workers = new DistPoolThread[0]; }