Merge branch 'master' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project
This commit is contained in:
commit
f569b4b542
|
@ -144,7 +144,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements SelectorMa
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG.debug("Local interests update conflict: now {}, was {}, attempted {}", _interestOps.get(), oldInterestOps, newInterestOps);
|
LOG.debug("Local interests update conflict: now {}, was {}, attempted {} for {}", _interestOps.get(), oldInterestOps, newInterestOps, this);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,6 @@ import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import org.eclipse.jetty.util.ForkInvoker;
|
|
||||||
import org.eclipse.jetty.util.TypeUtil;
|
import org.eclipse.jetty.util.TypeUtil;
|
||||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||||
|
@ -303,7 +302,6 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
||||||
*/
|
*/
|
||||||
public class ManagedSelector extends AbstractLifeCycle implements Runnable, Dumpable
|
public class ManagedSelector extends AbstractLifeCycle implements Runnable, Dumpable
|
||||||
{
|
{
|
||||||
private final ForkInvoker<Runnable> invoker = new ManagedSelectorInvoker();
|
|
||||||
private final Queue<Runnable> _changes = new ConcurrentLinkedQueue<>();
|
private final Queue<Runnable> _changes = new ConcurrentLinkedQueue<>();
|
||||||
private final int _id;
|
private final int _id;
|
||||||
private Selector _selector;
|
private Selector _selector;
|
||||||
|
@ -335,16 +333,18 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Submits a change to be executed in the selector thread.</p>
|
* <p>Submits a change to be executed in the selector thread.</p>
|
||||||
* <p>Changes may be submitted from any thread, and if they are submitted from a thread different
|
* <p>Changes may be submitted from any thread, and the selector thread woken up
|
||||||
* from the selector thread, they are queued for execution, and the selector thread woken up
|
|
||||||
* (if necessary) to execute the change.</p>
|
* (if necessary) to execute the change.</p>
|
||||||
*
|
*
|
||||||
* @param change the change to submit
|
* @param change the change to submit
|
||||||
* @return true if the change has been executed, false if it has been queued for later execution
|
|
||||||
*/
|
*/
|
||||||
public boolean submit(Runnable change)
|
public void submit(Runnable change)
|
||||||
{
|
{
|
||||||
return !invoker.invoke(change);
|
_changes.offer(change);
|
||||||
|
LOG.debug("Queued change {}", change);
|
||||||
|
boolean wakeup = _needsWakeup;
|
||||||
|
if (wakeup)
|
||||||
|
wakeup();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runChanges()
|
private void runChanges()
|
||||||
|
@ -534,8 +534,6 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
||||||
|
|
||||||
public void destroyEndPoint(EndPoint endPoint)
|
public void destroyEndPoint(EndPoint endPoint)
|
||||||
{
|
{
|
||||||
// TODO
|
|
||||||
|
|
||||||
LOG.debug("Destroyed {}", endPoint);
|
LOG.debug("Destroyed {}", endPoint);
|
||||||
Connection connection = endPoint.getConnection();
|
Connection connection = endPoint.getConnection();
|
||||||
if (connection != null)
|
if (connection != null)
|
||||||
|
@ -606,38 +604,6 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
||||||
selector != null && selector.isOpen() ? selector.selectedKeys().size() : -1);
|
selector != null && selector.isOpen() ? selector.selectedKeys().size() : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ManagedSelectorInvoker extends ForkInvoker<Runnable>
|
|
||||||
{
|
|
||||||
private ManagedSelectorInvoker()
|
|
||||||
{
|
|
||||||
super(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean condition()
|
|
||||||
{
|
|
||||||
return Thread.currentThread() != _thread;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fork(Runnable change)
|
|
||||||
{
|
|
||||||
_changes.offer(change);
|
|
||||||
LOG.debug("Queued change {}", change);
|
|
||||||
boolean wakeup = _needsWakeup;
|
|
||||||
if (wakeup)
|
|
||||||
wakeup();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void call(Runnable change)
|
|
||||||
{
|
|
||||||
LOG.debug("Submitted change {}", change);
|
|
||||||
runChanges();
|
|
||||||
runChange(change);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class DumpKeys implements Runnable
|
private class DumpKeys implements Runnable
|
||||||
{
|
{
|
||||||
private final CountDownLatch latch = new CountDownLatch(1);
|
private final CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
|
Loading…
Reference in New Issue