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

Class SimpleInstanceManager

java/org/apache/tomcat/SimpleInstanceManager.java:26–82  ·  view source on GitHub ↗

SimpleInstanceManager implements the org.apache.tomcat.InstanceManager interface.

Source from the content-addressed store, hash-verified

24 * SimpleInstanceManager implements the org.apache.tomcat.InstanceManager interface.
25 */
26public class SimpleInstanceManager implements InstanceManager {
27
28 /**
29 * Creates a new SimpleInstanceManager.
30 */
31 public SimpleInstanceManager() {
32 }
33
34 /**
35 * {@inheritDoc}
36 */
37 @Override
38 public Object newInstance(Class<?> clazz) throws IllegalAccessException, InvocationTargetException, NamingException,
39 InstantiationException, NoSuchMethodException {
40 return prepareInstance(clazz.getConstructor().newInstance());
41 }
42
43 /**
44 * {@inheritDoc}
45 */
46 @Override
47 public Object newInstance(String className) throws IllegalAccessException, InvocationTargetException,
48 NamingException, InstantiationException, ClassNotFoundException, NoSuchMethodException {
49 Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
50 return prepareInstance(clazz.getConstructor().newInstance());
51 }
52
53 /**
54 * {@inheritDoc}
55 */
56 @Override
57 public Object newInstance(String fqcn, ClassLoader classLoader)
58 throws IllegalAccessException, InvocationTargetException, NamingException, InstantiationException,
59 ClassNotFoundException, NoSuchMethodException {
60 Class<?> clazz = classLoader.loadClass(fqcn);
61 return prepareInstance(clazz.getConstructor().newInstance());
62 }
63
64 /**
65 * {@inheritDoc}
66 */
67 @Override
68 public void newInstance(Object o) throws IllegalAccessException, InvocationTargetException, NamingException {
69 // NO-OP
70 }
71
72 /**
73 * {@inheritDoc}
74 */
75 @Override
76 public void destroyInstance(Object o) throws IllegalAccessException, InvocationTargetException {
77 }
78
79 private Object prepareInstance(Object o) {
80 return o;
81 }
82}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected