Creates a worker and adds them to the pool.

@return Worker The worker created.
488903
private function createWorker()
    {
        $worker = $this->factory->create();
        $worker->start();

        $this->workers->attach($worker, 0);
        return $worker;
    }
355997
public function start() {
        if (!$this->isStarted) {
            $this->generateIpcServer();
            $this->isStarted = true;
            for ($i=0;$i<$this->poolSizeMin;$i++) {
                $this->spawnWorker();
            }
            $this->registerTaskTimeoutWatcher();
        }

        return $this;
    }
44655
void addWorker(final VortexWorkerManager vortexWorkerManager) {
    lock.lock();
    try {
      if (!terminated) {
        if (!removedBeforeAddedWorkers.contains(vortexWorkerManager.getId())) {
          this.runningWorkers.put(vortexWorkerManager.getId(), vortexWorkerManager);
          this.schedulingPolicy.workerAdded(vortexWorkerManager);
          this.workerAggregateFunctionMap.put(vortexWorkerManager.getId(), new HashSet<Integer>());

          // Notify (possibly) waiting scheduler
          noWorkerOrResource.signal();
        }
      } else {
        // Terminate the worker
        vortexWorkerManager.terminate();
      }
    } finally {
      lock.unlock();
    }
  }
1189445
@VisibleForTesting
  protected ExecutorService createExecutor() {
    return Executors.newSingleThreadExecutor(
        new ThreadFactoryBuilder()
          .setDaemon(true)
          .setNameFormat("Logger channel to " + addr)
          .setUncaughtExceptionHandler(
              UncaughtExceptionHandlers.systemExit())
          .build());
  }
54709
public function cleanup()
    {
        foreach ($this->workerList as $worker) {
            if (!$worker->isValid()) {
                $this->removeWorker($worker);
            }
        }

        return $this;
    }
998583
public static function create()
    {
        $dispatcher = new Dispatcher();
        foreach (static::$_stack as $middleware) {
            $dispatcher->addFilter($middleware);
        }

        return $dispatcher;
    }
525982
protected function registerWorker()
	{
		$this->registerWorkCommand();

		$this->registerRestartCommand();

		$this->app->singleton('queue.worker', function($app)
		{
			return new Worker($app['queue'], $app['queue.failer'], $app['events']);
		});
	}
1151754
def getworker():
        '''
        
        '''
        if not Configuration.worker_initialized:
            Configuration._initconf()
            Configuration.worker_settings = Configuration.settings['worker']
            Configuration.worker_initialized = True
        return Configuration.worker_settings
407872
public function addWorker($worker)
    {
        if (!$worker instanceof Worker) {
            throw new \Exception('$worker is not an instance of Worker');
        }
        $this->workerList[$worker->getId()] = $worker;

        return $this;
    }
1299858
def create_process_worker(self, cmd_list, environ=None):
        """"""
        worker = ProcessWorker(cmd_list, environ=environ)
        self._create_worker(worker)
        return worker
265917
protected function addResource()
    {
        try {
            ++$this->addingResources;
            $resource = $this->createResource();
            $resource->open();

            $hash = $resource->hashCode();
            $this->pool[$hash] = new PoolItem($resource);

            $this->push($resource);

            return $resource;
        } finally {
            --$this->addingResources;
        }
    }
1115077
public static function factory()
    {
        $self = new static();
        $self->downloader = new Plugins\Xml\Downloader();
        $self->writer     = new Plugins\Xml\Writer();
        
        $self->outputter  = new Plugins\NullObject();

        return $self;
    }
171926
public function make()
    {
        $guzzle = Client::makeGuzzle($this->endpoint);

        $client = new Client(new Config($this->key ?: ''), $this->resolver, $guzzle);

        if ($this->callbacks) {
            $client->registerDefaultCallbacks();
        }

        if ($this->tokens && $this->checker && $this->user) {
            $this->setupUserDetection($client, $this->tokens, $this->checker);
        }

        $this->setupPaths($client, $this->strip, $this->project, $this->root);

        $client->setReleaseStage($this->stage ?: ($this->env === 'prod' ? 'production' : $this->env));

        $client->setAppVersion($this->version);
        $client->setFallbackType('Console');
        $client->setAppType($this->type);

        $client->setBatchSending($this->batch);
        $client->setHostname($this->hostname);
        $client->setSendCode($this->code);

        $client->setNotifier(array_filter([
            'name' => 'Bugsnag Symfony',
            'version' => BugsnagBundle::VERSION,
            'url' => 'https://github.com/bugsnag/bugsnag-symfony',
        ]));

        if ($this->stages) {
            $client->setNotifyReleaseStages($this->stages);
        }

        if ($this->filters) {
            $client->setFilters($this->filters);
        }

        return $client;
    }
