SimpleInstanceManager (Apache Tomcat 11.0.24 API Documentation)
Description: declaration: package: org.apache.tomcat, class: SimpleInstanceManager

# Class SimpleInstanceManager

java.lang.Object
org.apache.tomcat.SimpleInstanceManager

All Implemented Interfaces:
  `InstanceManager`

public class SimpleInstanceManager extends Object implements InstanceManager
SimpleInstanceManager implements the org.apache.tomcat.InstanceManager interface.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SimpleInstanceManager()`
  Creates a new SimpleInstanceManager.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `destroyInstance(Object o)`
  Destroy the given instance, performing pre-destroy callbacks.
  `Object`
  `newInstance(Class<?> clazz)`
  Create a new instance of the given class.
  `void`
  `newInstance(Object o)`
  Perform dependency injection on the given object.
  `Object`
  `newInstance(String className)`
  Create a new instance of the class with the given name.
  `Object`
  `newInstance(String fqcn, ClassLoader classLoader)`
  Create a new instance of the class with the given name using the specified class loader.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface InstanceManager

  `backgroundProcess`

- ## Constructor Details

  - ### SimpleInstanceManager

    public SimpleInstanceManager()
    Creates a new SimpleInstanceManager.

- ## Method Details

  - ### newInstance

    public Object newInstance(Class<?> clazz) throws IllegalAccessException, InvocationTargetException, NamingException, InstantiationException, NoSuchMethodException
    Create a new instance of the given class.
    Specified by:
      `newInstance` in interface `InstanceManager`
    Parameters:
      `clazz` - The class to instantiate
    Returns:
      the new instance
    Throws:
      `IllegalAccessException` - if the class or its nullary constructor is not accessible
      `InvocationTargetException` - if the nullary constructor throws an exception
      `NamingException` - if a naming exception is encountered
      `InstantiationException` - if this Class represents an abstract class, an interface, an array class, a primitive type, or void
      `NoSuchMethodException` - if the nullary method cannot be found

  - ### newInstance

    public Object newInstance(String className) throws IllegalAccessException, InvocationTargetException, NamingException, InstantiationException, ClassNotFoundException, NoSuchMethodException
    Create a new instance of the class with the given name.
    Specified by:
      `newInstance` in interface `InstanceManager`
    Parameters:
      `className` - The name of the class to instantiate
    Returns:
      the new instance
    Throws:
      `IllegalAccessException` - if the class or its nullary constructor is not accessible
      `InvocationTargetException` - if the nullary constructor throws an exception
      `NamingException` - if a naming exception is encountered
      `InstantiationException` - if this Class represents an abstract class, an interface, an array class, a primitive type, or void
      `ClassNotFoundException` - if the class cannot be found
      `NoSuchMethodException` - if the nullary method cannot be found

  - ### newInstance

    public Object newInstance(String fqcn, ClassLoader classLoader) throws IllegalAccessException, InvocationTargetException, NamingException, InstantiationException, ClassNotFoundException, NoSuchMethodException
    Create a new instance of the class with the given name using the specified class loader.
    Specified by:
      `newInstance` in interface `InstanceManager`
    Parameters:
      `fqcn` - The fully qualified class name
      `classLoader` - The class loader to use for loading the class
    Returns:
      the new instance
    Throws:
      `IllegalAccessException` - if the class or its nullary constructor is not accessible
      `InvocationTargetException` - if the nullary constructor throws an exception
      `NamingException` - if a naming exception is encountered
      `InstantiationException` - if this Class represents an abstract class, an interface, an array class, a primitive type, or void
      `ClassNotFoundException` - if the class cannot be found
      `NoSuchMethodException` - if the nullary method cannot be found

  - ### newInstance

    public void newInstance(Object o) throws IllegalAccessException, InvocationTargetException, NamingException
    Perform dependency injection on the given object.
    Specified by:
      `newInstance` in interface `InstanceManager`
    Parameters:
      `o` - The object to inject dependencies into
    Throws:
      `IllegalAccessException` - if the class or its nullary constructor is not accessible
      `InvocationTargetException` - if the nullary constructor throws an exception
      `NamingException` - if a naming exception is encountered

  - ### destroyInstance

    public void destroyInstance(Object o) throws IllegalAccessException, InvocationTargetException
    Destroy the given instance, performing pre-destroy callbacks.
    Specified by:
      `destroyInstance` in interface `InstanceManager`
    Parameters:
      `o` - The object to destroy
    Throws:
      `IllegalAccessException` - if the class or its nullary constructor is not accessible
      `InvocationTargetException` - if the nullary constructor throws an exception