You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by le...@apache.org on 2002/03/28 05:30:29 UTC

cvs commit: jakarta-avalon-excalibur/all/src/scratchpad/org/apache/avalon/excalibur/datasource ResourceLimitingJdbcConnectionPool.java ResourceLimitingJdbcDataSource.java

leif        02/03/27 20:30:29

  Modified:    all      ant.properties.sample build.xml
               all/src/scratchpad/org/apache/avalon/excalibur/datasource
                        ResourceLimitingJdbcConnectionPool.java
                        ResourceLimitingJdbcDataSource.java
  Log:
  Modify the datasource package to use the instrument package rather than altprofile.
  
  Revision  Changes    Path
  1.5       +9 -0      jakarta-avalon-excalibur/all/ant.properties.sample
  
  Index: ant.properties.sample
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/all/ant.properties.sample,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ant.properties.sample	27 Mar 2002 11:01:24 -0000	1.4
  +++ ant.properties.sample	28 Mar 2002 04:30:28 -0000	1.5
  @@ -37,3 +37,12 @@
   # in /usr/lib/j2re1.3, requiring the variable to be set. Note: ${java.home} is
   # the JRE home, not $JAVA_HOME.
   #tools.jar=${java.home}/../j2sdk1.3/lib/tools.jar
  +
  +# --------------------------------------------------
  +#                REQUIRED LIBRARIES
  +# --------------------------------------------------
  +
  +# ----- Excalibur Instrument -----
  +excalibur-instrument.home=../instrument/build/lib
  +excalibur-instrument.jar=${excalibur-instrument.home}/excalibur-instrument-0.1.jar
  +
  
  
  
  1.117     +1 -0      jakarta-avalon-excalibur/all/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/all/build.xml,v
  retrieving revision 1.116
  retrieving revision 1.117
  diff -u -r1.116 -r1.117
  --- build.xml	23 Mar 2002 13:04:25 -0000	1.116
  +++ build.xml	28 Mar 2002 04:30:28 -0000	1.117
  @@ -97,6 +97,7 @@
   
     <path id="project.class.path">
       <pathelement location="${framework.jar}"/>
  +    <pathelement location="${excalibur-instrument.jar}"/>
       <pathelement location="${j2ee.jar}"/>
       <pathelement location="${logkit.jar}"/>
       <pathelement location="${xalan.jar}"/>
  
  
  
  1.6       +70 -74    jakarta-avalon-excalibur/all/src/scratchpad/org/apache/avalon/excalibur/datasource/ResourceLimitingJdbcConnectionPool.java
  
  Index: ResourceLimitingJdbcConnectionPool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/all/src/scratchpad/org/apache/avalon/excalibur/datasource/ResourceLimitingJdbcConnectionPool.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ResourceLimitingJdbcConnectionPool.java	16 Mar 2002 00:05:45 -0000	1.5
  +++ ResourceLimitingJdbcConnectionPool.java	28 Mar 2002 04:30:28 -0000	1.6
  @@ -8,10 +8,10 @@
   package org.apache.avalon.excalibur.datasource;
   
   import java.sql.SQLException;
  -import org.apache.avalon.excalibur.altprofile.CounterProfilePoint;
  -import org.apache.avalon.excalibur.altprofile.Profilable;
  -import org.apache.avalon.excalibur.altprofile.ProfilePoint;
  -import org.apache.avalon.excalibur.altprofile.ValueProfilePoint;
  +import org.apache.avalon.excalibur.instrument.CounterInstrument;
  +import org.apache.avalon.excalibur.instrument.Instrument;
  +import org.apache.avalon.excalibur.instrument.Instrumentable;
  +import org.apache.avalon.excalibur.instrument.ValueInstrument;
   import org.apache.avalon.excalibur.pool.ObjectFactory;
   import org.apache.avalon.excalibur.pool.Poolable;
   import org.apache.avalon.excalibur.pool.ValidatedResourceLimitingPool;
  @@ -25,31 +25,31 @@
    *  connections.
    *
    * @author <a href="mailto:leif@silveregg.co.jp">Leif Mortenson</a>
  - * @version CVS $Revision: 1.5 $ $Date: 2002/03/16 00:05:45 $
  + * @version CVS $Revision: 1.6 $ $Date: 2002/03/28 04:30:28 $
    * @since 4.1
    */
   public class ResourceLimitingJdbcConnectionPool
       extends ValidatedResourceLimitingPool
  -    implements Profilable
  +    implements Instrumentable
   {
  -    public static final String DEFAULT_PROFILABLE_NAME = "pool";
  -    public static final String PROFILE_POINT_NEW_POOLABLES_NAME = "new-poolables";
  -    public static final String PROFILE_POINT_SIZE_NAME = "size";
  -    public static final String PROFILE_POINT_READY_SIZE_NAME = "ready-size";
  +    public static final String DEFAULT_INSTRUMENTABLE_NAME = "pool";
  +    public static final String INSTRUMENT_NEW_POOLABLES_NAME = "new-poolables";
  +    public static final String INSTRUMENT_SIZE_NAME = "size";
  +    public static final String INSTRUMENT_READY_SIZE_NAME = "ready-size";
   
       private boolean m_autoCommit;
   
  -    /** Profilable Name assigned to this Profilable */
  -    private String m_profilableName = DEFAULT_PROFILABLE_NAME;
  +    /** Instrumentable Name assigned to this Instrumentable */
  +    private String m_instrumentableName = DEFAULT_INSTRUMENTABLE_NAME;
   
  -    /** ProfilePoint used to profile the creation of new poolables. */
  -    private CounterProfilePoint m_newPoolableProfilePoint;
  +    /** Instrument used to profile the creation of new poolables. */
  +    private CounterInstrument m_newPoolableInstrument;
   
  -    /** ProfilePoint used to profile the size of the pool. */
  -    private ValueProfilePoint m_poolSizeProfilePoint;
  +    /** Instrument used to profile the size of the pool. */
  +    private ValueInstrument m_poolSizeInstrument;
   
  -    /** ProfilePoint used to profile the ready size of the pool. */
  -    private ValueProfilePoint m_poolReadySizeProfilePoint;
  +    /** Instrument used to profile the ready size of the pool. */
  +    private ValueInstrument m_poolReadySizeInstrument;
   
       /*---------------------------------------------------------------
        * Constructors
  @@ -85,10 +85,10 @@
   
           m_autoCommit = autoCommit;
   
  -        // Initialize the Profiler elements.
  -        m_newPoolableProfilePoint = new CounterProfilePoint( PROFILE_POINT_NEW_POOLABLES_NAME );
  -        m_poolSizeProfilePoint = new ValueProfilePoint( PROFILE_POINT_SIZE_NAME );
  -        m_poolReadySizeProfilePoint = new ValueProfilePoint( PROFILE_POINT_READY_SIZE_NAME );
  +        // Initialize the Instrumentable elements.
  +        m_newPoolableInstrument = new CounterInstrument( INSTRUMENT_NEW_POOLABLES_NAME );
  +        m_poolSizeInstrument = new ValueInstrument( INSTRUMENT_SIZE_NAME );
  +        m_poolReadySizeInstrument = new ValueInstrument( INSTRUMENT_READY_SIZE_NAME );
       }
   
       /*---------------------------------------------------------------
  @@ -111,12 +111,12 @@
           // Set the auto commit flag for new connections.
           conn.setAutoCommit( m_autoCommit );
   
  -        // Notify the Profiler
  -        m_newPoolableProfilePoint.increment();
  -        if( m_poolSizeProfilePoint.isActive() )
  +        // Notify the InstrumentManager
  +        m_newPoolableInstrument.increment();
  +        if( m_poolSizeInstrument.isActive() )
           {
               // Size will not yet have been incremented
  -            m_poolSizeProfilePoint.setValue( this.getSize() + 1 );
  +            m_poolSizeInstrument.setValue( this.getSize() + 1 );
           }
   
           return conn;
  @@ -135,10 +135,10 @@
       {
           super.removePoolable( poolable );
   
  -        // Notify the Profiler
  -        if( m_poolSizeProfilePoint.isActive() )
  +        // Notify the InstrumentManager
  +        if( m_poolSizeInstrument.isActive() )
           {
  -            m_poolSizeProfilePoint.setValue( this.getSize() );
  +            m_poolSizeInstrument.setValue( this.getSize() );
           }
       }
   
  @@ -195,12 +195,12 @@
           //  which result in an exception will not be counted.
           Poolable connection = super.get();
   
  -        // Notify the Profiler
  -        if( m_poolReadySizeProfilePoint.isActive() )
  +        // Notify the InstrumentManager
  +        if( m_poolReadySizeInstrument.isActive() )
           {
               // Value may be slightly off because of synchronization, but
               //  making it 100% accurate is not worth the performance hit.
  -            m_poolReadySizeProfilePoint.setValue( this.getReadySize() );
  +            m_poolReadySizeInstrument.setValue( this.getReadySize() );
           }
   
           return connection;
  @@ -217,79 +217,75 @@
           //  so that the pool size will be correct.
           super.put( connection );
   
  -        // Notify the Profiler
  -        if( m_poolReadySizeProfilePoint.isActive() )
  +        // Notify the InstrumentManager
  +        if( m_poolReadySizeInstrument.isActive() )
           {
               // Value may be slightly off because of synchronization, but
               //  making it 100% accurate is not worth the performance hit.
  -            m_poolReadySizeProfilePoint.setValue( this.getReadySize() );
  +            m_poolReadySizeInstrument.setValue( this.getReadySize() );
           }
       }
   
       /*---------------------------------------------------------------
  -     * Profilable Methods
  +     * Instrumentable Methods
        *-------------------------------------------------------------*/
       /**
  -     * Sets the name for the Profilable.  The Profilable Name is used to
  -     *  uniquely identify the Profilable during the configuration of the
  -     *  Profiler and to gain access to a ProfilableDescriptor through a
  -     *  ProfilerManager.  The value should be a string which does not
  -     *  contain spaces or periods.
  +     * Sets the name for the Instrumentable.  The Instrumentable Name is used
  +     *  to uniquely identify the Instrumentable during the configuration of
  +     *  the InstrumentManager and to gain access to an InstrumentableDescriptor
  +     *  through the InstrumentManager.  The value should be a string which does
  +     *  not contain spaces or periods.
        * <p>
  -     * This value may be set by a parent Profilable, or by the ProfilerManager
  -     *  using the value of the 'profilable' attribute in the configuration
  -     *  of the component.
  +     * This value may be set by a parent Instrumentable, or by the
  +     *  InstrumentManager using the value of the 'instrumentable' attribute in
  +     *  the configuration of the component.
        *
  -     * @param name The name used to identify a Profilable.
  +     * @param name The name used to identify a Instrumentable.
        */
  -    public void setProfilableName( String name )
  +    public void setInstrumentableName( String name )
       {
  -        m_profilableName = name;
  +        m_instrumentableName = name;
       }
   
       /**
  -     * Gets the name of the Profilable.  The Profilable Name is used to
  -     *  uniquely identify the Profilable during the configuration of the
  -     *  Profiler and to gain access to a ProfilableDescriptor through a
  -     *  ProfilerManager.  The value should be a string which does not
  -     *  contain spaces or periods.
  +     * Gets the name of the Instrumentable.
        *
  -     * @return The name used to identify a Profilable.
  +     * @return The name used to identify a Instrumentable.
        */
  -    public String getProfilableName()
  +    public String getInstrumentableName()
       {
  -        return m_profilableName;
  +        return m_instrumentableName;
       }
   
       /**
  -     * Obtain a reference to all the ProfilePoints that the Profilable
  -     * object wishes to expose.  All sampling is done directly through
  -     * the ProfilePoints as opposed to the Profilable interface.
  +     * Obtain a reference to all the Instruments that the Instrumentable object
  +     *  wishes to expose.  All sampling is done directly through the
  +     *  Instruments as opposed to the Instrumentable interface.
        *
  -     * @return An array of the ProfilePoints available for profiling.
  -     *         Should never be null.  If there are no ProfilePoints, then
  -     *         EMPTY_PROFILE_POINT_ARRAY can be returned.  This should
  -     *         never be the case though unless there are child Profilables
  -     *         with ProfilePoints.
  +     * @return An array of the Instruments available for profiling.  Should
  +     *         never be null.  If there are no Instruments, then
  +     *         EMPTY_INSTRUMENT_ARRAY can be returned.  This should never be
  +     *         the case though unless there are child Instrumentables with
  +     *         Instruments.
        */
  -    public ProfilePoint[] getProfilePoints()
  +    public Instrument[] getInstruments()
       {
  -        return new ProfilePoint[]
  -        {m_newPoolableProfilePoint, m_poolSizeProfilePoint, m_poolReadySizeProfilePoint};
  +        return new Instrument[]
  +        {m_newPoolableInstrument, m_poolSizeInstrument, m_poolReadySizeInstrument};
       }
   
       /**
  -     * Any Object which implements Profilable can also make use of other
  -     *  Profilable child objects.  This method is used to tell the Profiler
  -     *  about them.
  +     * Any Object which implements Instrumentable can also make use of other
  +     *  Instrumentable child objects.  This method is used to tell the
  +     *  InstrumentManager about them.
        *
  -     * @return An array of child Profilables.  This method should never
  -     *         return null.  If there are no child Profilables, then
  -     *         EMPTY_PROFILABLE_ARRAY can be returned.
  +     * @return An array of child Instrumentables.  This method should never
  +     *         return null.  If there are no child Instrumentables, then
  +     *         EMPTY_INSTRUMENTABLE_ARRAY can be returned.
        */
  -    public Profilable[] getChildProfilables()
  +    public Instrumentable[] getChildInstrumentables()
       {
  -        return Profilable.EMPTY_PROFILABLE_ARRAY;
  +        return Instrumentable.EMPTY_INSTRUMENTABLE_ARRAY;
       }
   }
   
  
  
  
  1.9       +40 -44    jakarta-avalon-excalibur/all/src/scratchpad/org/apache/avalon/excalibur/datasource/ResourceLimitingJdbcDataSource.java
  
  Index: ResourceLimitingJdbcDataSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/all/src/scratchpad/org/apache/avalon/excalibur/datasource/ResourceLimitingJdbcDataSource.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ResourceLimitingJdbcDataSource.java	16 Mar 2002 00:05:45 -0000	1.8
  +++ ResourceLimitingJdbcDataSource.java	28 Mar 2002 04:30:28 -0000	1.9
  @@ -9,8 +9,8 @@
   
   import java.sql.Connection;
   import java.sql.SQLException;
  -import org.apache.avalon.excalibur.altprofile.Profilable;
  -import org.apache.avalon.excalibur.altprofile.ProfilePoint;
  +import org.apache.avalon.excalibur.instrument.Instrument;
  +import org.apache.avalon.excalibur.instrument.Instrumentable;
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  @@ -129,19 +129,19 @@
    * </ul>
    *
    * @author <a href="mailto:leif@silveregg.co.jp">Leif Mortenson</a>
  - * @version CVS $Revision: 1.8 $ $Date: 2002/03/16 00:05:45 $
  + * @version CVS $Revision: 1.9 $ $Date: 2002/03/28 04:30:28 $
    * @since 4.1
    */
   public class ResourceLimitingJdbcDataSource
       extends AbstractLogEnabled
  -    implements DataSourceComponent, Profilable, Disposable
  +    implements DataSourceComponent, Instrumentable, Disposable
   {
       private boolean m_configured;
       private boolean m_disposed;
       protected ResourceLimitingJdbcConnectionPool m_pool;
   
  -    /** Profilable Name assigned to this Profilable */
  -    private String m_profilableName;
  +    /** Instrumentable Name assigned to this Instrumentable */
  +    private String m_instrumentableName;
   
       /*---------------------------------------------------------------
        * Constructors
  @@ -315,68 +315,64 @@
       }
   
       /*---------------------------------------------------------------
  -     * Profilable Methods
  +     * Instrumentable Methods
        *-------------------------------------------------------------*/
       /**
  -     * Sets the name for the Profilable.  The Profilable Name is used to
  -     *  uniquely identify the Profilable during the configuration of the
  -     *  Profiler and to gain access to a ProfilableDescriptor through a
  -     *  ProfilerManager.  The value should be a string which does not
  -     *  contain spaces or periods.
  +     * Sets the name for the Instrumentable.  The Instrumentable Name is used
  +     *  to uniquely identify the Instrumentable during the configuration of
  +     *  the InstrumentManager and to gain access to an InstrumentableDescriptor
  +     *  through the InstrumentManager.  The value should be a string which does
  +     *  not contain spaces or periods.
        * <p>
  -     * This value may be set by a parent Profilable, or by the ProfilerManager
  -     *  using the value of the 'profilable' attribute in the configuration
  -     *  of the component.
  +     * This value may be set by a parent Instrumentable, or by the
  +     *  InstrumentManager using the value of the 'instrumentable' attribute in
  +     *  the configuration of the component.
        *
  -     * @param name The name used to identify a Profilable.
  +     * @param name The name used to identify a Instrumentable.
        */
  -    public void setProfilableName( String name )
  +    public void setInstrumentableName( String name )
       {
  -        m_profilableName = name;
  +        m_instrumentableName = name;
       }
   
       /**
  -     * Gets the name of the Profilable.  The Profilable Name is used to
  -     *  uniquely identify the Profilable during the configuration of the
  -     *  Profiler and to gain access to a ProfilableDescriptor through a
  -     *  ProfilerManager.  The value should be a string which does not
  -     *  contain spaces or periods.
  +     * Gets the name of the Instrumentable.
        *
  -     * @return The name used to identify a Profilable.
  +     * @return The name used to identify a Instrumentable.
        */
  -    public String getProfilableName()
  +    public String getInstrumentableName()
       {
  -        return m_profilableName;
  +        return m_instrumentableName;
       }
   
       /**
  -     * Obtain a reference to all the ProfilePoints that the Profilable
  -     * object wishes to expose.  All sampling is done directly through
  -     * the ProfilePoints as opposed to the Profilable interface.
  +     * Obtain a reference to all the Instruments that the Instrumentable object
  +     *  wishes to expose.  All sampling is done directly through the
  +     *  Instruments as opposed to the Instrumentable interface.
        *
  -     * @return An array of the ProfilePoints available for profiling.
  -     *         Should never be null.  If there are no ProfilePoints, then
  -     *         EMPTY_PROFILE_POINT_ARRAY can be returned.  This should
  -     *         never be the case though unless there are child Profilables
  -     *         with ProfilePoints.
  +     * @return An array of the Instruments available for profiling.  Should
  +     *         never be null.  If there are no Instruments, then
  +     *         EMPTY_INSTRUMENT_ARRAY can be returned.  This should never be
  +     *         the case though unless there are child Instrumentables with
  +     *         Instruments.
        */
  -    public ProfilePoint[] getProfilePoints()
  +    public Instrument[] getInstruments()
       {
  -        return EMPTY_PROFILE_POINT_ARRAY;
  +        return Instrumentable.EMPTY_INSTRUMENT_ARRAY;
       }
   
       /**
  -     * Any Object which implements Profilable can also make use of other
  -     *  Profilable child objects.  This method is used to tell the Profiler
  -     *  about them.
  +     * Any Object which implements Instrumentable can also make use of other
  +     *  Instrumentable child objects.  This method is used to tell the
  +     *  InstrumentManager about them.
        *
  -     * @return An array of child Profilables.  This method should never
  -     *         return null.  If there are no child Profilables, then
  -     *         EMPTY_PROFILABLE_ARRAY can be returned.
  +     * @return An array of child Instrumentables.  This method should never
  +     *         return null.  If there are no child Instrumentables, then
  +     *         EMPTY_INSTRUMENTABLE_ARRAY can be returned.
        */
  -    public Profilable[] getChildProfilables()
  +    public Instrumentable[] getChildInstrumentables()
       {
  -        return new Profilable[]{m_pool};
  +        return new Instrumentable[]{ m_pool };
       }
   
       /*---------------------------------------------------------------
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>