I have the following code that gives my portal the images that are in the database
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String id = req.getParameter("id");
if(id.equals("logo")){
resp.setContentType(museu.getConfiguracao().getContentTypeLogo());
resp.getOutputStream().write(museu.getConfiguracao().getLogo());
}else if(req.getParameter("slide")!=null){
resp.setContentType(banco.getSlide(id).getContentType());
resp.getOutputStream().write(banco.getSlide(id).getContent());
}
else{
Foto foto = museu.getFoto(Long.parseLong(id));
resp.setContentType(foto.getContentType());
resp.getOutputStream().write(foto.getContent());
}
}
The problem, when I try to request 3/4 or more images for a single page, the application server (Glassfish) simply "hangs" and after a time looses the error, the images are usually loaded a bit (some 10%, another 50%) but simply the server "hangs" out of nowhere. Headers of Errors in log:
2014-03-21T08:58:20.561-0300|Grave: java.io.IOException: java.util.concurrent.TimeoutException
at org.glassfish.grizzly.utils.Exceptions.makeIOException(Exceptions.java:81)
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(FutureTask.java:201)
at org.glassfish.grizzly.http.io.OutputBuffer.blockAfterWriteIfNeeded(OutputBuffer.java:951)
... 36 more
2014-03-21T08:58:20.567-0300|Advertência: StandardWrapperValve[MultiMidiaServlet]: Servlet.service() for servlet MultiMidiaServlet threw exception
java.io.IOException: java.util.concurrent.TimeoutException
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(FutureTask.java:201)
at org.glassfish.grizzly.http.io.OutputBuffer.blockAfterWriteIfNeeded(OutputBuffer.java:951)
... 36 more