当前位置: 首页>>代码示例>>Java>>正文


Java Service.removeConnector方法代码示例

本文整理汇总了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;
        }
    }

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:38,代码来源:MBeanFactory.java

示例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;
        }
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:39,代码来源:MBeanFactory.java

示例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;
        } 
    }

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:47,代码来源:MBeanFactory.java

示例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;
		}
	}

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:40,代码来源:MBeanFactory.java


注:本文中的org.apache.catalina.Service.removeConnector方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。