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

Method setLoader

java/org/apache/catalina/core/StandardContext.java:1857–1897  ·  view source on GitHub ↗
(Loader loader)

Source from the content-addressed store, hash-verified

1855 }
1856
1857 @Override
1858 public void setLoader(Loader loader) {
1859
1860 Lock writeLock = loaderLock.writeLock();
1861 writeLock.lock();
1862 Loader oldLoader;
1863 try {
1864 // Change components if necessary
1865 oldLoader = this.loader;
1866 if (oldLoader == loader) {
1867 return;
1868 }
1869 this.loader = loader;
1870 // Start the new component if necessary
1871 if (loader != null) {
1872 loader.setContext(this);
1873 }
1874 } finally {
1875 writeLock.unlock();
1876 }
1877
1878 // Stop the old component if necessary
1879 if (getState().isAvailable() && oldLoader instanceof Lifecycle) {
1880 try {
1881 ((Lifecycle) oldLoader).stop();
1882 } catch (LifecycleException e) {
1883 log.error(sm.getString("standardContext.setLoader.stop"), e);
1884 }
1885 }
1886
1887 if (getState().isAvailable() && loader instanceof Lifecycle) {
1888 try {
1889 ((Lifecycle) loader).start();
1890 } catch (LifecycleException e) {
1891 log.error(sm.getString("standardContext.setLoader.start"), e);
1892 }
1893 }
1894
1895 // Report this property change to interested listeners
1896 support.firePropertyChange("loader", oldLoader, loader);
1897 }
1898
1899
1900 @Override

Callers 4

testCheckHandleTypesMethod · 0.95
testLoaderInstanceMethod · 0.95
testStartInternalMethod · 0.95
startInternalMethod · 0.95

Calls 10

writeLockMethod · 0.80
lockMethod · 0.65
setContextMethod · 0.65
unlockMethod · 0.65
isAvailableMethod · 0.65
getStateMethod · 0.65
stopMethod · 0.65
errorMethod · 0.65
getStringMethod · 0.65
startMethod · 0.65

Tested by 3

testCheckHandleTypesMethod · 0.76
testLoaderInstanceMethod · 0.76
testStartInternalMethod · 0.76