Code cleanup.

This commit is contained in:
Simone Bordet 2016-09-21 18:42:19 +02:00
parent a9ef53b6d0
commit 1f92ba2112
1 changed files with 87 additions and 88 deletions

View File

@ -75,7 +75,6 @@ public class AsyncIOServletTest
{
private Server server;
private ServerConnector connector;
private ServletContextHandler context;
private String path = "/path";
private static final ThreadLocal<Throwable> scope = new ThreadLocal<>();
@ -83,6 +82,7 @@ public class AsyncIOServletTest
{
startServer(servlet, 30000);
}
public void startServer(HttpServlet servlet, long idleTimeout) throws Exception
{
server = new Server();
@ -91,7 +91,7 @@ public class AsyncIOServletTest
connector.getConnectionFactory(HttpConnectionFactory.class).getHttpConfiguration().setDelayDispatchUntilContent(false);
server.addConnector(connector);
context = new ServletContextHandler(server, "/", false, false);
ServletContextHandler context = new ServletContextHandler(server, "/", false, false);
ServletHolder holder = new ServletHolder(servlet);
holder.setAsyncSupported(true);
context.addServlet(holder, path);
@ -109,6 +109,7 @@ public class AsyncIOServletTest
}
scope.set(new Throwable());
}
@Override
public void exitScope(Context context, Request request)
{
@ -217,7 +218,6 @@ public class AsyncIOServletTest
{
line = in.readLine();
}
line=in.readLine();
assertTrue(latch.await(5, TimeUnit.SECONDS));
}
@ -307,7 +307,7 @@ public class AsyncIOServletTest
return;
}
final AsyncContext asyncContext = request.startAsync(request, response);
request.startAsync(request, response);
request.getInputStream().setReadListener(new ReadListener()
{
@Override
@ -328,7 +328,10 @@ public class AsyncIOServletTest
{
assertScope();
errors.incrementAndGet();
throw new NullPointerException("explicitly_thrown_by_test_2"){{this.initCause(t);}};
throw new NullPointerException("explicitly_thrown_by_test_2")
{{
this.initCause(t);
}};
}
});
}
@ -524,8 +527,8 @@ public class AsyncIOServletTest
in.setReadListener(new ReadListener()
{
transient int _i = 0;
transient boolean _minusOne=false;;
transient boolean _finished=false;;
transient boolean _minusOne = false;
transient boolean _finished = false;
@Override
public void onError(Throwable t)
@ -714,10 +717,7 @@ public class AsyncIOServletTest
public void onDataAvailable() throws IOException
{
assertScope();
async.start(
new Runnable()
{
public void run()
async.start(() ->
{
assertScope();
try
@ -736,7 +736,6 @@ public class AsyncIOServletTest
{
e.printStackTrace();
}
}
});
}