1049108
ThreadPoolExecutor createExecutor(final String threadPrefix, final int workerCount, int queueSize) {
		ThreadFactory threadFactory = new ThreadFactory() {
			private int counter = 0;
			@Override
			public Thread newThread(Runnable runnable) {
				return new Thread(runnable, threadPrefix + "-" + ++counter);
			}
		};
		ThreadPoolExecutor executor = new ThreadPoolExecutor(workerCount, workerCount,
				0, TimeUnit.SECONDS,
				new LinkedBlockingQueue<Runnable>(queueSize), threadFactory);
		return executor;
	}
960126
function createWorkerPool(options)
{
	var clientSet = new Set();
	var clientArr = [];
	var counter = 0;
	var logConnection = getOption(options, 'logConnection', true);
	
	function resetClients()
	{
		if ( logConnection )
		{
			console.log('CLIENTS ' + clientSet.size);
		}
		clientArr = [];
		if ( clientSet.size > 0 )
		{
			clientSet.forEach((client) => clientArr.push(client));
		}
	}
	
	function addClient(client)
	{
		clientSet.add(client);
		resetClients();
	}
	
	function deleteClient(client)
	{
		if ( clientSet.has(client) )
		{
			clientSet.delete(client);
			resetClients();
		}
	}
	
	function getNextClient()
	{
		var idx = counter++ % clientArr.length;
		return clientArr[idx];
	}
	
	function sendRequest(cmd, args, body, timeout, callback)
	{
		if ( clientArr.length === 0 )
		{
			callback({code: '500', tid: 0, args: ['no_workers'], body: null, isValid: true});
		}
		else
		{
			getNextClient().sendRequest(cmd, args, body, timeout, callback);
		}
	}
	
	function sendMessage(cmd, tid, args, body)
	{
		if ( clientArr.length > 0 )
		{
			getNextClient().sendMessage(cmd, tid, args, body);
		}
	}
	
	function createSession(protocol, session_args)
	{
		if ( clientArr.length > 0 )
		{
			return getNextClient().createSession(protocol, session_args);
		}
		else
		{
			throw new Error('There is no worker(s) for session creating');
		}
	}
	
	function getPoolSize()
	{
		return clientSet.size;
	}
	
	return {
		addClient: addClient,
		deleteClient: deleteClient,
		getNextClient: getNextClient,
		sendRequest: sendRequest,
		sendMessage: sendMessage,
		createSession: createSession,
		getPoolSize: getPoolSize
	};
}
1014927
def new_worker_pool(self, name: str, min_workers: int = 0, max_workers: int = 1,
                        max_seconds_idle: int = DEFAULT_WORKER_POOL_MAX_SECONDS_IDLE):
        
        if not self.running:
            return self.immediate_worker
        worker = self._new_worker_pool(name, min_workers, max_workers, max_seconds_idle)
        self._start_worker_pool(worker)
        return worker
189619
@CheckReturnValue
  public static Builder fromPool(Vertx vertx, Pool pool) {
    WorkerExecutor executor = vertx.createSharedWorkerExecutor("DbWorker-" + poolNameCounter.getAndAdd(1), pool.size);
    return new BuilderImpl(executor, () -> {
      try {
        executor.close();
      } catch (Exception e) {
        log.warn("Problem closing database worker executor", e);
      }
      if (pool.poolShutdown != null) {
        pool.poolShutdown.close();
      }
    }, () -> {
      try {
        return pool.dataSource.getConnection();
      } catch (Exception e) {
        throw new DatabaseException("Unable to obtain a connection from DriverManager", e);
      }
    }, new OptionsDefault(pool.flavor));
  }