Skip to content

Commit

Permalink
Revert "Issue #1970 - ManagedSelector dump improvements."
Browse files Browse the repository at this point in the history
This reverts commit 4febaf1.
  • Loading branch information
gregw committed Jan 2, 2018
1 parent 4febaf1 commit f8bc8a6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
18 changes: 11 additions & 7 deletions jetty-io/src/main/java/org/eclipse/jetty/io/ManagedSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.List;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Exchanger;
import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -246,28 +247,31 @@ private int getActionSize()
@Override
public void dump(Appendable out, String indent) throws IOException
{
super.dump(out,indent);

Selector selector = _selector;
List<String> keys = null;
List<Runnable> actions = null;
if (selector != null && selector.isOpen())
{
DumpKeys dump = new DumpKeys();
String actionsAt;
List<Runnable> actions;
try (Locker.Lock lock = _locker.lock())
{
actionsAt = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(ZonedDateTime.now());
actions = new ArrayList<>(_actions);
_actions.addFirst(dump);
_selecting = false;
}
selector.wakeup();
List<String> keys = dump.get(5, TimeUnit.SECONDS);
_selector.wakeup();
keys = dump.get(5, TimeUnit.SECONDS);
String keysAt = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(ZonedDateTime.now());
if (keys==null)
keys = Collections.singletonList("No dump keys retrieved");
dump(out, indent, Arrays.asList(new DumpableCollection("actions @ "+actionsAt, actions),
new DumpableCollection("keys @ "+keysAt, keys)));
dumpBeans(out, indent, Arrays.asList(new DumpableCollection("actions@"+actionsAt, actions),
new DumpableCollection("keys@"+keysAt, keys) ));
}
else
{
super.dump(out,indent);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@
package org.eclipse.jetty.util.component;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;

import org.eclipse.jetty.util.component.ContainerLifeCycle;
import org.eclipse.jetty.util.component.Dumpable;

public class DumpableCollection implements Dumpable
{
private final String _name;
Expand All @@ -41,7 +45,7 @@ public String dump()
@Override
public void dump(Appendable out, String indent) throws IOException
{
out.append(_name).append(System.lineSeparator());
out.append(_name).append("\n");
if (_collection!=null)
ContainerLifeCycle.dump(out,indent,_collection);
}
Expand Down

0 comments on commit f8bc8a6

Please sign in to comment.