MCPcopy Create free account
hub / github.com/apache/tomcat / removeChild

Method removeChild

java/org/apache/catalina/core/ContainerBase.java:634–672  ·  view source on GitHub ↗
(Container child)

Source from the content-addressed store, hash-verified

632
633
634 @Override
635 public void removeChild(Container child) {
636
637 if (child == null) {
638 return;
639 }
640
641 try {
642 if (child.getState().isAvailable()) {
643 child.stop();
644 }
645 } catch (LifecycleException e) {
646 log.error(sm.getString("containerBase.child.stop"), e);
647 }
648
649 try {
650 // child.destroy() may have already been called which would have
651 // triggered this call. If that is the case, no need to destroy the
652 // child again.
653 if (!LifecycleState.DESTROYING.equals(child.getState())) {
654 child.destroy();
655 }
656 } catch (LifecycleException e) {
657 log.error(sm.getString("containerBase.child.destroy"), e);
658 }
659
660 boolean removed = false;
661 childrenLock.writeLock().lock();
662 try {
663 removed = children.remove(child.getName()) != null;
664 } finally {
665 childrenLock.writeLock().unlock();
666 }
667
668 if (removed) {
669 fireContainerEvent(REMOVE_CHILD_EVENT, child);
670 }
671
672 }
673
674
675 @Override

Callers 2

destroyInternalMethod · 0.95
addChildMethod · 0.95

Calls 13

fireContainerEventMethod · 0.95
writeLockMethod · 0.80
isAvailableMethod · 0.65
getStateMethod · 0.65
stopMethod · 0.65
errorMethod · 0.65
getStringMethod · 0.65
equalsMethod · 0.65
destroyMethod · 0.65
lockMethod · 0.65
removeMethod · 0.65
getNameMethod · 0.65

Tested by

no test coverage detected