]> WPIA git - gigi.git/blobdiff - lib/jetty/org/eclipse/jetty/server/LocalConnector.java
updating jetty to jetty-9.2.16.v2016040
[gigi.git] / lib / jetty / org / eclipse / jetty / server / LocalConnector.java
index 5796226362e7183a763879cffed30f05fd1caf1f..b41891c5fbdd0a2eb7dd2b712bd859b86260977d 100644 (file)
@@ -1,6 +1,6 @@
 //
 //  ========================================================================
-//  Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
+//  Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
 //  ------------------------------------------------------------------------
 //  All rights reserved. This program and the accompanying materials
 //  are made available under the terms of the Eclipse Public License v1.0
@@ -133,12 +133,15 @@ public class LocalConnector extends AbstractConnector
      */
     public ByteBuffer getResponses(ByteBuffer requestsBuffer,long idleFor,TimeUnit units) throws Exception
     {
-        LOG.debug("requests {}", BufferUtil.toUTF8String(requestsBuffer));
+        if (LOG.isDebugEnabled())
+            LOG.debug("requests {}", BufferUtil.toUTF8String(requestsBuffer));
         LocalEndPoint endp = executeRequest(requestsBuffer);
         endp.waitUntilClosedOrIdleFor(idleFor,units);
         ByteBuffer responses = endp.takeOutput();
-        endp.getConnection().close();
-        LOG.debug("responses {}", BufferUtil.toUTF8String(responses));
+        if (endp.isOutputShutdown())
+            endp.close();
+        if (LOG.isDebugEnabled())
+            LOG.debug("responses {}", BufferUtil.toUTF8String(responses));
         return responses;
     }
 
@@ -155,6 +158,8 @@ public class LocalConnector extends AbstractConnector
 
     private LocalEndPoint executeRequest(ByteBuffer rawRequest)
     {
+        if (!isStarted())
+            throw new IllegalStateException("!STARTED");
         LocalEndPoint endp = new LocalEndPoint();
         endp.setInput(rawRequest);
         _connects.add(endp);
@@ -164,7 +169,8 @@ public class LocalConnector extends AbstractConnector
     @Override
     protected void accept(int acceptorID) throws IOException, InterruptedException
     {
-        LOG.debug("accepting {}", acceptorID);
+        if (LOG.isDebugEnabled())
+            LOG.debug("accepting {}", acceptorID);
         LocalEndPoint endPoint = _connects.take();
         endPoint.onOpen();
         onEndPointOpened(endPoint);
@@ -249,7 +255,8 @@ public class LocalConnector extends AbstractConnector
                     {
                         if (size==getOutput().remaining())
                         {
-                            LOG.debug("idle for {} {}",idleFor,units);
+                            if (LOG.isDebugEnabled())
+                                LOG.debug("idle for {} {}",idleFor,units);
                             return;
                         }
                         size=getOutput().remaining();