Exemplo n.º 1
0
 /**
  * Get a new {@link RingoWorker}.
  *
  * @return a worker instance.
  */
 public RingoWorker getWorker() {
   RingoWorker worker = workers.pollFirst();
   if (worker == null) {
     worker = new RingoWorker(this);
   }
   return worker;
 }
Exemplo n.º 2
0
 /**
  * Return a worker, returning it to the worker pool.
  *
  * @param worker the worker to be released
  */
 void returnWorker(RingoWorker worker) {
   if (!workers.offerFirst(worker)) {
     worker.shutdown();
   }
 }