Java Code Examples for org.apache.catalina.mbeans.MBeanUtils#destroyMBean()

The following examples show how to use org.apache.catalina.mbeans.MBeanUtils#destroyMBean() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NamingResourcesImpl.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
/**
 * Remove any environment entry with the specified name.
 *
 * @param name Name of the environment entry to remove
 */
@Override
public void removeEnvironment(String name) {

    entries.remove(name);

    ContextEnvironment environment = null;
    synchronized (envs) {
        environment = envs.remove(name);
    }
    if (environment != null) {
        support.firePropertyChange("environment", environment, null);
        // De-register with JMX
        if (resourceRequireExplicitRegistration) {
            try {
                MBeanUtils.destroyMBean(environment);
            } catch (Exception e) {
                log.warn(sm.getString("namingResources.mbeanDestroyFail",
                        environment.getName()), e);
            }
        }
        environment.setNamingResources(null);
    }
}
 
Example 2
Source File: NamingResourcesImpl.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
/**
 * Remove any resource reference with the specified name.
 *
 * @param name Name of the resource reference to remove
 */
@Override
public void removeResource(String name) {

    entries.remove(name);

    ContextResource resource = null;
    synchronized (resources) {
        resource = resources.remove(name);
    }
    if (resource != null) {
        support.firePropertyChange("resource", resource, null);
        // De-register with JMX
        if (resourceRequireExplicitRegistration) {
            try {
                MBeanUtils.destroyMBean(resource);
            } catch (Exception e) {
                log.warn(sm.getString("namingResources.mbeanDestroyFail",
                        resource.getName()), e);
            }
        }
        resource.setNamingResources(null);
    }
}
 
Example 3
Source File: NamingResourcesImpl.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
/**
 * Remove any resource link with the specified name.
 *
 * @param name Name of the resource link to remove
 */
@Override
public void removeResourceLink(String name) {

    entries.remove(name);

    ContextResourceLink resourceLink = null;
    synchronized (resourceLinks) {
        resourceLink = resourceLinks.remove(name);
    }
    if (resourceLink != null) {
        support.firePropertyChange("resourceLink", resourceLink, null);
        // De-register with JMX
        if (resourceRequireExplicitRegistration) {
            try {
                MBeanUtils.destroyMBean(resourceLink);
            } catch (Exception e) {
                log.warn(sm.getString("namingResources.mbeanDestroyFail",
                        resourceLink.getName()), e);
            }
        }
        resourceLink.setNamingResources(null);
    }
}
 
Example 4
Source File: NamingResources.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * Remove any environment entry with the specified name.
 *
 * @param name Name of the environment entry to remove
 */
public void removeEnvironment(String name) {

    entries.remove(name);

    ContextEnvironment environment = null;
    synchronized (envs) {
        environment = envs.remove(name);
    }
    if (environment != null) {
        support.firePropertyChange("environment", environment, null);
        // De-register with JMX
        if (resourceRequireExplicitRegistration) {
            try {
                MBeanUtils.destroyMBean(environment);
            } catch (Exception e) {
                log.warn(sm.getString("namingResources.mbeanDestroyFail",
                        environment.getName()), e);
            }
        }
        environment.setNamingResources(null);
    }
}
 
Example 5
Source File: NamingResources.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * Remove any resource reference with the specified name.
 *
 * @param name Name of the resource reference to remove
 */
public void removeResource(String name) {

    entries.remove(name);

    ContextResource resource = null;
    synchronized (resources) {
        resource = resources.remove(name);
    }
    if (resource != null) {
        support.firePropertyChange("resource", resource, null);
        // De-register with JMX
        if (resourceRequireExplicitRegistration) {
            try {
                MBeanUtils.destroyMBean(resource);
            } catch (Exception e) {
                log.warn(sm.getString("namingResources.mbeanDestroyFail",
                        resource.getName()), e);
            }
        }
        resource.setNamingResources(null);
    }
}
 
Example 6
Source File: NamingResources.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * Remove any resource link with the specified name.
 *
 * @param name Name of the resource link to remove
 */
public void removeResourceLink(String name) {

    entries.remove(name);

    ContextResourceLink resourceLink = null;
    synchronized (resourceLinks) {
        resourceLink = resourceLinks.remove(name);
    }
    if (resourceLink != null) {
        support.firePropertyChange("resourceLink", resourceLink, null);
        // De-register with JMX
        if (resourceRequireExplicitRegistration) {
            try {
                MBeanUtils.destroyMBean(resourceLink);
            } catch (Exception e) {
                log.warn(sm.getString("namingResources.mbeanDestroyFail",
                        resourceLink.getName()), e);
            }
        }
        resourceLink.setNamingResources(null);
    }
}
 
Example 7
Source File: NamingResources.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
/**
 * Remove any environment entry with the specified name.
 *
 * @param name Name of the environment entry to remove
 */
public void removeEnvironment(String name) {

    entries.remove(name);

    ContextEnvironment environment = null;
    synchronized (envs) {
        environment = envs.remove(name);
    }
    if (environment != null) {
        support.firePropertyChange("environment", environment, null);
        // De-register with JMX
        if (resourceRequireExplicitRegistration) {
            try {
                MBeanUtils.destroyMBean(environment);
            } catch (Exception e) {
                log.warn(sm.getString("namingResources.mbeanDestroyFail",
                        environment.getName()), e);
            }
        }
        environment.setNamingResources(null);
    }
}
 
Example 8
Source File: NamingResources.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
/**
 * Remove any resource reference with the specified name.
 *
 * @param name Name of the resource reference to remove
 */
public void removeResource(String name) {

    entries.remove(name);

    ContextResource resource = null;
    synchronized (resources) {
        resource = resources.remove(name);
    }
    if (resource != null) {
        support.firePropertyChange("resource", resource, null);
        // De-register with JMX
        if (resourceRequireExplicitRegistration) {
            try {
                MBeanUtils.destroyMBean(resource);
            } catch (Exception e) {
                log.warn(sm.getString("namingResources.mbeanDestroyFail",
                        resource.getName()), e);
            }
        }
        resource.setNamingResources(null);
    }
}
 
Example 9
Source File: NamingResources.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
/**
 * Remove any resource link with the specified name.
 *
 * @param name Name of the resource link to remove
 */
public void removeResourceLink(String name) {

    entries.remove(name);

    ContextResourceLink resourceLink = null;
    synchronized (resourceLinks) {
        resourceLink = resourceLinks.remove(name);
    }
    if (resourceLink != null) {
        support.firePropertyChange("resourceLink", resourceLink, null);
        // De-register with JMX
        if (resourceRequireExplicitRegistration) {
            try {
                MBeanUtils.destroyMBean(resourceLink);
            } catch (Exception e) {
                log.warn(sm.getString("namingResources.mbeanDestroyFail",
                        resourceLink.getName()), e);
            }
        }
        resourceLink.setNamingResources(null);
    }
}