Class AsynchronousDispatcher

    • Field Detail

      • executor

        protected java.util.concurrent.ExecutorService executor
      • threadPoolSize

        private int threadPoolSize
      • jobs

        private java.util.Map<java.lang.String,​java.util.concurrent.Future<MockHttpResponse>> jobs
      • basePath

        private java.lang.String basePath
      • maxWaitMilliSeconds

        private long maxWaitMilliSeconds
      • maxCacheSize

        private int maxCacheSize
    • 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​(java.lang.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​(java.util.concurrent.ExecutorService executor)
        Plug in your own executor to process requests
        Parameters:
        executor -
      • start

        public void start()
      • stop

        public void stop()
      • remove

        @Path("{job-id}")
        @DELETE
        public void remove​(@PathParam("job-id")
                           java.lang.String jobId)
      • readAndRemove

        @Path("{job-id}")
        @POST
        public javax.ws.rs.core.Response readAndRemove​(@QueryParam("wait") @DefaultValue("-1")
                                                       long wait,
                                                       @PathParam("job-id")
                                                       java.lang.String jobId)
      • get

        @Path("{job-id}")
        @GET
        public javax.ws.rs.core.Response get​(@QueryParam("wait") @DefaultValue("-1")
                                             long wait,
                                             @PathParam("job-id")
                                             java.lang.String jobId)
      • process

        protected javax.ws.rs.core.Response process​(long wait,
                                                    java.lang.String jobId,
                                                    boolean eatJob)
      • isAsynchrnousRequest

        public boolean isAsynchrnousRequest​(HttpRequest in)