org.apache.tomcat.dbcp.dbcp2.datasources

## Class SharedPoolDataSourceFactory

- java.lang.Object
- - org.apache.tomcat.dbcp.dbcp2.datasources.SharedPoolDataSourceFactory

- All Implemented Interfaces:
    ObjectFactory

      public class SharedPoolDataSourceFactory
      extends Object

  A JNDI ObjectFactory which creates `SharedPoolDataSource`s
  Since:
    2.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SharedPoolDataSourceFactory()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `closeAll()` Close all pools associated with this class.
    `protected static Object` | `deserialize(byte[] data)` Used to set some properties saved within a Reference.
    `protected InstanceKeyDataSource` | `getNewInstance(Reference ref)` Creates an instance of the subclass and sets any properties contained in the Reference.
    `Object` | `getObjectInstance(Object refObj, Name name, Context context, Hashtable<?,?> env)` Implements ObjectFactory to create an instance of SharedPoolDataSource or PerUserPoolDataSource.
    `protected boolean` | `isCorrectClass(String className)`

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### SharedPoolDataSourceFactory

          public SharedPoolDataSourceFactory()

  - ### Method Detail

    - #### isCorrectClass

          protected boolean isCorrectClass(String className)

      Parameters:
        `className` - The class name
      Returns:
        true if and only if className is the value returned from getClass().getName().toString()

    - #### getNewInstance

          protected InstanceKeyDataSource getNewInstance(Reference ref)

      Creates an instance of the subclass and sets any properties contained in the Reference.
      Parameters:
        `ref` - The reference
      Returns:
        the data source

    - #### closeAll

          public static void closeAll()
                               throws Exception

      Close all pools associated with this class.
      Throws:
        `Exception` - Close exception

    - #### getObjectInstance

          public Object getObjectInstance(Object refObj,
                                 Name name,
                                 Context context,
                                 Hashtable<?,?> env)
                                   throws IOException,
                                          ClassNotFoundException

      Implements ObjectFactory to create an instance of SharedPoolDataSource or PerUserPoolDataSource.
      Specified by:
        `getObjectInstance` in interface `ObjectFactory`
      Throws:
        `IOException`
        `ClassNotFoundException`

    - #### deserialize

          protected static final Object deserialize(byte[] data)
                                             throws IOException,
                                                    ClassNotFoundException

      Used to set some properties saved within a Reference.
      Parameters:
        `data` - Object data
      Returns:
        the deserialized object
      Throws:
        `IOException` - Stream error
        `ClassNotFoundException` - Couldn't load object class

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.