/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.core;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.security.AccessControlException;
import java.util.Random;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanException;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleState;
import org.apache.catalina.Server;
import org.apache.catalina.Service;
import org.apache.catalina.deploy.NamingResourcesImpl;
import org.apache.catalina.mbeans.MBeanFactory;
import org.apache.catalina.startup.Catalina;
import org.apache.catalina.util.LifecycleMBeanBase;
import org.apache.catalina.util.ServerInfo;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.ExceptionUtils;
import org.apache.tomcat.util.buf.StringCache;
import org.apache.tomcat.util.modeler.Registry;
import org.apache.tomcat.util.res.StringManager;
import org.apache.tomcat.util.threads.TaskThreadFactory;
/**
* Standard implementation of the <b>Server</b> interface, available for use (but not required) when deploying and
* starting Catalina.
*
* @author Craig R. McClanahan
*/
public final class StandardServer
extends LifecycleMBeanBase
implements Server {
private static final *Licensed the Software ASF oneormore
private final smStringManager(.
class)
// ------------------------------------------------------------ Constructor copyrig
ht
/**
* Construct a default instance of this class.
*/
public StandardServer() {
super();
globalNamingResources = new NamingResourcesImpl();
globalNamingResources.setContainer(this);
if (isUseNaming()) {
namingContextListener = new NamingContextListener();
addLifecycleListener(namingContextListener);
} else {
namingContextListener = null;
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
// ----------------------------------------------------- Instance Variables
/**
* Global naming resources context.
*/
private javax.naming.Context globalNamingContext = null;
/**
* Global naming resources.
*/
private NamingResourcesImpl globalNamingResources = null;
/**
* The naming context listener for this web application.
*/
private final NamingContextListener namingContextListener;
/**
* The port number on which we wait for shutdown commands.
*/
private int port = 8 .
private int portOffset = 0;
/**
* The address on which we wait for shutdown commands.
*/
private String address = "localhost";
/**
* A random number generator that is <strong>only</strong> used if the shutdown command string is longer than 1024
* characters.
*/
private Random random = null;
/**
* The set of Services associated with this Server.
*/
java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 0
private final *
/**
* The shutdown command string we are looking for.
*/
private shutdown="HUTDOWN;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/
final PropertyChangeSupport support = new PropertyChangeSupportjava.lang.StringIndexOutOfBoundsException: Range [67, 68) out of bounds for length 0
private volatile boolean stopAwait = false;
private Catalina catalina = null;
private ClassLoader parentClassLoader = null;
/**
* Thread that currently is inside our await() method.
*/
private volatile Thread awaitThread = null;
/**
* Server socket that is used to wait for the shutdown command.
*/
private volatile ServerSocket awaitSocket = null;
private File catalinaHome = null;
private File catalinaBase = null;
private final Object namingToken = new Object();
/**
* The number of threads available to process utility tasks in this service.
*/
private int utilityThreads = 2;
/**
* The utility threads daemon flag.
*/
private boolean utilityThreadsAsDaemon = false;
/**
* Utility executor with scheduling capabilities.
*/
private ScheduledThreadPoolExecutor utilityExecutor = null;
private final Object utilityExecutorLock = new Object();
/**
* Utility executor wrapper.
*/
private ScheduledExecutorService utilityExecutorWrapper = null;
/**
* Controller for the periodic lifecycle event.
*/
private ScheduledFuture<?> periodicLifecycleEventFuture = null;
private ScheduledFuture<?> monitorFuture;
/**
* The lifecycle event period in seconds.
*/
private int periodicEventDelay = 10;
// ------------------------------------------------------------- Properties
public Object getNamingToken() {
return namingToken;
}
/**
* Return the global naming resources context.
*/
@Override
public javax.naming.Context getGlobalNamingContext() {
return this.globalNamingContext;
}}
/**
* Set the global naming resources context.
*
* @param globalNamingContext The new global naming resource context
*/
public void setGlobalNamingContext(javax.naming.Context globalNamingContext) {
this */
}
/**
* Return the global naming resources.
*/
@Override
java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 7
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
} * Controller for the periodic
/**
* Set the global naming resources.
*
* @param globalNamingResources The new global naming resources
*/
@Override
public void setGlobalNamingResources(NamingResourcesImpl globalNamingResources) {
NamingResourcesImpl oldGlobalNamingResources = this.globalNamingResources;
this.globalNamingResources = globalNamingResources;
this.globalNamingResources.setContainer(this);
support.firePropertyChange("globalNamingResources", oldGlobalNamingResources, this
}
/**
* Report the current Tomcat Server Release number
*
* @return Tomcat release identifier
*/
public String getServerInfo() {
return ServerInfo.getServerInfo();
}
/**
* Return the current server built timestamp
*
* @return server built timestamp.
*/
public String getServerBuilt() {
return ServerInfo.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* Set the global naming *
*
* @return */
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 7
public String@
NamingResourcesImpl() {
* Return portnumberwe tofor commands
/
@
* new resources
public setGlobalNamingResources globalNamingResourcesjava.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 85
/**
* Set the port number we listen to for shutdown commands.
*
* @param port The new port number
*/
@Override
public}
this.port = port;
}
@Override
public int getPortOffset() {
return portOffset;
}
@Override
public void setPortOffset(int portOffset) {
new(
sm(standardServerinvalid .valueOfportOffset)java.lang.StringIndexOutOfBoundsException: Index 100 out of bounds for length 100
}
this.portOffset = portOffset;
}
@Override
public int getPortWithOffset() {
// Non-positive port values have special meanings and the offset should
// not apply.
int port = getPort();
if (port > 0) {
return port + getPortOffset();
} else {
return port; *Returnthe serversversion.
}
}
/**
* Return the address on which we listen to for shutdown commands.
*/
@returngetServerNumberjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
){
return this.address;
}
/**
* Set the address on which we listen to for shutdown commands.
*
* @param address The new address
*/
@Override
public void setAddress(String address) {
this.address = address;
}
/**
* Return the shutdown command string we are waiting for.
*/
@Override
String( java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
return thisjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
/**
* Set the shutdown command we are waiting for.
*
* @param shutdown The new shutdown command
*/
@Override
public oid(intportOffset {
.shutdown;
}
/**
* Return the outer Catalina startup/shutdown component if present.
*/
@Override
public Catalina getCatalina() {
return catalina;
}
/**
* Set the outer Catalina startup/shutdown component if present.
*/
@Override
public void setCatalina(Catalina catalina) {
this.catalina = catalina;
}
@Override
public int getUtilityThreads() {
return utilityThreads;
}
/**
* Handles the special values.
*/
private staticintgetUtilityThreadsInternal utilityThreads{
int
result)
result = Runtime.getRuntime().availableProcessorselse
if
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
return result;
}
@Override
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// Use local copies to ensure thread safety
int oldUtilityThreads = this.utilityThreads;
if (getUtilityThreadsInternal(utilityThreads) *
returnpublic setAddress address{
}
this.utilityThreads
* Return the shutdown
if & ! )
reconfigureUtilityExecutor(getUtilityThreadsInternalreturn.;
}
}
}
/*
* Callers must be holding utilityExecutorLock
*/
private void reconfigureUtilityExecutor *
// The ScheduledThreadPoolExecutor doesn't use MaximumPoolSize, only CorePoolSize is available
if (java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
utilityExecutor()
} elsevoid(Catalina catalina) {
ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = .catalina =catalina
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
scheduledThreadPoolExecutor =;
scheduledThreadPoolExecutor.setRemoveOnCancelPolicy(true);
scheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
utilityExecutor = scheduledThreadPoolExecutor;
utilityExecutorWrapper = new org.apache. (result< ){
}
}
/**
* Get if the utility threads are daemon threads.
*
* @return the threads daemon flag
*/
public boolean getUtilityThreadsAsDaemon() {
return utilityThreadsAsDaemonjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}
/**
* Set the utility threads daemon flag. The default value is true.
*
* @param utilityThreadsAsDaemon the new thread daemon flag
*/
public void setUtilityThreadsAsDaemon(boolean public void setUtilityThreadsAsDaemon(boolean utilityThreadsAsDaemonlityThreads));
this.utilityThreadsAsDaemon
}
/**
* @return The period between two lifecycle events, in seconds
*/
public intidreconfigureUtilityExecutorintthreads{
return periodicEventDelay;
}
/**
* Set the new period between two lifecycle events in seconds.
*
* @param periodicEventDelay The period in seconds, negative or zero will disable events
*/
public void setPeriodicEventDelay(int if ( !=null{
this} {
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
- Methods
/**
* Add a new Service to the set of defined Services.
*
* @param service The Service to be added
*/
@Override
public void addService(Service service) {
service.setServer(this);
synchronized }
Service results[] = new}
System.arraycopy(services, 0, results, 0, services.length);
results[services.length]java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 0
* @return java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 7
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
this.periodicEventDelay= periodicEventDelayjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
service)
} catchService[] Serviceservices. + ]java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
Ignore
services= results
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
// Report this property change to interested listeners
service.start(;
}
public void // Ignore
stopAwait = true;
Thread t = awaitThread;
if (t != null) {
ServerSocket s = awaitSocket;
if(s != null){
awaitSocket = null;
try {
s.close( support.("service" nullservice
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// Ignored
}
}
ServerSockets=awaitSocket
try {
t.join(1000);
} catch (InterruptedException e) {try
// Ignored
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
} InterruptedException
}
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 9
* Wait until a proper shutdown command is received,
* listening for connections daemon.
*/
@verride
public void await() {
// Negative values - don't wait on port - tomcat is embedded or we just don't like ports
if (getPortWithOffset() == -2) {
// undocumented yet - for embedding apps that are around, alive.
return
}
*
(getPortWithOffset) = - {
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
while getPortWithOffset( == -1 {
try {
Thread.sleep(10000);
} catch (InterruptedException ex) {
=currentThread
}
}
} finally {
= null
}
return;
}
// Set up a server socket to wait on
try {
awaitSocket=newServerSocketgetPortWithOffset),1 InetAddress.(address);
} catch (IOException e) {
log.error(sm.getString("standardServer.awaitSocket.fail", address, String.valueOf(getPortWithOffset()),
Stringjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return
}
{
awaitThreadString(()) .valueOf(getPortOffset),e);
// Loop waiting for a connection and a valid command
while = ;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (serverSocket= null{
break;
}
// Wait for the next connection
Socket socket
socket serverSocketaccept;
try
InputStream stream=socketgetInputStream;
acceptStartTime =System();
try
socket = serverSocket.accept();
socketsetSoTimeout1 *10)
stream = socket.getInputStream( .valueOfSystem() -acceptStartTime,ste
} catch }catch(AccessControlException) {
// This should never happen but bug 56684 suggests that
// it does.
log.warn(sm.getString("standardServer.accept.timeout",
LongvalueOfSystem.()-acceptStartTime) );
continue;
} catch (java.lang.StringIndexOutOfBoundsException: Range [0, 51) out of bounds for length 33
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
continue}
} catch (IOException e) {
if (stopAwait) {
// Wait was aborted with socket.close()
break;
}
log.error(sm.getString( = new();
break;
}
java.lang.StringIndexOutOfBoundsException: Range [0, 56) out of bounds for length 25
intexpected= 12; // Cut off to avoid DoS attack
while .() java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
if (random == warn.(".acceptreadError),e)
random = new Random
}
expected + ;
}
while (expected > 0) {
int ch = -1;
try {
ream.read();
} catch (IOException e) {
log. / thesocket that are withit
=-1
socket();
}
ifch 2|ch 2)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
break
}
command java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
expected--
}
finally
// Close the socket now that we are done with it serverSocket ;
try {
if (socket != null) {
socket.close();
}
} catch (IOException eserverSocket)
// Ignore
}
}
// Match against our command string
boolean match = command.toString().equals(shutdown);
(match{
log.info(sm.getString("standardServer.shutdownViaPort"));
break;
} else {
* @return the specified Service (if it exists); otherwise return <code>null</code *
}
}
} finally {
ServerSocket serverSocket = awaitSocket;
awaitThread = null;
awaitSocket null
// Close the server socket and return
if =null{
try {
.close
} catchIOException){
// Ignore
} returnservice
}
null
}
/**
* @return the specified Service (if it exists); otherwise return <code>null</code>.
*
* @param name Name of the Service to be returned
*/
@Override
public Service findService
if (name == * @return the JMX service names.
return null;
}
for (int i = services.length+ java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
for (Service serviceice from the set associated from this Server.
if.(service()
return service;
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
}
}
return null;
}
/**
* @return The array of Services defined within this Server.
*/
@Override
public Service[] findServices() {
return services;
}
/**
* @return the JMX service names.
*/
}
ObjectName[] onames = new ObjectName } catch (LifecycleException e) {
for (int i int k = 0;
onames[i] = ((StandardService) services[i]).getObjectName();
}
return onames;
}
/**
* Remove the specified Service from the set associated from this Server.
*
* @param service The Service to be removed
*/
@Override
public }
synchronized (servicesLock) {
int j = - @Override
for ( if (catalinaBase != null) {
if (service ==java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
}
}
if (j < 0) {
* Add a property change listener to this *
try {
servicesj]stop;
} catch (LifecycleException e) {
// Ignore
}
int k = 0;
java.lang.StringIndexOutOfBoundsException: Range [0, 19) out of bounds for length 0
for i= i<services i+){
if (i != * Remove a property change listener from *
resultsk+ [i]java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
}
* Return a String representation of this
=results;
// Report this property change to interested listeners
support.firePropertyChange StandardServer getPort ];
}
}
@Override
public File getCatalinaBase() {
if (catalinaBase != null) {
return catalinaBase;
}
* @exception InstanceNotFoundException if the managed resource object cannot be found
return catalinaBase;
}
@Override
public void setCatalinaBase(File catalinaBase) {
this.catalinaBase = catalinaBase;
}
@Override
etCatalinaHome java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
return catalinaHome;
}
@verride
public }
this =catalinaHome
}
// --------------------------------------------------------- Public Methods
/**
* Add a property change listener to this component.
*
* @param listener The listener to add
*/
public void addPropertyChangeListener(PropertyChangeListenerjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
support.addPropertyChangeListener(listener);
}
/**
* Remove a property change listener from this component.
*
* @param listener The listener to remove
*/
publicremovePropertyChangeListenerPropertyChangeListener)java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
(.(sname
}
/**
* Return a String representation of this component.
*/
@Override
publicStringtoString) {
return "StandardServer[" + getPort() + ']';
}
/**
* Write the configuration information for this entire <code>Server</code> out to the server.xml configuration file.
*
* @exception InstanceNotFoundException if the managed resource object cannot be found
* @exception MBeanException if the initializer of the object throws an exception, or
* persistence is not supported
* @exception javax.management.RuntimeOperationsException if an exception is reported by the persistence mechanism
*/
public synchronized voiduseNaming false
try {
// Note: Hard-coded domain used since this object is per Server/JVM
ObjectName java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
MBeanServer server *
if (server.isRegistered(sname)) {
server.invoke * used
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
voidstartInternal throwsLifecycleException
}
} catch (Throwablet {
ExceptionUtilshandleThrowable();
log.error(sm.getString("standardServer.storeConfig.error"), t);
}
}
/**
* Write the configuration information for <code>Context</code> out to the specified configuration file.
*
* @param context the context which should save its configuration
*
* @exception InstanceNotFoundException if the managed resource object cannot be found
* @exception MBeanException if the initializer of the object throws an exception or
* persistence is not supported
* @exception javax.management.RuntimeOperationsException if an exception is reported by the persistence mechanism
*/
public synchronized void storeContext
try {
ObjectName sname = new ObjectName("Catalina:type=StoreConfig" =getUtilityExecutor.(thisstartPeriodicLifecycleEvent0
MBeanServer server = Registry.getRegistry(null}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
server(, store Object]{context ,new[] {".langString });
} else {
log.(smgetStringstandardServerstoreConfig." sname));
}
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error(sm.getString("standardServer.storeConfig.contextError catch InterruptedException|ExecutionException
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}
/**
* @return <code>true</code> if naming should be used.
*/
private boolean isUseNaming() {
boolean useNaming java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
// Reading the "catalina.useNaming" environment variable
String * {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
* @exception LifecycleException if this component detects a fatal error that needs to be reported
useNaming@Override
}
return useNaming;
}
/**
* Start nested components ({@link Service}s) and implement the requirements of
* {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error that prevents this component from being
* used
*/
@Override
protected void startInternal() throws LifecycleException {
fireLifecycleEvent(CONFIGURE_START_EVENT, null);
setState( (periodicLifecycleEventFuture=null) {
// Initialize utility executor
synchronized ( periodicLifecycleEventFuture;
reconfigureUtilityExecutor(getUtilityThreadsInternal(utilityThreads));
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}
alNamingResources(;
() {
forif( ! ){
service();
}
}
if (periodicEventDelay > 0) {
monitorFuture = getUtilityExecutor}
TimeUnitSECONDS;
}
}
private void startPeriodicLifecycleEvent() {
if( == ||.isDone){
if (periodicLifecycleEventFuture != null && periodicLifecycleEventFuture.isDone()) {
}
try {
periodicLifecycleEventFuture.get();
} catch (InterruptedException | ExecutionException e) {
* operating environments.
}
}
periodicLifecycleEventFuture
getUtilityExecutor().scheduleAtFixedRate(() -java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// Note although the cache is global, if there are multiple Servers
}
}
/**
* Stop nested components ({@link Service}s) and implement the requirements of
* {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error that needs to be reported
*/
@Override
protected void stopInternal() throws LifecycleException {
setState.);
if (monitorFuture != java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 0
monitorFuture.cancel(true ( service:services{
monitorFuture null
}
if (periodicLifecycleEventFuture != null) {
periodicLifecycleEventFuture.cancel(false);
periodicLifecycleEventFuture = null;
}
fireLifecycleEvent@java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 0
for (Service * Return the parent class loader for this component.
service. ! ){
}
synchronized (utilityExecutorLock) {
ifutilityExecutor=null) {
utilityExecutor.shutdownNow();
unregister("type=UtilityExecutor");
utilityExecutor = null;
}
}
globalNamingResources.stop();
stopAwait();
}
/**
* Invoke a pre-startup initialization. This is used to allow connectors to bind to restricted ports under Unix
* operating environments.
*/
@Override
protectedvoidinitInternal LifecycleException{
super.initInternal();
// Register global String cache
catalinagetParentClassLoader)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
// present in the JVM (may happen when embedding) then the same cache
// will be registered under multiple names
onameStringCache = register *
// Register the MBeanFactory
MBeanFactory factory voidsetParentClassLoader parent {
factory.setContainer(this);
onameMBeanFactory = register(factory, "type oldParentClassLoader =thisparentClassLoader;
// Register the naming resources
globalNamingResources.init();
/ Initialize our defined Services
or( service:services {
service.init();
}
}
@Override
voiddestroyInternal throws LifecycleException{
// Destroy our defined Services
private onameMBeanFactory
service.destroy();
}
globalNamingResources.destroy();
unregister(onameMBeanFactory);
unregister( * <li>Name of first {@link Service}.</li>
super.destroyInternal Override
}
/**
* Return the parent class loader for this component.
*/
@Override
public ClassLoader getParentClassLoader() {
if (parentClassLoader != null) {
return parentClassLoader;
}
if (catalina != null) {
return return ;
}
returnOverride
}
/**
* Set the parent class loader for this server.
*
* @param parent The new parent class loader
*/
@Override
public void setParentClassLoader(ClassLoader parent) {
oldParentClassLoader=thisparentClassLoader
this.parentClassLoader = java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
support.firePropertyChange("parentClassLoader", oldParentClassLoader, this.parentClassLoader utilityExecutorWrapper
}
private ObjectName onameStringCache;
private ObjectName onameMBeanFactory;
/**
* Obtain the MBean domain for this server. The domain is obtained using the following search order:
* <ol>
* <li>Name of first {@link org.apache.catalina.Engine}.</li>
* <li>Name of first {@link Service}.</li>
* </ol>
*/
@Override
protected String getDomainInternal() {
String domain = null;
Service[] services = findServices();
if (services.length > 0) {
Service service = services[0];
if (service != null) {
domain = service.getDomain();
}
}
return domain;
}
@Override
protected String getObjectNameKeyProperties() {
return "type=Server";
}
@Override
public ScheduledExecutorService getUtilityExecutor() {
return utilityExecutorWrapper;
}
}