diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusher.java b/jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusher.java index b9884a871b3..7b7d1d44fc0 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusher.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusher.java @@ -21,6 +21,7 @@ import java.util.EnumSet; import java.util.Set; import java.util.concurrent.atomic.AtomicReference; +import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -104,7 +105,7 @@ abstract public class WriteFlusher throw new IllegalStateException(); boolean updated = _state.compareAndSet(previous, next); - LOG.debug("State update {} -> {} succeeded: {}", previous, next, updated); + LOG.debug("update {}:{}{}{}", this, previous, updated?"-->":"!->",next); return updated; } @@ -139,7 +140,7 @@ abstract public class WriteFlusher Set allowedNewStateTypes = __stateTransitions.get(currentState.getType()); if (!allowedNewStateTypes.contains(newState.getType())) { - LOG.debug("StateType update: {} -> {} not allowed", currentState, newState); + LOG.warn("{}: {} -> {} not allowed", this, currentState, newState); return false; } return true; @@ -280,9 +281,11 @@ abstract public class WriteFlusher */ public void write(C context, Callback callback, ByteBuffer... buffers) throws WritePendingException { + if (LOG.isDebugEnabled()) + LOG.debug("write: {} {}", this, BufferUtil.toDetailString(buffers)); + if (callback == null) throw new IllegalArgumentException(); - LOG.debug("write: {}", this); if (!updateState(__IDLE,__WRITING)) throw new WritePendingException(); @@ -330,6 +333,8 @@ abstract public class WriteFlusher */ public void completeWrite() { + LOG.debug("completeWrite: {}", this); + State previous = _state.get(); if (previous.getType()!=StateType.PENDING) diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java b/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java index 06372af2d05..32f78226b92 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java @@ -143,6 +143,7 @@ public class SslConnection extends AbstractConnection _decryptedEndPoint.getWriteFlusher().completeWrite(); } + LOG.debug("{} onFilled", this); } /* ------------------------------------------------------------ */ @@ -383,8 +384,8 @@ public class SslConnection extends AbstractConnection // case we want to fall through to the handshake handling int pos = BufferUtil.flipToFill(app_in); SSLEngineResult unwrapResult = _sslEngine.unwrap(_encryptedInput, app_in); - LOG.debug("{} unwrap {}", SslConnection.this, unwrapResult); BufferUtil.flipToFlush(app_in, pos); + LOG.debug("{} unwrap {}", SslConnection.this, unwrapResult); // and deal with the results switch (unwrapResult.getStatus()) diff --git a/jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/AbstractTest.java b/jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/AbstractTest.java index 3c348701639..8822d1391f0 100644 --- a/jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/AbstractTest.java +++ b/jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/AbstractTest.java @@ -57,6 +57,7 @@ public abstract class AbstractTest protected InetSocketAddress startServer(short version, ServerSessionFrameListener listener) throws Exception { server = new Server(); + ((QueuedThreadPool)server.getThreadPool()).setName("server"); if (connector == null) connector = newSPDYServerConnector(listener); if (listener == null) diff --git a/jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/SSLEngineLeakTest.java b/jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/SSLEngineLeakTest.java index 16a1bda8df2..bfc31edd6b5 100644 --- a/jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/SSLEngineLeakTest.java +++ b/jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/SSLEngineLeakTest.java @@ -18,9 +18,13 @@ import java.util.Map; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; +import org.eclipse.jetty.io.SelectChannelEndPoint; +import org.eclipse.jetty.io.WriteFlusher; +import org.eclipse.jetty.io.ssl.SslConnection; import org.eclipse.jetty.npn.NextProtoNego; import org.eclipse.jetty.spdy.api.Session; import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener; +import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java b/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java index 06efee292c2..b031b27e10b 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java @@ -702,6 +702,19 @@ public class BufferUtil return buf.toString(); } + public static String toDetailString(ByteBuffer[] buffer) + { + StringBuilder builder = new StringBuilder(); + builder.append('['); + for (int i=0;i0) builder.append(','); + builder.append(toDetailString(buffer[i])); + } + builder.append(']'); + return builder.toString(); + } + public static String toDetailString(ByteBuffer buffer) { if (buffer==null) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java index 70d0e9ac44f..bf6ba0bd3a7 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java @@ -460,7 +460,7 @@ public class StdErrLog extends AbstractLogger buffer.append(_abbrevname); } buffer.append(':'); - buffer.append(Thread.currentThread().getId()).append(": "); + buffer.append(Thread.currentThread().getName()).append(": "); if (_source) { Throwable source = new Throwable();