Class PerUserPoolDataSourceFactory
- java.lang.Object
-
- org.apache.tomcat.dbcp.dbcp2.datasources.PerUserPoolDataSourceFactory
-
- All Implemented Interfaces:
javax.naming.spi.ObjectFactory
public class PerUserPoolDataSourceFactory extends java.lang.ObjectA JNDI ObjectFactory which createsSharedPoolDataSources- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description PerUserPoolDataSourceFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidcloseAll()Closes all pools associated with this class.protected static java.lang.Objectdeserialize(byte[] data)Deserializes the provided byte array to create an object.protected InstanceKeyDataSourcegetNewInstance(javax.naming.Reference ref)Creates an instance of the subclass and sets any properties contained in the Reference.java.lang.ObjectgetObjectInstance(java.lang.Object refObj, javax.naming.Name name, javax.naming.Context context, java.util.Hashtable<?,?> env)Implements ObjectFactory to create an instance of SharedPoolDataSource or PerUserPoolDataSourceprotected booleanisCorrectClass(java.lang.String className)Tests if className is the value returned from getClass().getName().toString().
-
-
-
Method Detail
-
getNewInstance
protected InstanceKeyDataSource getNewInstance(javax.naming.Reference ref) throws java.io.IOException, java.lang.ClassNotFoundException
Creates an instance of the subclass and sets any properties contained in the Reference.- Parameters:
ref- The properties to be set on the created DataSource- Returns:
- A configured DataSource of the appropriate type.
- Throws:
java.io.IOException- If an I/O error occurs during the deserialization of a configuration parameter.java.lang.ClassNotFoundException- If a class cannot be found during the deserialization of a configuration parameter.
-
isCorrectClass
protected boolean isCorrectClass(java.lang.String className)
Tests if className is the value returned from getClass().getName().toString().- Parameters:
className- The class name to test.- Returns:
- true if and only if className is the value returned from getClass().getName().toString()
-
closeAll
public static void closeAll() throws java.lang.ExceptionCloses all pools associated with this class.- Throws:
java.lang.Exception- aListExceptioncontaining all exceptions thrown byInstanceKeyDataSource.close()- Since:
- 2.4.0 throws a
ListExceptioninstead of, in 2.3.0 and before, the first exception thrown byInstanceKeyDataSource.close(). - See Also:
InstanceKeyDataSource.close(),ListException
-
deserialize
protected static final java.lang.Object deserialize(byte[] data) throws java.io.IOException, java.lang.ClassNotFoundExceptionDeserializes the provided byte array to create an object.- Parameters:
data- Data to deserialize to create the configuration parameter.- Returns:
- The Object created by deserializing the data.
- Throws:
java.lang.ClassNotFoundException- If a class cannot be found during the deserialization of a configuration parameter.java.io.IOException- If an I/O error occurs during the deserialization of a configuration parameter.
-
getObjectInstance
public java.lang.Object getObjectInstance(java.lang.Object refObj, javax.naming.Name name, javax.naming.Context context, java.util.Hashtable<?,?> env) throws java.io.IOException, java.lang.ClassNotFoundExceptionImplements ObjectFactory to create an instance of SharedPoolDataSource or PerUserPoolDataSource- Specified by:
getObjectInstancein interfacejavax.naming.spi.ObjectFactory- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
-