Merged branch 'jetty-9.4.x' into 'master'.
This commit is contained in:
commit
f672b7e932
|
@ -28,6 +28,7 @@ import java.nio.channels.SelectionKey;
|
|||
import java.nio.channels.Selector;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -40,6 +41,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
import org.eclipse.jetty.util.component.DumpableCollection;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.thread.ExecutionStrategy;
|
||||
|
@ -226,29 +228,23 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String dump()
|
||||
{
|
||||
super.dump();
|
||||
return ContainerLifeCycle.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
super.dump(out, indent);
|
||||
Selector selector = _selector;
|
||||
if (selector == null || !selector.isOpen())
|
||||
dumpBeans(out, indent);
|
||||
else
|
||||
if (selector != null && selector.isOpen())
|
||||
{
|
||||
final ArrayList<Object> dump = new ArrayList<>(selector.keys().size() * 2);
|
||||
DumpKeys dumpKeys = new DumpKeys(dump);
|
||||
List<Runnable> actions;
|
||||
try (Locker.Lock lock = _locker.lock())
|
||||
{
|
||||
actions = new ArrayList<>(_actions);
|
||||
}
|
||||
List<Object> keys = new ArrayList<>(selector.keys().size());
|
||||
DumpKeys dumpKeys = new DumpKeys(keys);
|
||||
submit(dumpKeys);
|
||||
dumpKeys.await(5, TimeUnit.SECONDS);
|
||||
if (dump.isEmpty())
|
||||
dumpBeans(out, indent);
|
||||
else
|
||||
dumpBeans(out, indent, dump);
|
||||
dump(out, indent, Arrays.asList(new DumpableCollection("keys", keys), new DumpableCollection("actions", actions)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -512,7 +508,7 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
|
|||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
_dumps.add(String.format("SelectionKey@%x[%s]", key.hashCode(), x));
|
||||
_dumps.add(String.format("SelectionKey@%x[%s]->%s", key.hashCode(), x, key.attachment()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -561,7 +561,15 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
|
||||
public void blockingReadFillInterested()
|
||||
{
|
||||
getEndPoint().fillInterested(_blockingReadCallback);
|
||||
// We try fillInterested here because of SSL and
|
||||
// spurious wakeups. With blocking reads, we read in a loop
|
||||
// that tries to read/parse content and blocks waiting if there is
|
||||
// none available. The loop can be woken up by incoming encrypted
|
||||
// bytes, which due to SSL might not produce any decrypted bytes.
|
||||
// Thus the loop needs to register fill interest again. However if
|
||||
// the loop is woken up spuriously, then the register interest again
|
||||
// can result in a pending read exception, unless we use tryFillInterested.
|
||||
getEndPoint().tryFillInterested(_blockingReadCallback);
|
||||
}
|
||||
|
||||
public void blockingReadFailure(Throwable e)
|
||||
|
|
|
@ -660,13 +660,10 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
|||
int size = _beans.size();
|
||||
for (Collection<?> c : collections)
|
||||
size += c.size();
|
||||
if (size == 0)
|
||||
return;
|
||||
int i = 0;
|
||||
for (Bean b : _beans)
|
||||
{
|
||||
i++;
|
||||
|
||||
++i;
|
||||
switch(b._managed)
|
||||
{
|
||||
case POJO:
|
||||
|
@ -697,20 +694,15 @@ public class ContainerLifeCycle extends AbstractLifeCycle implements Container,
|
|||
else
|
||||
dumpObject(out, b._bean);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (i<size)
|
||||
out.append(indent).append(" |\n");
|
||||
|
||||
for (Collection<?> c : collections)
|
||||
{
|
||||
for (Object o : c)
|
||||
{
|
||||
i++;
|
||||
out.append(indent).append(" +> ");
|
||||
|
||||
if (o instanceof Dumpable)
|
||||
((Dumpable)o).dump(out, indent + (i == size ? " " : " | "));
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue