org.jboss.resteasy.core

## Class AsynchronousDispatcher

- java.lang.Object
- - org.jboss.resteasy.core.SynchronousDispatcher
  - - org.jboss.resteasy.core.AsynchronousDispatcher

- All Implemented Interfaces:
    Dispatcher

      @Path(value="/")
      public class AsynchronousDispatcher
      extends SynchronousDispatcher

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ExecutorService` | `executor`

    - ### Fields inherited from class org.jboss.resteasy.core.SynchronousDispatcher

      `defaultContextObjects, providerFactory, registry, requestPreprocessors, unwrappedExceptions`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AsynchronousDispatcher(ResteasyProviderFactory providerFactory)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Response` | `get(long wait, String jobId)`
    `void` | `invoke(HttpRequest in, HttpResponse response, ResourceInvoker invoker)` Invoke and write response
    `void` | `invokeSuper(HttpRequest in, HttpResponse response, ResourceInvoker invoker)`
    `boolean` | `isAsynchrnousRequest(HttpRequest in)`
    `void` | `oneway(HttpRequest request, HttpResponse response, ResourceInvoker invoker)`
    `void` | `postJob(HttpRequest request, HttpResponse response, ResourceInvoker invoker)`
    `protected Response` | `process(long wait, String jobId, boolean eatJob)`
    `Response` | `readAndRemove(long wait, String jobId)`
    `void` | `remove(String jobId)`
    `void` | `setBasePath(String basePath)` Set the base path to find jobs
    `void` | `setExecutor(ExecutorService executor)` Plug in your own executor to process requests
    `void` | `setMaxCacheSize(int maxCacheSize)` Max response cache size default is 100
    `void` | `setMaxWaitMilliSeconds(long maxWaitMilliSeconds)` Maximum wait time.
    `void` | `setThreadPoolSize(int threadPoolSize)` Fixed thread pool size of asynchronous delivery
    `void` | `start()`
    `void` | `stop()`

    - ### Methods inherited from class org.jboss.resteasy.core.SynchronousDispatcher

      `addHttpPreprocessor, asynchronousDelivery, asynchronousExceptionDelivery, clearContextData, execute, getDefaultContextObjects, getInvoker, getProviderFactory, getRegistry, getUnwrappedExceptions, internalInvocation, invoke, invokePropagateNotFound, preprocess, preprocess, pushContextObjects, writeException, writeResponse`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### executor

          protected ExecutorService executor

  - ### Constructor Detail

    - #### AsynchronousDispatcher

          public AsynchronousDispatcher(ResteasyProviderFactory providerFactory)

  - ### Method Detail

    - #### setMaxCacheSize

          public void setMaxCacheSize(int maxCacheSize)

      Max response cache size default is 100
      Parameters:
        `maxCacheSize` -

    - #### setMaxWaitMilliSeconds

          public void setMaxWaitMilliSeconds(long maxWaitMilliSeconds)

      Maximum wait time. This overrides any wait query parameter
      Parameters:
        `maxWaitMilliSeconds` -

    - #### setBasePath

          public void setBasePath(String basePath)

      Set the base path to find jobs
      Parameters:
        `basePath` -

    - #### setThreadPoolSize

          public void setThreadPoolSize(int threadPoolSize)

      Fixed thread pool size of asynchronous delivery
      Parameters:
        `threadPoolSize` -

    - #### setExecutor

          public void setExecutor(ExecutorService executor)

      Plug in your own executor to process requests
      Parameters:
        `executor` -

    - #### start

          public void start()

    - #### stop

          public void stop()

    - #### remove

          @Path(value="{job-id}")
          @DELETE
          public void remove(@PathParam(value="job-id")
                                     String jobId)

    - #### readAndRemove

          @Path(value="{job-id}")
          @POST
          public Response readAndRemove(@QueryParam(value="wait")@DefaultValue(value="-1")
                                              long wait,
                                              @PathParam(value="job-id")
                                              String jobId)

    - #### get

          @Path(value="{job-id}")
          @GET
          public Response get(@QueryParam(value="wait")@DefaultValue(value="-1")
                                   long wait,
                                   @PathParam(value="job-id")
                                   String jobId)

    - #### process

          protected Response process(long wait,
                         String jobId,
                         boolean eatJob)

    - #### isAsynchrnousRequest

          public boolean isAsynchrnousRequest(HttpRequest in)

    - #### invokeSuper

          public void invokeSuper(HttpRequest in,
                         HttpResponse response,
                         ResourceInvoker invoker)

    - #### invoke

          public void invoke(HttpRequest in,
                    HttpResponse response,
                    ResourceInvoker invoker)

      Description copied from class: `SynchronousDispatcher`
      Invoke and write response
      Overrides:
        `invoke` in class `SynchronousDispatcher`

    - #### postJob

          public void postJob(HttpRequest request,
                     HttpResponse response,
                     ResourceInvoker invoker)

    - #### oneway

          public void oneway(HttpRequest request,
                    HttpResponse response,
                    ResourceInvoker invoker)

Copyright © 2014. All Rights Reserved.