本文整理汇总了Java中org.apache.catalina.Service.removeConnector方法的典型用法代码示例。如果您正苦于以下问题:Java Service.removeConnector方法的具体用法?Java Service.removeConnector怎么用?Java Service.removeConnector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.catalina.Service
的用法示例。
在下文中一共展示了Service.removeConnector方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
}
示例2: 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;
}
}
}
示例3: 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;
}
}
}
示例4: 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;
}
}
}