MCPcopy Index your code
hub / github.com/apache/tomcat / stopInternal

Method stopInternal

java/org/apache/catalina/core/ContainerBase.java:776–828  ·  view source on GitHub ↗

Stop this component and implement the requirements of org.apache.catalina.util.LifecycleBase#stopInternal(). @exception LifecycleException if this component detects a fatal error that prevents this component from being used

()

Source from the content-addressed store, hash-verified

774 * used
775 */
776 @Override
777 protected void stopInternal() throws LifecycleException {
778
779 // Stop our thread
780 if (monitorFuture != null) {
781 monitorFuture.cancel(true);
782 monitorFuture = null;
783 }
784 threadStop();
785
786 setState(LifecycleState.STOPPING);
787
788 // Stop the Valves in our pipeline (including the basic), if any
789 if (pipeline instanceof Lifecycle && ((Lifecycle) pipeline).getState().isAvailable()) {
790 ((Lifecycle) pipeline).stop();
791 }
792
793 // Stop our child containers, if any
794 Container[] children = findChildren();
795 List<Future<Void>> results = new ArrayList<>(children.length);
796 for (Container child : children) {
797 results.add(startStopExecutor.submit(new StopChild(child)));
798 }
799
800 boolean fail = false;
801 for (Future<Void> result : results) {
802 try {
803 result.get();
804 } catch (Exception e) {
805 log.error(sm.getString("containerBase.threadedStopFailed"), e);
806 fail = true;
807 }
808 }
809 if (fail) {
810 throw new LifecycleException(sm.getString("containerBase.threadedStopFailed"));
811 }
812
813 // Stop our subordinate components, if any
814 Realm realm = getRealmInternal();
815 if (realm instanceof Lifecycle) {
816 ((Lifecycle) realm).stop();
817 }
818 Cluster cluster = getClusterInternal();
819 if (cluster instanceof Lifecycle) {
820 ((Lifecycle) cluster).stop();
821 }
822
823 // If init fails, this may be null
824 if (startStopExecutor != null) {
825 startStopExecutor.shutdownNow();
826 startStopExecutor = null;
827 }
828 }
829
830 @Override
831 protected void destroyInternal() throws LifecycleException {

Callers

nothing calls this directly

Calls 15

threadStopMethod · 0.95
findChildrenMethod · 0.95
getRealmInternalMethod · 0.95
getClusterInternalMethod · 0.95
isAvailableMethod · 0.65
getStateMethod · 0.65
stopMethod · 0.65
addMethod · 0.65
getMethod · 0.65
errorMethod · 0.65
getStringMethod · 0.65
cancelMethod · 0.45

Tested by

no test coverage detected