本文整理汇总了Java中org.apache.catalina.Service.findConnectors方法的典型用法代码示例。如果您正苦于以下问题:Java Service.findConnectors方法的具体用法?Java Service.findConnectors怎么用?Java Service.findConnectors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.catalina.Service
的用法示例。
在下文中一共展示了Service.findConnectors方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populateSessionTrackingModes
import org.apache.catalina.Service; //导入方法依赖的package包/类
private void populateSessionTrackingModes() {
// URL re-writing is always enabled by default
defaultSessionTrackingModes = EnumSet.of(SessionTrackingMode.URL);
supportedSessionTrackingModes = EnumSet.of(SessionTrackingMode.URL);
if (context.getCookies()) {
defaultSessionTrackingModes.add(SessionTrackingMode.COOKIE);
supportedSessionTrackingModes.add(SessionTrackingMode.COOKIE);
}
// SSL not enabled by default as it can only used on its own
// Context > Host > Engine > Service
Service s = ((Engine) context.getParent().getParent()).getService();
Connector[] connectors = s.findConnectors();
// Need at least one SSL enabled connector to use the SSL session ID.
for (Connector connector : connectors) {
if (Boolean.TRUE.equals(connector.getAttribute("SSLEnabled"))) {
supportedSessionTrackingModes.add(SessionTrackingMode.SSL);
break;
}
}
}
示例2: createMBeans
import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
* Create the MBeans for the specified Service and its nested components.
*
* @param service Service for which to create MBeans
*
* @exception Exception if an exception is thrown during MBean creation
*/
protected void createMBeans(Service service) throws Exception {
// Create the MBean for the Service itself
if (log.isDebugEnabled())
log.debug("Creating MBean for Service " + service);
//MBeanUtils.createMBean(service);
if (service instanceof StandardService) {
((StandardService) service).addPropertyChangeListener(this);
}
// Create the MBeans for the corresponding Connectors
Connector connectors[] = service.findConnectors();
for (int j = 0; j < connectors.length; j++) {
createMBeans(connectors[j]);
}
// Create the MBean for the associated Engine and friends
Engine engine = (Engine) service.getContainer();
if (engine != null) {
createMBeans(engine);
}
}
示例3: createMBeans
import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
* Create the MBeans for the specified Service and its nested components.
*
* @param service Service for which to create MBeans
*
* @exception Exception if an exception is thrown during MBean creation
*/
protected void createMBeans(Service service) throws Exception {
// Create the MBean for the Service itself
if (debug >= 2)
log("Creating MBean for Service " + service);
MBeanUtils.createMBean(service);
if (service instanceof StandardService) {
((StandardService) service).addPropertyChangeListener(this);
}
// Create the MBeans for the corresponding Connectors
Connector connectors[] = service.findConnectors();
for (int j = 0; j < connectors.length; j++) {
createMBeans(connectors[j]);
}
// Create the MBean for the associated Engine and friends
Engine engine = (Engine) service.getContainer();
if (engine != null) {
createMBeans(engine);
}
}
示例4: destroyMBeans
import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
* Deregister the MBeans for the specified Service and its nested
* components.
*
* @param service Service for which to destroy MBeans
*
* @exception Exception if an exception is thrown during MBean destruction
*/
protected void destroyMBeans(Service service) throws Exception {
// Deregister the MBeans for the associated Engine
Engine engine = (Engine) service.getContainer();
if (engine != null) {
destroyMBeans(engine);
}
// Deregister the MBeans for the corresponding Connectors
Connector connectors[] = service.findConnectors();
for (int j = 0; j < connectors.length; j++) {
destroyMBeans(connectors[j], service);
}
// Deregister the MBean for the Service itself
if (debug >= 2) {
log("Destroying MBean for Service " + service);
}
MBeanUtils.destroyMBean(service);
if (service instanceof StandardService) {
((StandardService) service).removePropertyChangeListener(this);
}
}
示例5: populateSessionTrackingModes
import org.apache.catalina.Service; //导入方法依赖的package包/类
private void populateSessionTrackingModes() {
// URL re-writing is always enabled by default
defaultSessionTrackingModes = EnumSet.of(SessionTrackingMode.URL);
supportedSessionTrackingModes = EnumSet.of(SessionTrackingMode.URL);
if (context.getCookies()) {
defaultSessionTrackingModes.add(SessionTrackingMode.COOKIE);
supportedSessionTrackingModes.add(SessionTrackingMode.COOKIE);
}
// SSL not enabled by default as it can only used on its own
// Context > Host > Engine > Service
Service s = ((Engine) context.getParent().getParent()).getService();
Connector[] connectors = s.findConnectors();
// Need at least one SSL enabled connector to use the SSL session ID.
for (Connector connector : connectors) {
if (Boolean.TRUE.equals(connector.getAttribute("SSLEnabled"))) {
supportedSessionTrackingModes.add(SessionTrackingMode.SSL);
break;
}
}
}
示例6: removeConnector
import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
* Remove an existing Connector.
*
* @param name MBean Name of the component to remove
*
* @exception Exception if a component cannot be removed
*/
public void removeConnector(String name) throws Exception {
// Acquire a reference to the component to be removed
ObjectName oname = new ObjectName(name);
Service service = getService(oname);
String port = oname.getKeyProperty("port");
//String address = oname.getKeyProperty("address");
Connector conns[] = service.findConnectors();
for (int i = 0; i < conns.length; i++) {
String connAddress = String.valueOf(conns[i].getProperty("address"));
String connPort = ""+conns[i].getPort();
// if (((address.equals("null")) &&
if ((connAddress==null) && port.equals(connPort)) {
service.removeConnector(conns[i]);
conns[i].destroy();
break;
}
// } else if (address.equals(connAddress))
if (port.equals(connPort)) {
// Remove this component from its parent component
service.removeConnector(conns[i]);
conns[i].destroy();
break;
}
}
}
示例7: stopIdleThreads
import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
* Updates each ThreadPoolExecutor with the current time, which is the time
* when a context is being stopped.
*
* @param context
* the context being stopped, used to discover all the Connectors
* of its parent Service.
*/
private void stopIdleThreads(Context context) {
if (serverStopping) return;
if (!(context instanceof StandardContext) ||
!((StandardContext) context).getRenewThreadsWhenStoppingContext()) {
log.debug("Not renewing threads when the context is stopping. "
+ "It is not configured to do it.");
return;
}
Engine engine = (Engine) context.getParent().getParent();
Service service = engine.getService();
Connector[] connectors = service.findConnectors();
if (connectors != null) {
for (Connector connector : connectors) {
ProtocolHandler handler = connector.getProtocolHandler();
Executor executor = null;
if (handler != null) {
executor = handler.getExecutor();
}
if (executor instanceof ThreadPoolExecutor) {
ThreadPoolExecutor threadPoolExecutor =
(ThreadPoolExecutor) executor;
threadPoolExecutor.contextStopping();
} else if (executor instanceof StandardThreadExecutor) {
StandardThreadExecutor stdThreadExecutor =
(StandardThreadExecutor) executor;
stdThreadExecutor.contextStopping();
}
}
}
}
示例8: removeConnector
import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
* Remove an existing Connector.
*
* @param name MBean Name of the component to remove
*
* @exception Exception if a component cannot be removed
*/
public void removeConnector(String name) throws Exception {
// Acquire a reference to the component to be removed
ObjectName oname = new ObjectName(name);
Server server = ServerFactory.getServer();
Service service = getService(oname);
String port = oname.getKeyProperty("port");
//String address = oname.getKeyProperty("address");
Connector conns[] = (Connector[]) service.findConnectors();
for (int i = 0; i < conns.length; i++) {
String connAddress = String.valueOf(conns[i].getProperty("address"));
String connPort = ""+conns[i].getPort();
// if (((address.equals("null")) &&
if ((connAddress==null) && port.equals(connPort)) {
service.removeConnector(conns[i]);
conns[i].destroy();
break;
}
// } else if (address.equals(connAddress))
if (port.equals(connPort)) {
// Remove this component from its parent component
service.removeConnector(conns[i]);
conns[i].destroy();
break;
}
}
}
示例9: removeConnector
import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
* Remove an existing Connector.
*
* @param name MBean Name of the comonent to remove
*
* @param serviceName Service name of the connector to remove
*
* @exception Exception if a component cannot be removed
*/
public void removeConnector(String name) throws Exception {
// Acquire a reference to the component to be removed
ObjectName oname = new ObjectName(name);
Server server = ServerFactory.getServer();
String serviceName = oname.getKeyProperty("service");
Service service = server.findService(serviceName);
String port = oname.getKeyProperty("port");
String address = oname.getKeyProperty("address");
Connector conns[] = (Connector[]) service.findConnectors();
for (int i = 0; i < conns.length; i++) {
Class cls = conns[i].getClass();
Method getAddrMeth = cls.getMethod("getAddress", null);
Object addrObj = getAddrMeth.invoke(conns[i], null);
String connAddress = null;
if (addrObj != null) {
connAddress = addrObj.toString();
}
Method getPortMeth = cls.getMethod("getPort", null);
Object portObj = getPortMeth.invoke(conns[i], null);
String connPort = new String();
if (portObj != null) {
connPort = portObj.toString();
}
if (((address.equals("null")) && (connAddress==null)) && port.equals(connPort)) {
service.removeConnector(conns[i]);
break;
} else if (address.equals(connAddress) && port.equals(connPort)) {
// Remove this component from its parent component
service.removeConnector(conns[i]);
break;
}
}
}
示例10: removeConnector
import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
* Remove an existing Connector.
*
* @param name
* MBean Name of the component to remove
*
* @exception Exception
* if a component cannot be removed
*/
public void removeConnector(String name) throws Exception {
// Acquire a reference to the component to be removed
ObjectName oname = new ObjectName(name);
Service service = getService(oname);
String port = oname.getKeyProperty("port");
// String address = oname.getKeyProperty("address");
Connector conns[] = service.findConnectors();
for (int i = 0; i < conns.length; i++) {
String connAddress = String.valueOf(conns[i].getProperty("address"));
String connPort = "" + conns[i].getPort();
// if (((address.equals("null")) &&
if ((connAddress == null) && port.equals(connPort)) {
service.removeConnector(conns[i]);
conns[i].destroy();
break;
}
// } else if (address.equals(connAddress))
if (port.equals(connPort)) {
// Remove this component from its parent component
service.removeConnector(conns[i]);
conns[i].destroy();
break;
}
}
}
示例11: stopIdleThreads
import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
* Updates each ThreadPoolExecutor with the current time, which is the time
* when a context is being stopped.
*
* @param context
* the context being stopped, used to discover all the Connectors
* of its parent Service.
*/
private void stopIdleThreads(Context context) {
if (serverStopping)
return;
if (!(context instanceof StandardContext)
|| !((StandardContext) context).getRenewThreadsWhenStoppingContext()) {
log.debug("Not renewing threads when the context is stopping. " + "It is not configured to do it.");
return;
}
Engine engine = (Engine) context.getParent().getParent();
Service service = engine.getService();
Connector[] connectors = service.findConnectors();
if (connectors != null) {
for (Connector connector : connectors) {
ProtocolHandler handler = connector.getProtocolHandler();
Executor executor = null;
if (handler != null) {
executor = handler.getExecutor();
}
if (executor instanceof ThreadPoolExecutor) {
ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) executor;
threadPoolExecutor.contextStopping();
} else if (executor instanceof StandardThreadExecutor) {
StandardThreadExecutor stdThreadExecutor = (StandardThreadExecutor) executor;
stdThreadExecutor.contextStopping();
}
}
}
}
示例12: storeService
import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
* Store the specified Service properties.
*
* @param writer PrintWriter to which we are storing
* @param indent Number of spaces to indent this element
* @param server Object to be stored
*
* @exception Exception if an exception occurs while storing
*/
private void storeService(PrintWriter writer, int indent,
Service service) throws Exception {
// Store the beginning of this element
for (int i = 0; i < indent; i++) {
writer.print(' ');
}
writer.print("<Service");
storeAttributes(writer, service);
writer.println(">");
// Store nested <Connector> elements
Connector connectors[] = service.findConnectors();
for (int i = 0; i < connectors.length; i++) {
storeConnector(writer, indent + 2, connectors[i]);
}
// Store nested <Engine> element (or other appropriate container)
Container container = service.getContainer();
if (container != null) {
if (container instanceof Context) {
storeContext(writer, indent + 2, (Context) container);
} else if (container instanceof Engine) {
storeEngine(writer, indent + 2, (Engine) container);
} else if (container instanceof Host) {
storeHost(writer, indent + 2, (Host) container);
}
}
// Store nested <Listener> elements
if (service instanceof Lifecycle) {
LifecycleListener listeners[] =
((Lifecycle) service).findLifecycleListeners();
for (int i = 0; i < listeners.length; i++) {
if (listeners[i].getClass().getName().equals
(SERVER_LISTENER_CLASS_NAME)) {
continue;
}
storeListener(writer, indent + 2, listeners[i]);
}
}
// Store the ending of this element
for (int i = 0; i < indent; i++) {
writer.print(' ');
}
writer.println("</Service>");
}