Exemple #1
0
 @Override
 protected void runInContext() {
   HttpContext context = new BasicHttpContext(null);
   try {
     while (!Thread.interrupted() && _conn.isOpen()) {
       _httpService.handleRequest(_conn, context);
       _conn.close();
     }
   } catch (ConnectionClosedException ex) {
     if (s_logger.isTraceEnabled()) {
       s_logger.trace("ApiServer:  Client closed connection");
     }
   } catch (IOException ex) {
     if (s_logger.isTraceEnabled()) {
       s_logger.trace("ApiServer:  IOException - " + ex);
     }
   } catch (HttpException ex) {
     s_logger.warn("ApiServer:  Unrecoverable HTTP protocol violation" + ex);
   } finally {
     try {
       _conn.shutdown();
     } catch (IOException ignore) {
     }
   }
 }
 @Override
 public void run() {
   logger.fine("New Connection Thread");
   HttpContext context = new BasicHttpContext();
   try {
     while (!Thread.interrupted() && connection.isOpen()) {
       httpService.handleRequest(connection, context);
     }
   } catch (ConnectionClosedException e) {
     logger.warning("Connection closed: " + e.getMessage());
   } catch (IOException e) {
     logger.warning("I/O error: " + e.getMessage());
   } catch (HttpException e) {
     logger.warning("Unrecoverable HTTP protocol violation: " + e.getMessage());
   } finally {
     try {
       connection.shutdown();
     } catch (IOException e) {
       logger.warning("Failed to shut down connection: " + e.getMessage());
     }
   }
 }