Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright 2012, Inc. or its affiliates. All Rights Reserved.
  * Licensed under the Apache License, Version 2.0 (the "License").
  * You may not use this file except in compliance with the License.
  * A copy of the License is located at
 * or in the "license" file accompanying this file. This file is distributed
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.

Used to bridge asynchronous execution to external asynchronous APIs or events. ExternalTask#doExecute(handle ) method is expected to initiate call to an external API and return without blocking. Then completion or failure of the external task is reported through ExternalTaskCompletionHandle. A cancellation handler returned by the doExecute is used to report cancellation of the external task.
public abstract class ExternalTask extends AsyncContextAware {
    private final ExternalTaskContext context;
    public ExternalTask(Promise<?>... waitFor) {
         = new ExternalTaskContext(thisnullwaitFor);
    public ExternalTask(boolean daemon, Promise<?>... waitFor) {
         = new ExternalTaskContext(thisdaemonwaitFor);
    public ExternalTask(AsyncContextAware parent, Promise<?>... waitFor) {
         = new ExternalTaskContext(parent.getContext(), thisnullwaitFor);
    public ExternalTask(AsyncContextAware parentboolean daemon, Promise<?>... waitFor) {
         = new ExternalTaskContext(parent.getContext(), thisdaemonwaitFor);
    public String getName() {
        return .getName();
    public void setName(String name) {
    public StackTraceElement[] getStackTrace() {
        return .getStackTrace().getStackTrace();
        return ;
New to GrepCode? Check out our FAQ X