You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2017/07/15 21:25:40 UTC

[Bug 61304] New: Refactoring of BasicDataSource

https://bz.apache.org/bugzilla/show_bug.cgi?id=61304

            Bug ID: 61304
           Summary: Refactoring of BasicDataSource
           Product: Tomcat 9
           Version: 9.0.0.M10
          Hardware: PC
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: lemesmachado@gmail.com
  Target Milestone: -----

Hello everyone.
I was analyzing the modularization of some classes, and I identified that the
class BasicDataSource has an opportunity for cohesion improvement. 
The class Http11Protocol was in the same situation and the problem was solved
as follows: The HttpBaseProtocol class was created, and several get() and set()
methods that were used only to configure the class parameters were moved from
Http11Protocol to HttpBaseProtocol. 
The new class was then accessed through an instance variable in Http11Protocol.
This strategy has cleaned and improved Http11Protocol cohesion.
With this in mind, I would recommend creating a new class:
BasicDataSourceConfig , and moving the following methods:

getTestOnBorrow
getTestOnCreate
getTestWhileIdle
getLifo
getTestOnReturn
getDriverClassLoader
getAbandonedLogWriter
getAbandonedUsageTracking
getCacheState
getConnection
getConnectionInitSqls
getConnectionInitSqlsAsArray
getBasicDataSource
getConnectionProperties
getDefaultAutoCommit
getDefaultCatalog
getDefaultQueryTimeout
getDefaultReadOnly
getDefaultTransactionIsolation
getDisconnectionSqlCodes
getDisconnectionSqlCodesAsArray
getEnableAutoCommitOnReturn
getFastFailValidation
getJmxName
getLogAbandoned
getLogExpiredConnections
getLoginTimeout
getLogWriter
getMaxConnLifetimeMillis
getNumActive
getNumIdle
getParentLogger
getPassword
getRegisteredJmxName
getRemoveAbandonedOnBorrow
getRemoveAbandonedOnMaintenance
getRemoveAbandonedTimeout
getRollbackOnReturn
getUsername
getValidationQuery
getValidationQueryTimeout
getMinIdle
getInitialSize
getNumTestsPerEvictionRun
getMaxOpenPreparedStatements
getMaxIdle
getMaxTotal
getDriver
getMinEvictableIdleTimeMillis
getTimeBetweenEvictionRunsMillis
getSoftMinEvictableIdleTimeMillis
getMaxWaitMillis
setAbandonedLogWriter
setAbandonedUsageTracking
setCacheState
setConnectionInitSqls
setConnectionProperties
setDefaultAutoCommit
setDefaultCatalog
setDefaultQueryTimeout
setDefaultReadOnly
setDefaultTransactionIsolation
setDisconnectionSqlCodes
setEnableAutoCommitOnReturn
setFastFailValidation
setJmxName
setLogAbandoned
setLogExpiredConnections
setLoginTimeout
setLogWriter
setMaxConnLifetimeMillis
setPassword
setRemoveAbandonedOnBorrow
setRemoveAbandonedOnMaintenance
setRemoveAbandonedTimeout
setRollbackOnReturn
setUsername
setValidationQuery
setValidationQueryTimeout
getUrl
getEvictionPolicyClassName
getDriverClassName
setMinEvictableIdleTimeMillis
setDriverClassName
setMaxOpenPreparedStatements
setMaxTotal
setTimeBetweenEvictionRunsMillis
setEvictionPolicyClassName
setMaxWaitMillis
setTestOnCreate
setTestOnReturn
setDriverClassLoader
setMinIdle
setInitialSize
setNumTestsPerEvictionRun
setUrl
setTestOnBorrow
setDriver
setTestWhileIdle
setPoolPreparedStatements
setAccessToUnderlyingConnectionAllowed
setLifo
setMaxIdle
setSoftMinEvictableIdleTimeMillis


from the BasicDataSource.
Those parameters accessed by an instance variable in the BasicDataSource.
Moreover, the orthogonality is the design would be enhanced.

What do you think about that?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61304] Refactoring of BasicDataSource

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61304

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 OS|                            |All
         Resolution|---                         |WONTFIX

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
This code originates in Commons DBCP 2 and is copied into Tomcat (with a little
re-naming). Any suggestions for changes should be made to Commons DBPC 2.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org