org.apache.catalina.connector.Connector.getService()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中org.apache.catalina.connector.Connector.getService()方法的一些代码示例,展示了Connector.getService()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connector.getService()方法的具体详情如下:
包路径:org.apache.catalina.connector.Connector
类名称:Connector
方法名:getService

Connector.getService介绍

[英]Return the Service with which we are associated (if any).
[中]返回与我们关联的Service(如果有)。

代码示例

代码示例来源:origin: line/armeria

static TomcatService forConfig(TomcatServiceConfig config) {
  final Consumer<Connector> postStopTask = connector -> {
    final org.apache.catalina.Server server = connector.getService().getServer();
    if (server.getState() == LifecycleState.STOPPED) {
      try {
        logger.info("Destroying an embedded Tomcat: {}", toString(server));
        server.destroy();
      } catch (Exception e) {
        logger.warn("Failed to destroy an embedded Tomcat: {}", toString(server), e);
      }
    }
  };
  return new ManagedTomcatService(null, new ManagedConnectorFactory(config), postStopTask);
}

代码示例来源:origin: line/armeria

void start() throws Exception {
  assert hostName() != null;
  started = false;
  connector = connectorFactory.apply(hostName());
  final Service service = connector.getService();
  final Engine engine = TomcatUtil.engine(service, hostName());
  final String engineName = engine.getName();
  if (activeEngines.contains(engineName)) {
    throw new TomcatServiceException("duplicate engine name: " + engineName);
  }
  server = service.getServer();
  if (!TOMCAT_START_STATES.contains(server.getState())) {
    logger.info("Starting an embedded Tomcat: {}", toString(server));
    server.start();
    started = true;
  } else {
    throw new TomcatServiceException("Cannot manage already running server: " + engineName);
  }
  activeEngines.add(engineName);
  this.engineName = engineName;
}

代码示例来源:origin: line/armeria

@Override
public Connector apply(String hostname) {
  // Create the connector with our protocol handler. Tomcat will call ProtocolHandler.setAdapter()
  // on its startup with the Coyote Adapter which gives an access to Tomcat's HTTP service pipeline.
  final Class<?> protocolType = TomcatService.PROTOCOL_HANDLER_CLASS;
  final Connector connector = new Connector(protocolType.getName());
  // We do not really open a port - just trying to stop the Connector from complaining.
  connector.setPort(0);
  final StandardServer server = newServer(hostname, connector, config);
  // Retrieve the components configured by newServer(), so we can use it in checkConfiguration().
  final Service service = server.findServices()[0];
  final Engine engine = TomcatUtil.engine(service, hostname);
  final StandardHost host = (StandardHost) engine.findChildren()[0];
  final Context context = (Context) host.findChildren()[0];
  // Apply custom configurators set via TomcatServiceBuilder.configurator()
  try {
    config.configurators().forEach(c -> c.accept(server));
  } catch (Throwable t) {
    throw new TomcatServiceException("failed to configure an embedded Tomcat", t);
  }
  // Make sure the configurators did not ruin what we have configured in this method.
  checkConfiguration(server, service, connector, engine, host, context);
  assert connector.getService().getServer() != null;
  return connector;
}

代码示例来源:origin: org.glassfish.main.web/web-core

public void init() throws Exception {
  if( this.getService() != null ) {
    if (log.isLoggable(Level.FINE)) {
      log.log(Level.FINE, "Already configured");
    }
    return;
  }
}

代码示例来源:origin: org.glassfish.main.web/web-core

public void destroy() throws Exception {
  if( oname!=null && controller==oname ) {
    if (log.isLoggable(Level.FINE)) {
      log.log(Level.FINE, "Unregister itself " + oname );
    }
  }
  if( getService() == null)
    return;
  getService().removeConnector(this);
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

@Override
protected String getDomainInternal() {
  Service s = getService();
  if (s == null) {
    return null;
  } else {
    return service.getDomain();
  }
}

代码示例来源:origin: tomcat/catalina

public void init() throws Exception {
  if( this.getService() != null ) {
    if(log.isDebugEnabled())
       log.debug( "Already configured" );
    return;
  }
  if( container==null ) {
    findContainer();
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

@Override
protected String getDomainInternal() {
  Service s = getService();
  if (s == null) {
    return null;
  } else {
    return service.getDomain();
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

@Override
protected String getDomainInternal() {
  Service s = getService();
  if (s == null) {
    return null;
  } else {
    return service.getDomain();
  }
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

@Override
protected String getDomainInternal() {
  return MBeanUtils.getDomain(getService());
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

@Override
protected String getDomainInternal() {
  return MBeanUtils.getDomain(getService());
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

@Override
protected String getDomainInternal() {
  return MBeanUtils.getDomain(getService());
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

@Override
protected String getDomainInternal() {
  return MBeanUtils.getDomain(getService());
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

@Override
protected String getDomainInternal() {
  return MBeanUtils.getDomain(getService());
}

代码示例来源:origin: tomcat/catalina

public void destroy() throws Exception {
  if( oname!=null && controller==oname ) {
    if(log.isDebugEnabled())
       log.debug("Unregister itself " + oname );
    Registry.getRegistry(null, null).unregisterComponent(oname);
  }
  if( getService() == null)
    return;
  getService().removeConnector(this);
}

代码示例来源:origin: org.jboss.web/jbossweb

public void destroy() throws Exception {
  if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
    if( oname!=null && controller==oname ) {
      Registry.getRegistry(null, null).unregisterComponent(oname);
    }
  }
  if( getService() == null)
    return;
  getService().removeConnector(this);
}

代码示例来源:origin: jboss.web/jbossweb

public void init() throws Exception {
  if( this.getService() != null ) {
    if(log.isDebugEnabled())
       log.debug( "Already configured" );
    return;
  }
  if( container==null ) {
    findContainer();
  }
}

代码示例来源:origin: jboss.web/jbossweb

public void destroy() throws Exception {
  if( oname!=null && controller==oname ) {
    if(log.isDebugEnabled())
       log.debug("Unregister itself " + oname );
    Registry.getRegistry(null, null).unregisterComponent(oname);
  }
  if( getService() == null)
    return;
  getService().removeConnector(this);
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

@Override
protected void destroyInternal() throws LifecycleException {
  try {
    if (protocolHandler != null) {
      protocolHandler.destroy();
    }
  } catch (Exception e) {
    throw new LifecycleException(
        sm.getString("coyoteConnector.protocolHandlerDestroyFailed"), e);
  }
  if (getService() != null) {
    getService().removeConnector(this);
  }
  super.destroyInternal();
}

代码示例来源:origin: codefollower/Tomcat-Research

@Override
protected void destroyInternal() throws LifecycleException {
  try {
    protocolHandler.destroy();
  } catch (Exception e) {
    throw new LifecycleException
      (sm.getString
       ("coyoteConnector.protocolHandlerDestroyFailed"), e);
  }
  if (getService() != null) {
    getService().removeConnector(this);
  }
  super.destroyInternal();
}

相关文章

Connector类方法