Skip to content

Commit

Permalink
Issue #4376 Async Content Complete
Browse files Browse the repository at this point in the history
Reformat

Signed-off-by: Greg Wilkins <gregw@webtide.com>
  • Loading branch information
gregw committed Dec 2, 2019
1 parent abb7e3b commit 36cc246
Showing 1 changed file with 8 additions and 7 deletions.
Expand Up @@ -96,15 +96,14 @@ public void proceed()
_delay.get(10, TimeUnit.SECONDS);
getCallback().succeeded();
}
catch(Throwable th)
catch (Throwable th)
{
th.printStackTrace();
getCallback().failed(th);
}
}
}


@BeforeEach
public void init() throws Exception
{
Expand Down Expand Up @@ -160,7 +159,7 @@ public ExtendedHttpConnection(HttpConfiguration config, Connector connector, End
@Override
public void onCompleted()
{
COMPLETE.compareAndSet(false,true);
COMPLETE.compareAndSet(false, true);
super.onCompleted();
}
}
Expand All @@ -170,7 +169,7 @@ public static Stream<Arguments> tests()
{
List<Object[]> tests = new ArrayList<>();
tests.add(new Object[]{new HelloWorldHandler(), 200, "Hello world"});
tests.add(new Object[]{new SendErrorHandler(499,"Test async sendError"), 499, "Test async sendError"});
tests.add(new Object[]{new SendErrorHandler(499, "Test async sendError"), 499, "Test async sendError"});
tests.add(new Object[]{new AsyncReadyCompleteHandler(), 200, AsyncReadyCompleteHandler.data});
return tests.stream().map(Arguments::of);
}
Expand Down Expand Up @@ -205,7 +204,7 @@ public void testAsyncCompletion(Handler handler, int status, String message) thr

// wait for threads to return to base level
long end = System.nanoTime() + TimeUnit.SECONDS.toNanos(10);
while(_threadPool.getBusyThreads() != base)
while (_threadPool.getBusyThreads() != base)
{
if (System.nanoTime() > end)
throw new TimeoutException();
Expand All @@ -218,7 +217,7 @@ public void testAsyncCompletion(Handler handler, int status, String message) thr
// proceed with the completion
delay.proceed();

while(!COMPLETE.get())
while (!COMPLETE.get())
{
if (System.nanoTime() > end)
throw new TimeoutException();
Expand All @@ -236,8 +235,10 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques
{
AsyncContext context = request.startAsync();
ServletOutputStream out = response.getOutputStream();
out.setWriteListener(new WriteListener() {
out.setWriteListener(new WriteListener()
{
byte[] bytes = data.getBytes(StandardCharsets.ISO_8859_1);

@Override
public void onWritePossible() throws IOException
{
Expand Down

0 comments on commit 36cc246

Please sign in to comment.