460210 - ExecutionStragegy producer for SelectManager calls onOpen from produce method

onClose also a Product task
This commit is contained in:
Greg Wilkins 2015-02-19 13:35:58 +11:00
parent 28d2172ea7
commit 363d04174d
2 changed files with 31 additions and 23 deletions

View File

@ -408,15 +408,21 @@ public class ManagedSelector extends AbstractLifeCycle implements Runnable, Dump
return endPoint;
}
public void destroyEndPoint(EndPoint endPoint)
public void destroyEndPoint(final EndPoint endPoint)
{
// TODO: perhaps this code should be wrapped and submitted as a task.
if (LOG.isDebugEnabled())
LOG.debug("Destroyed {}", endPoint);
Connection connection = endPoint.getConnection();
if (connection != null)
_selectorManager.connectionClosed(connection);
_selectorManager.endPointClosed(endPoint);
final Connection connection = endPoint.getConnection();
submit(new Product()
{
@Override
public void run()
{
if (LOG.isDebugEnabled())
LOG.debug("Destroyed {}", endPoint);
if (connection != null)
_selectorManager.connectionClosed(connection);
_selectorManager.endPointClosed(endPoint);
}
});
}
@Override

View File

@ -1,18 +1,20 @@
/* ------------------------------------------------------------ */
/** Spin Lock
* <p>This is a lock designed to protect VERY short sections of
* critical code. Threads attempting to take the lock will spin
* forever until the lock is available, thus it is important that
* the code protected by this lock is extremely simple and non
* blocking. The reason for this lock is that it prevents a thread
* from giving up a CPU core when contending for the lock.</p>
* <pre>
* try(SpinLock.Lock lock = spinlock.lock())
* {
* // something very quick and non blocking
* }
* </pre>
*/
//
// ========================================================================
// Copyright (c) 1995-2015 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
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.util.thread;