Class DataSource

  • All Implemented Interfaces:
    java.sql.Wrapper, javax.management.MBeanRegistration, javax.sql.CommonDataSource, javax.sql.ConnectionPoolDataSource, javax.sql.DataSource, ConnectionPoolMBean, PoolConfiguration
    Direct Known Subclasses:
    XADataSource

    public class DataSource
    extends DataSourceProxy
    implements javax.sql.DataSource, javax.management.MBeanRegistration, ConnectionPoolMBean, javax.sql.ConnectionPoolDataSource
    A DataSource that can be instantiated through IoC and implements the DataSource interface since the DataSourceProxy is used as a generic proxy. The DataSource simply wraps a ConnectionPool in order to provide a standard interface to the user.
    Version:
    1.0
    • Field Detail

      • oname

        protected volatile javax.management.ObjectName oname
    • Constructor Detail

      • DataSource

        public DataSource()
        Constructor for reflection only. A default set of pool properties will be created.
      • DataSource

        public DataSource​(PoolConfiguration poolProperties)
        Constructs a DataSource object wrapping a connection
        Parameters:
        poolProperties - The pool properties
    • Method Detail

      • postDeregister

        public void postDeregister()
        Unregisters the underlying connection pool mbean.
        Specified by:
        postDeregister in interface javax.management.MBeanRegistration
      • postRegister

        public void postRegister​(java.lang.Boolean registrationDone)
        no-op
        Specified by:
        postRegister in interface javax.management.MBeanRegistration
      • preDeregister

        public void preDeregister()
                           throws java.lang.Exception
        no-op
        Specified by:
        preDeregister in interface javax.management.MBeanRegistration
        Throws:
        java.lang.Exception
      • preRegister

        public javax.management.ObjectName preRegister​(javax.management.MBeanServer server,
                                                       javax.management.ObjectName name)
                                                throws java.lang.Exception
        If the connection pool MBean exists, it will be registered during this operation.
        Specified by:
        preRegister in interface javax.management.MBeanRegistration
        Throws:
        java.lang.Exception
      • createObjectName

        public javax.management.ObjectName createObjectName​(javax.management.ObjectName original)
                                                     throws javax.management.MalformedObjectNameException
        Creates the ObjectName for the ConnectionPoolMBean object to be registered
        Parameters:
        original - the ObjectName for the DataSource
        Returns:
        the ObjectName for the ConnectionPoolMBean
        Throws:
        javax.management.MalformedObjectNameException - Invalid object name
      • registerJmx

        protected void registerJmx()
        Registers the ConnectionPoolMBean under a unique name based on the ObjectName for the DataSource
      • unregisterJmx

        protected void unregisterJmx()