private void startAsyncProcessing(Object[] processingContext) { synchronized (WebAsyncManager.this) { this.concurrentResult = RESULT_NONE; this.concurrentResultContext = processingContext; } this.asyncWebRequest.startAsync(); if (logger.isDebugEnabled()) { logger.debug("Started async request"); } }
private void startAsyncProcessing(Object[] processingContext) { synchronized (WebAsyncManager.this) { this.concurrentResult = RESULT_NONE; this.concurrentResultContext = processingContext; } this.asyncWebRequest.startAsync(); if (logger.isDebugEnabled()) { logger.debug("Started async request"); } }
@Test(expected = IllegalArgumentException.class) public void setAsyncWebRequestAfterAsyncStarted() { this.asyncWebRequest.startAsync(); this.asyncManager.setAsyncWebRequest(null); }
@SuppressWarnings("unchecked") @Test public void responseBodyEmitterWithErrorValue() throws Exception { AsyncWebRequest asyncWebRequest = mock(AsyncWebRequest.class); WebAsyncUtils.getAsyncManager(this.request).setAsyncWebRequest(asyncWebRequest); ResponseBodyEmitter emitter = new ResponseBodyEmitter(19000L); emitter.onError(mock(Consumer.class)); emitter.onCompletion(mock(Runnable.class)); MethodParameter type = on(TestController.class).resolveReturnType(ResponseBodyEmitter.class); this.handler.handleReturnValue(emitter, type, this.mavContainer, this.webRequest); verify(asyncWebRequest).addErrorHandler(any(Consumer.class)); verify(asyncWebRequest, times(2)).addCompletionHandler(any(Runnable.class)); verify(asyncWebRequest).startAsync(); }
@Test public void responseBodyEmitterWithTimeoutValue() throws Exception { AsyncWebRequest asyncWebRequest = mock(AsyncWebRequest.class); WebAsyncUtils.getAsyncManager(this.request).setAsyncWebRequest(asyncWebRequest); ResponseBodyEmitter emitter = new ResponseBodyEmitter(19000L); emitter.onTimeout(mock(Runnable.class)); emitter.onCompletion(mock(Runnable.class)); MethodParameter type = on(TestController.class).resolveReturnType(ResponseBodyEmitter.class); this.handler.handleReturnValue(emitter, type, this.mavContainer, this.webRequest); verify(asyncWebRequest).setTimeout(19000L); verify(asyncWebRequest).addTimeoutHandler(any(Runnable.class)); verify(asyncWebRequest, times(2)).addCompletionHandler(any(Runnable.class)); verify(asyncWebRequest).startAsync(); }
@SuppressWarnings("unchecked") private void verifyDefaultAsyncScenario() { verify(this.asyncWebRequest).addTimeoutHandler(notNull()); verify(this.asyncWebRequest).addErrorHandler(notNull()); verify(this.asyncWebRequest).addCompletionHandler(notNull()); verify(this.asyncWebRequest).startAsync(); verify(this.asyncWebRequest).dispatch(); }
@SuppressWarnings("unchecked") @Test public void startCallableProcessingWithAsyncTask() throws Exception { AsyncTaskExecutor executor = mock(AsyncTaskExecutor.class); given(this.asyncWebRequest.getNativeRequest(HttpServletRequest.class)).willReturn(this.servletRequest); WebAsyncTask<Object> asyncTask = new WebAsyncTask<>(1000L, executor, mock(Callable.class)); this.asyncManager.startCallableProcessing(asyncTask); verify(executor).submit((Runnable) notNull()); verify(this.asyncWebRequest).setTimeout(1000L); verify(this.asyncWebRequest).addTimeoutHandler(any(Runnable.class)); verify(this.asyncWebRequest).addErrorHandler(any(Consumer.class)); verify(this.asyncWebRequest).addCompletionHandler(any(Runnable.class)); verify(this.asyncWebRequest).startAsync(); }
verify(asyncWebRequest).addTimeoutHandler(any(Runnable.class)); verify(asyncWebRequest, times(2)).addCompletionHandler(any(Runnable.class)); verify(asyncWebRequest).startAsync();
private void startAsyncProcessing(Object[] processingContext) { synchronized (WebAsyncManager.this) { this.concurrentResult = RESULT_NONE; this.concurrentResultContext = processingContext; } this.asyncWebRequest.startAsync(); if (logger.isDebugEnabled()) { logger.debug("Started async request"); } }
private void startAsyncProcessing(Object[] processingContext) { synchronized (WebAsyncManager.this) { this.concurrentResult = RESULT_NONE; this.concurrentResultContext = processingContext; } this.asyncWebRequest.startAsync(); if (logger.isDebugEnabled()) { HttpServletRequest request = this.asyncWebRequest.getNativeRequest(HttpServletRequest.class); if (request != null) { String requestUri = urlPathHelper.getRequestUri(request); logger.debug("Concurrent handling starting for " + request.getMethod() + " [" + requestUri + "]"); } } }