Search in sources :

Example 1 with ContainerLifeCycle

use of org.eclipse.jetty.util.component.ContainerLifeCycle in project dropwizard by dropwizard.

the class LifecycleEnvironmentTest method managesLifeCycleObjects.

@Test
public void managesLifeCycleObjects() throws Exception {
    final LifeCycle lifeCycle = mock(LifeCycle.class);
    environment.manage(lifeCycle);
    final ContainerLifeCycle container = new ContainerLifeCycle();
    environment.attach(container);
    assertThat(container.getBeans()).contains(lifeCycle);
}
Also used : LifeCycle(org.eclipse.jetty.util.component.LifeCycle) ContainerLifeCycle(org.eclipse.jetty.util.component.ContainerLifeCycle) ContainerLifeCycle(org.eclipse.jetty.util.component.ContainerLifeCycle) Test(org.junit.Test)

Example 2 with ContainerLifeCycle

use of org.eclipse.jetty.util.component.ContainerLifeCycle in project jetty.project by eclipse.

the class ALPNClientConnectionFactory method newConnection.

@Override
public Connection newConnection(EndPoint endPoint, Map<String, Object> context) throws IOException {
    SSLEngine sslEngine = (SSLEngine) context.get(SslClientConnectionFactory.SSL_ENGINE_CONTEXT_KEY);
    getALPNProcessor().configure(sslEngine, protocols);
    ContainerLifeCycle connector = (ContainerLifeCycle) context.get(ClientConnectionFactory.CONNECTOR_CONTEXT_KEY);
    // Method addBean() has set semantic, so the listener is added only once.
    connector.addBean(alpnListener);
    ALPNClientConnection connection = new ALPNClientConnection(endPoint, executor, getClientConnectionFactory(), sslEngine, context, protocols);
    return customize(connection, context);
}
Also used : SSLEngine(javax.net.ssl.SSLEngine) ContainerLifeCycle(org.eclipse.jetty.util.component.ContainerLifeCycle)

Example 3 with ContainerLifeCycle

use of org.eclipse.jetty.util.component.ContainerLifeCycle in project jetty.project by eclipse.

the class SslConnectionFactory method configure.

@Override
protected AbstractConnection configure(AbstractConnection connection, Connector connector, EndPoint endPoint) {
    if (connection instanceof SslConnection) {
        SslConnection sslConnection = (SslConnection) connection;
        if (connector instanceof ContainerLifeCycle) {
            ContainerLifeCycle container = (ContainerLifeCycle) connector;
            container.getBeans(SslHandshakeListener.class).forEach(sslConnection::addHandshakeListener);
        }
        getBeans(SslHandshakeListener.class).forEach(sslConnection::addHandshakeListener);
    }
    return super.configure(connection, connector, endPoint);
}
Also used : SslConnection(org.eclipse.jetty.io.ssl.SslConnection) SslHandshakeListener(org.eclipse.jetty.io.ssl.SslHandshakeListener) ContainerLifeCycle(org.eclipse.jetty.util.component.ContainerLifeCycle)

Example 4 with ContainerLifeCycle

use of org.eclipse.jetty.util.component.ContainerLifeCycle in project jetty.project by eclipse.

the class MBeanContainerLifeCycleTest method prepare.

@Before
public void prepare() throws Exception {
    container = new ContainerLifeCycle();
    mbeanServer = ManagementFactory.getPlatformMBeanServer();
    MBeanContainer mbeanContainer = new MBeanContainer(mbeanServer);
    container.addBean(mbeanContainer);
    container.start();
}
Also used : ContainerLifeCycle(org.eclipse.jetty.util.component.ContainerLifeCycle) Before(org.junit.Before)

Example 5 with ContainerLifeCycle

use of org.eclipse.jetty.util.component.ContainerLifeCycle in project jetty.project by eclipse.

the class MBeanContainerTest method setBeanAdded.

private void setBeanAdded() {
    managed = new Managed();
    Container container = new ContainerLifeCycle();
    mbeanContainer.beanAdded(container, managed);
    mbeanServer = mbeanContainer.getMBeanServer();
}
Also used : Container(org.eclipse.jetty.util.component.Container) ContainerLifeCycle(org.eclipse.jetty.util.component.ContainerLifeCycle) Managed(com.acme.Managed)

Aggregations

ContainerLifeCycle (org.eclipse.jetty.util.component.ContainerLifeCycle)12 Test (org.junit.Test)2 Managed (com.acme.Managed)1 ConnectorFactory (io.dropwizard.jetty.ConnectorFactory)1 HttpConnectorFactory (io.dropwizard.jetty.HttpConnectorFactory)1 JettyManaged (io.dropwizard.lifecycle.JettyManaged)1 Managed (io.dropwizard.lifecycle.Managed)1 ArrayList (java.util.ArrayList)1 SSLEngine (javax.net.ssl.SSLEngine)1 SslConnection (org.eclipse.jetty.io.ssl.SslConnection)1 SslHandshakeListener (org.eclipse.jetty.io.ssl.SslHandshakeListener)1 Connector (org.eclipse.jetty.server.Connector)1 Container (org.eclipse.jetty.util.component.Container)1 LifeCycle (org.eclipse.jetty.util.component.LifeCycle)1 QueuedThreadPool (org.eclipse.jetty.util.thread.QueuedThreadPool)1 WebSocketContainerScope (org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope)1 Before (org.junit.Before)1