368240: Fixed the start of dependent beans

This commit is contained in:
Greg Wilkins 2012-01-11 01:04:01 +11:00
parent 968a2ac95b
commit a7783ae568
5 changed files with 8 additions and 35 deletions

View File

@ -35,13 +35,14 @@ import org.eclipse.jetty.io.nio.SslConnection;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.component.AggregateLifeCycle;
import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.Timeout;
import org.eclipse.jetty.util.thread.Timeout.Task;
class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector, Dumpable
class SelectConnector extends AggregateLifeCycle implements HttpClient.Connector, Dumpable
{
private static final Logger LOG = Log.getLogger(SelectConnector.class);
@ -49,39 +50,15 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector,
private final Manager _selectorManager=new Manager();
private final Map<SocketChannel, Timeout.Task> _connectingChannels = new ConcurrentHashMap<SocketChannel, Timeout.Task>();
/* ------------------------------------------------------------ */
/**
* @param httpClient the HttpClient this connector is associated to
*/
SelectConnector(HttpClient httpClient)
{
_httpClient = httpClient;
}
/* ------------------------------------------------------------ */
@Override
protected void doStart() throws Exception
{
super.doStart();
_selectorManager.start();
}
/* ------------------------------------------------------------ */
@Override
protected void doStop() throws Exception
{
_selectorManager.stop();
}
public String dump()
{
return AggregateLifeCycle.dump(this);
}
public void dump(Appendable out, String indent) throws IOException
{
out.append(String.valueOf(this)).append("\n");
AggregateLifeCycle.dump(out, indent, Arrays.asList(_selectorManager));
addBean(_httpClient,false);
addBean(_selectorManager,true);
}
/* ------------------------------------------------------------ */

View File

@ -938,7 +938,6 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
final ArrayList<Object> dump = new ArrayList<Object>(selector.keys().size()*2);
dump.add(where);
/*
final CountDownLatch latch = new CountDownLatch(1);
addChange(new ChangeTask()
@ -958,7 +957,6 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
{
LOG.ignore(e);
}
*/
AggregateLifeCycle.dump(out,indent,dump);
}

View File

@ -55,7 +55,7 @@ public class ProxyRule extends PatternRule
private String _hostHeader;
private String _proxyTo;
private int _connectorType = 2;
private int _connectorType = HttpClient.CONNECTOR_SELECT_CHANNEL;
private String _maxThreads;
private String _maxConnections;
private String _timeout;

View File

@ -31,7 +31,6 @@ import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.util.log.Log;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@ -88,8 +87,7 @@ public class ProxyRuleTest
@Test
public void testProxy() throws Exception
{
Log.getLogger("org.eclipse.jetty.client").setDebugEnabled(true);
ContentExchange exchange = new ContentExchange(true);
exchange.setMethod(HttpMethods.GET);
String body = "BODY";

View File

@ -188,7 +188,7 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable
{
LifeCycle l=(LifeCycle)o;
if (joined && isRunning())
if (joined && isStarted())
{
try
{