use of org.apache.catalina.Service in project tomee by apache.
the class OpenEJBListener method tryToFindAndExtractWar.
private static File tryToFindAndExtractWar(final StandardServer source) {
if (System.getProperties().containsKey("openejb.war")) {
return new File(System.getProperty("openejb.war"));
}
for (final Service service : source.findServices()) {
final Container container = service.getContainer();
if (container instanceof StandardEngine) {
final StandardEngine engine = (StandardEngine) container;
for (final Container child : engine.findChildren()) {
if (child instanceof StandardHost) {
final StandardHost host = (StandardHost) child;
final File base = hostDir(System.getProperty("catalina.base"), host.getAppBase());
final File[] files = base.listFiles();
if (files != null) {
for (final File file : files) {
if (isTomEEWar(file)) {
return file;
}
}
}
}
}
}
}
return null;
}
use of org.apache.catalina.Service in project spring-boot by spring-projects.
the class TomcatServletWebServerFactoryTests method tomcatAdditionalConnectors.
@Test
void tomcatAdditionalConnectors() {
TomcatServletWebServerFactory factory = getFactory();
Connector[] connectors = new Connector[4];
Arrays.setAll(connectors, (i) -> new Connector());
factory.addAdditionalTomcatConnectors(connectors);
this.webServer = factory.getWebServer();
Map<Service, Connector[]> connectorsByService = ((TomcatWebServer) this.webServer).getServiceConnectors();
assertThat(connectorsByService.values().iterator().next()).hasSize(connectors.length + 1);
}
use of org.apache.catalina.Service in project spring-boot by spring-projects.
the class TomcatReactiveWebServerFactoryTests method tomcatAdditionalConnectors.
@Test
void tomcatAdditionalConnectors() {
TomcatReactiveWebServerFactory factory = getFactory();
Connector[] connectors = new Connector[4];
Arrays.setAll(connectors, (i) -> new Connector());
factory.addAdditionalTomcatConnectors(connectors);
this.webServer = factory.getWebServer(mock(HttpHandler.class));
Map<Service, Connector[]> connectorsByService = ((TomcatWebServer) this.webServer).getServiceConnectors();
assertThat(connectorsByService.values().iterator().next()).hasSize(connectors.length + 1);
}
use of org.apache.catalina.Service in project tomcat by apache.
the class StandardServer method stopInternal.
/**
* Stop nested components ({@link Service}s) and implement the requirements
* of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that needs to be reported
*/
@Override
protected void stopInternal() throws LifecycleException {
setState(LifecycleState.STOPPING);
if (monitorFuture != null) {
monitorFuture.cancel(true);
monitorFuture = null;
}
if (periodicLifecycleEventFuture != null) {
periodicLifecycleEventFuture.cancel(false);
periodicLifecycleEventFuture = null;
}
fireLifecycleEvent(CONFIGURE_STOP_EVENT, null);
// Stop our defined Services
for (Service service : services) {
service.stop();
}
globalNamingResources.stop();
stopAwait();
}
use of org.apache.catalina.Service in project tomcat by apache.
the class StandardServer method initInternal.
/**
* Invoke a pre-startup initialization. This is used to allow connectors
* to bind to restricted ports under Unix operating environments.
*/
@Override
protected void initInternal() throws LifecycleException {
super.initInternal();
// Initialize utility executor
reconfigureUtilityExecutor(getUtilityThreadsInternal(utilityThreads));
register(utilityExecutor, "type=UtilityExecutor");
// Register global String cache
// Note although the cache is global, if there are multiple Servers
// present in the JVM (may happen when embedding) then the same cache
// will be registered under multiple names
onameStringCache = register(new StringCache(), "type=StringCache");
// Register the MBeanFactory
MBeanFactory factory = new MBeanFactory();
factory.setContainer(this);
onameMBeanFactory = register(factory, "type=MBeanFactory");
// Register the naming resources
globalNamingResources.init();
// Initialize our defined Services
for (Service service : services) {
service.init();
}
}
Aggregations