Include an int-specialized named task in to the benchmark.

@param name
The name of the task. Only one task with any one name is
allowed.
@param task
The task to perform
@return The same object, for chaining calls.
354585
public UBench addIntTask(String name, IntSupplier task) {
        return addIntTask(name, task, null);
    }
439015
public void registerTask(Task task) throws IOException {
		final ResultPartition[] producedPartitions = task.getProducedPartitions();

		synchronized (lock) {
			if (isShutdown) {
				throw new IllegalStateException("NetworkEnvironment is shut down");
			}

			for (final ResultPartition partition : producedPartitions) {
				setupPartition(partition);
			}

			// Setup the buffer pool for each buffer reader
			final SingleInputGate[] inputGates = task.getAllInputGates();
			for (SingleInputGate gate : inputGates) {
				setupInputGate(gate);
			}
		}
	}
391736
def build_task(self, name):
        

        try:
            self._gettask(name).value = (
                self._gettask(name).task.resolve_and_build())
        except TaskExecutionException as e:
            perror(e.header, indent="+0")
            perror(e.message, indent="+4")
            self._gettask(name).value = e.payload
        except Exception as e:
            perror("error evaluating target '%s' %s" %
                   (name, type(self._gettask(name).task)))
            perror(traceback.format_exc(e), indent='+4')
            self._gettask(name).value = None

        self._gettask(name).last_build_time = time.time()
418064
public void register(Task task) {
        Optional.ofNullable(task)
                .filter(t -> t.getTask() != null)
                .filter(t -> StringUtils.hasText(t.getName()))
                .ifPresent(t -> checkTaskMap.put(t.getName(), t));
    }
120004
public <T> T execute(Task<T> task) {
        synchronized(task) {
            task.reset();
            // add it to the tail
            taskList.add(task);

            // invoke the execution
            lock.activate();

            // wait for the completion
            try {
            	while (!task.isDone()) {
            		task.wait();
            	}
            } catch (InterruptedException e) {
                task.exception = e; // we got interrupted, so task.result will be invalid! 
            }

            if(task.exception!=null) {
                Throwable e = task.exception;
                task.exception = null;
                throw new ExecutionException(e);
            } else {
                T r = task.result;
                task.result = null;
                return r;
            }
        }
    }
963373
public boolean add(final Task task) throws EntryExistsException
  {
    if (taskStorage.getTask(task.getId()).isPresent()) {
      throw new EntryExistsException(StringUtils.format("Task %s is already exists", task.getId()));
    }

    giant.lock();

    try {
      Preconditions.checkState(active, "Queue is not active!");
      Preconditions.checkNotNull(task, "task");
      Preconditions.checkState(tasks.size() < config.getMaxSize(), "Too many tasks (max = %,d)", config.getMaxSize());

      // If this throws with any sort of exception, including TaskExistsException, we don't want to
      // insert the task into our queue. So don't catch it.
      taskStorage.insert(task, TaskStatus.running(task.getId()));
      addTaskInternal(task);
      managementMayBeNecessary.signalAll();
      return true;
    }
    finally {
      giant.unlock();
    }
  }
519688
public ItemRequest<Task> addDependents(String task) {
    
        String path = String.format("/tasks/%s/addDependents", task);
        return new ItemRequest<Task>(this, Task.class, path, "POST");
    }
1138946
public CollectionRequest<Attachment> findByTask(String task) {
    
        String path = String.format("/tasks/%s/attachments", task);
        return new CollectionRequest<Attachment>(this, Attachment.class, path, "GET");
    }
345600
public ItemRequest<Task> addSubtask(String task) {
    
        String path = String.format("/tasks/%s/subtasks", task);
        return new ItemRequest<Task>(this, Task.class, path, "POST");
    }
8797
public void runTask(Handler<Task> task) {
    if (currentTask == null) {
      currentTask = new Task(this);
      task.handle(currentTask);
    } else {
      queue.add(task);
    }
  }
620237
public ItemRequest<Task> removeDependents(String task) {
    
        String path = String.format("/tasks/%s/removeDependents", task);
        return new ItemRequest<Task>(this, Task.class, path, "POST");
    }
1311850
public ISarlEnumerationBuilder addSarlEnumeration(String name) {
		ISarlEnumerationBuilder builder = this.iSarlEnumerationBuilderProvider.get();
		builder.eInit(getSarlAgent(), name, getTypeResolutionContext());
		return builder;
	}
555338
public Long createAndExecuteTask(String taskName, String data, String key1, String key2) {
		return tedDriverImpl.createAndExecuteTask(taskName, data, key1, key2, false);
	}
518612
public <V> Callable<V,IOException> asCallableWith(final FileCallable<V> task) {
        return new CallableWith<>(task);
    }
279270
def insert_tasks_ignore_duplicate_names(tasks, queue, *args, **kwargs):
    

    from google.appengine.api import taskqueue

    try:
        inserted = _insert_tasks(tasks, queue, *args, **kwargs)

        return inserted
    except taskqueue.DuplicateTaskNameError:
        # At least one task failed in our batch, attempt to re-insert the
        # remaining tasks.  Named tasks can never be transactional.
        reinsert = _tasks_to_reinsert(tasks, transactional=False)

        count = len(reinsert)
        inserted = len(tasks) - count

        # Our subsequent task inserts should raise TaskAlreadyExistsError at
        # least once, but that will be swallowed by _insert_tasks.
        for task in reinsert:
            inserted += _insert_tasks([task], queue, *args, **kwargs)

        return inserted
482618
@Route(method = HttpMethod.GET, uri = "/async/hello/{name}")
    public Result heavyComputation(@Parameter("name") final String name) {
        return async(new Callable<Result>() {
            @Override
            public Result call() throws Exception {
                System.out.println(System.currentTimeMillis() + " - Heavy computation executed from " + Thread
                        .currentThread().getName());
                Thread.sleep(10000);
                System.out.println(System.currentTimeMillis() + " -  Heavy computation done " + Thread.currentThread
                        ().getName());
                return ok("Hello " + name);
            }
        });
    }
349618
protected <T> Callable<T> wrapTask(Callable<T> task) {
    // Preserve the MDC context of the caller thread.
    Map contextMap = MDC.getCopyOfContextMap();
    if (contextMap != null) {
      return new MDCCallableAdapter(task, contextMap);
    }
    return task;
  }