@Path(value="/") public class AsynchronousDispatcher extends SynchronousDispatcher
Modifier and Type | Class and Description |
---|---|
private static class |
AsynchronousDispatcher.Cache |
private static class |
AsynchronousDispatcher.SecureRandomWrapper |
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
basePath |
private AsynchronousDispatcher.Cache |
cache |
private AsynchronousDispatcher.SecureRandomWrapper |
counter |
protected java.util.concurrent.ExecutorService |
executor |
private java.util.Map<java.lang.String,java.util.concurrent.Future<MockHttpResponse>> |
jobs |
private int |
maxCacheSize |
private long |
maxWaitMilliSeconds |
private int |
threadPoolSize |
bufferExceptionEntity, bufferExceptionEntityRead, defaultContextObjects, providerFactory, registry, requestPreprocessors, unwrappedExceptions
Constructor and Description |
---|
AsynchronousDispatcher(ResteasyProviderFactory providerFactory) |
AsynchronousDispatcher(ResteasyProviderFactory providerFactory,
ResourceMethodRegistry registry) |
Modifier and Type | Method and Description |
---|---|
javax.ws.rs.core.Response |
get(long wait,
java.lang.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 javax.ws.rs.core.Response |
process(long wait,
java.lang.String jobId,
boolean eatJob) |
javax.ws.rs.core.Response |
readAndRemove(long wait,
java.lang.String jobId) |
void |
remove(java.lang.String jobId) |
void |
setBasePath(java.lang.String basePath)
Set the base path to find jobs
|
void |
setExecutor(java.util.concurrent.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() |
addHttpPreprocessor, asynchronousDelivery, asynchronousExceptionDelivery, clearContextData, execute, getDefaultContextObjects, getInvoker, getProviderFactory, getRegistry, getUnwrappedExceptions, internalInvocation, invoke, invokePropagateNotFound, preprocess, preprocess, pushContextObjects, writeException, writeResponse
protected java.util.concurrent.ExecutorService executor
private int threadPoolSize
private java.util.Map<java.lang.String,java.util.concurrent.Future<MockHttpResponse>> jobs
private AsynchronousDispatcher.Cache cache
private java.lang.String basePath
private AsynchronousDispatcher.SecureRandomWrapper counter
private long maxWaitMilliSeconds
private int maxCacheSize
public AsynchronousDispatcher(ResteasyProviderFactory providerFactory)
public AsynchronousDispatcher(ResteasyProviderFactory providerFactory, ResourceMethodRegistry registry)
public void setMaxCacheSize(int maxCacheSize)
maxCacheSize
- public void setMaxWaitMilliSeconds(long maxWaitMilliSeconds)
maxWaitMilliSeconds
- public void setBasePath(java.lang.String basePath)
basePath
- public void setThreadPoolSize(int threadPoolSize)
threadPoolSize
- public void setExecutor(java.util.concurrent.ExecutorService executor)
executor
- public void start()
public void stop()
@Path(value="{job-id}") @DELETE public void remove(@PathParam(value="job-id") java.lang.String jobId)
@Path(value="{job-id}") @POST public javax.ws.rs.core.Response readAndRemove(@QueryParam(value="wait") @DefaultValue(value="-1") long wait, @PathParam(value="job-id") java.lang.String jobId)
@Path(value="{job-id}") @GET public javax.ws.rs.core.Response get(@QueryParam(value="wait") @DefaultValue(value="-1") long wait, @PathParam(value="job-id") java.lang.String jobId)
protected javax.ws.rs.core.Response process(long wait, java.lang.String jobId, boolean eatJob)
public boolean isAsynchrnousRequest(HttpRequest in)
public void invokeSuper(HttpRequest in, HttpResponse response, ResourceInvoker invoker)
public void invoke(HttpRequest in, HttpResponse response, ResourceInvoker invoker)
SynchronousDispatcher
invoke
in class SynchronousDispatcher
public void postJob(HttpRequest request, HttpResponse response, ResourceInvoker invoker)
public void oneway(HttpRequest request, HttpResponse response, ResourceInvoker invoker)