类 WebAsyncTask<V>

    • 构造器详细资料

      • WebAsyncTask

        public WebAsyncTask​(Callable<V> callable)
        Create a WebAsyncTask wrapping the given Callable.
        参数:
        callable - the callable for concurrent handling
      • WebAsyncTask

        public WebAsyncTask​(long timeout,
                            Callable<V> callable)
        Create a WebAsyncTask with a timeout value and a Callable.
        参数:
        timeout - a timeout value in milliseconds
        callable - the callable for concurrent handling
      • WebAsyncTask

        public WebAsyncTask​(Long timeout,
                            String executorName,
                            Callable<V> callable)
        Create a WebAsyncTask with a timeout value, an executor name, and a Callable.
        参数:
        timeout - timeout value in milliseconds; ignored if null
        executorName - the name of an executor bean to use
        callable - the callable for concurrent handling
      • WebAsyncTask

        public WebAsyncTask​(Long timeout,
                            AsyncTaskExecutor executor,
                            Callable<V> callable)
        Create a WebAsyncTask with a timeout value, an executor instance, and a Callable.
        参数:
        timeout - timeout value in milliseconds; ignored if null
        executor - the executor to use
        callable - the callable for concurrent handling
    • 方法详细资料

      • getTimeout

        public Long getTimeout()
        Return the timeout value in milliseconds, or null if no timeout is set.
      • onTimeout

        public void onTimeout​(Callable<V> callback)
        Register code to invoke when the async request times out.

        This method is called from a container thread when an async request times out before the Callable has completed. The callback is executed in the same thread and therefore should return without blocking. It may return an alternative value to use, including an Exception or return RESULT_NONE.

      • onCompletion

        public void onCompletion​(Runnable callback)
        Register code to invoke when the async request completes.

        This method is called from a container thread when an async request completed for any reason, including timeout and network error.