Ejemplo n.º 1
0
/*     */     private void handleEvent(Event paramEvent)
/*     */     {
/* 266 */       ExchangeImpl localExchangeImpl = paramEvent.exchange;
/* 267 */       HttpConnection localHttpConnection = localExchangeImpl.getConnection();
/*     */       try {
/* 269 */         if ((paramEvent instanceof WriteFinishedEvent))
/*     */         {
/* 271 */           int i = ServerImpl.this.endExchange();
/* 272 */           if ((ServerImpl.this.terminating) && (i == 0)) {
/* 273 */             ServerImpl.this.finished = true;
/*     */           }
/* 275 */           ServerImpl.this.responseCompleted(localHttpConnection);
/* 276 */           LeftOverInputStream localLeftOverInputStream = localExchangeImpl.getOriginalInputStream();
/* 277 */           if (!localLeftOverInputStream.isEOF()) {
/* 278 */             localExchangeImpl.close = true;
/*     */           }
/* 280 */           if ((localExchangeImpl.close) || (ServerImpl.this.idleConnections.size() >= ServerImpl.MAX_IDLE_CONNECTIONS)) {
/* 281 */             localHttpConnection.close();
/* 282 */             ServerImpl.this.allConnections.remove(localHttpConnection);
/*     */           }
/* 284 */           else if (localLeftOverInputStream.isDataBuffered())
/*     */           {
/* 286 */             ServerImpl.this.requestStarted(localHttpConnection);
/* 287 */             handle(localHttpConnection.getChannel(), localHttpConnection);
/*     */           } else {
/* 289 */             this.connsToRegister.add(localHttpConnection);
/*     */           }
/*     */         }
/*     */       }
/*     */       catch (IOException localIOException) {
/* 294 */         ServerImpl.this.logger.log(Level.FINER, "Dispatcher (1)", localIOException);
/*     */ 
/* 297 */         localHttpConnection.close();
/*     */       }
/*     */     }
Ejemplo n.º 2
0
  public void close() {
    if (closed) {
      return;
    }
    closed = true;

    /* close the underlying connection if,
     * a) the streams not set up yet, no response can be sent, or
     * b) if the wrapper output stream is not set up, or
     * c) if the close of the input/outpu stream fails
     */
    try {
      if (uis_orig == null || uos == null) {
        connection.close();
        return;
      }
      if (!uos_orig.isWrapped()) {
        connection.close();
        return;
      }
      if (!uis_orig.isClosed()) {
        uis_orig.close();
      }
      uos.close();
    } catch (IOException e) {
      connection.close();
    }
  }
 public void close() throws IOException {
   if (closed) {
     return;
   }
   closed = true;
   flush();
   LeftOverInputStream is = t.getOriginalInputStream();
   if (!is.isClosed()) {
     try {
       is.close();
     } catch (IOException e) {
     }
   }
   WriteFinishedEvent e = new WriteFinishedEvent(t);
   t.getHttpContext().getServerImpl().addEvent(e);
 }