use of org.eclipse.jetty.util.component.ContainerLifeCycle in project blade by biezhi.
the class SslClientConnectionFactory method customize.
@Override
public Connection customize(Connection connection, Map<String, Object> context) {
if (connection instanceof SslConnection) {
SslConnection sslConnection = (SslConnection) connection;
sslConnection.setRenegotiationAllowed(sslContextFactory.isRenegotiationAllowed());
ContainerLifeCycle connector = (ContainerLifeCycle) context.get(ClientConnectionFactory.CONNECTOR_CONTEXT_KEY);
connector.getBeans(SslHandshakeListener.class).forEach(sslConnection::addHandshakeListener);
}
return ClientConnectionFactory.super.customize(connection, context);
}
use of org.eclipse.jetty.util.component.ContainerLifeCycle in project blade by biezhi.
the class ClientConnectionFactory method customize.
public default default Connection customize(Connection connection, Map<String, Object> context) {
ContainerLifeCycle connector = (ContainerLifeCycle) context.get(CONNECTOR_CONTEXT_KEY);
connector.getBeans(Connection.Listener.class).forEach(connection::addListener);
return connection;
}
use of org.eclipse.jetty.util.component.ContainerLifeCycle in project dropwizard by dropwizard.
the class DefaultServerFactory method buildAdminConnectors.
private List<Connector> buildAdminConnectors(MetricRegistry metricRegistry, Server server) {
// threadpool is shared between all the connectors, so it should be managed by the server instead of the
// individual connectors
final QueuedThreadPool threadPool = new QueuedThreadPool(adminMaxThreads, adminMinThreads);
threadPool.setName("dw-admin");
server.addBean(threadPool);
final List<Connector> connectors = new ArrayList<>();
for (ConnectorFactory factory : adminConnectors) {
final Connector connector = factory.build(server, metricRegistry, "admin", threadPool);
if (connector instanceof ContainerLifeCycle) {
((ContainerLifeCycle) connector).unmanage(threadPool);
}
connectors.add(connector);
}
return connectors;
}
use of org.eclipse.jetty.util.component.ContainerLifeCycle in project dropwizard by dropwizard.
the class LifecycleEnvironmentTest method managesManagedObjects.
@Test
public void managesManagedObjects() throws Exception {
final Managed managed = mock(Managed.class);
environment.manage(managed);
final ContainerLifeCycle container = new ContainerLifeCycle();
environment.attach(container);
final Object bean = ImmutableList.copyOf(container.getBeans()).get(0);
assertThat(bean).isInstanceOf(JettyManaged.class);
final JettyManaged jettyManaged = (JettyManaged) bean;
assertThat(jettyManaged.getManaged()).isEqualTo(managed);
}
use of org.eclipse.jetty.util.component.ContainerLifeCycle in project jetty.project by eclipse.
the class ClientConnectionFactory method customize.
public default default Connection customize(Connection connection, Map<String, Object> context) {
ContainerLifeCycle connector = (ContainerLifeCycle) context.get(CONNECTOR_CONTEXT_KEY);
connector.getBeans(Connection.Listener.class).forEach(connection::addListener);
return connection;
}
Aggregations