From: markt Date: Sun, 9 Oct 2011 21:38:17 +0000 (+0000) Subject: Fix various IDE warings X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=43f74dc55401072219a72c0ec56bd5456e56a403;p=tomcat7.0 Fix various IDE warings - add missing @Override - remove unused code - avoid auto-(un)boxing - fix some generics issues git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1180721 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java b/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java index 786d81925..7614b25ff 100644 --- a/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java +++ b/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java @@ -1428,7 +1428,7 @@ public abstract class AbstractReplicatedMap extends ConcurrentHashMap implements } } - protected Member[] readMembers(ObjectInput in) throws IOException, ClassNotFoundException { + protected Member[] readMembers(ObjectInput in) throws IOException { int nodecount = in.readInt(); Member[] members = new Member[nodecount]; for ( int i=0; i it = (selector!=null)?selector.selectedKeys().iterator():null; // look at each key in the selected set - while (selector!=null && it.hasNext()) { + while (it!=null && it.hasNext()) { SelectionKey key = it.next(); // Is a new connection coming in? if (key.isAcceptable()) { diff --git a/java/org/apache/catalina/tribes/util/ExecutorFactory.java b/java/org/apache/catalina/tribes/util/ExecutorFactory.java index ca33d02ca..944e01472 100644 --- a/java/org/apache/catalina/tribes/util/ExecutorFactory.java +++ b/java/org/apache/catalina/tribes/util/ExecutorFactory.java @@ -17,10 +17,8 @@ package org.apache.catalina.tribes.util; -import java.util.Collection; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -51,23 +49,10 @@ public class ExecutorFactory { super(); } - public TaskQueue(int initialCapacity) { - super(initialCapacity); - } - - public TaskQueue(Collection c) { - super(c); - } - public void setParent(ThreadPoolExecutor tp) { parent = tp; } - public boolean force(Runnable o) { - if ( parent.isShutdown() ) throw new RejectedExecutionException("Executor not running, can't force a command into the queue"); - return super.offer(o); //forces the item onto the queue, to be used if the task is rejected - } - @Override public boolean offer(Runnable o) { //we can't do any checks diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java index 5fd7007c5..2ee0b9331 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java @@ -48,6 +48,7 @@ import org.apache.juli.logging.LogFactory; public class GenericNamingResourcesFactory implements ObjectFactory { private static final Log log = LogFactory.getLog(GenericNamingResourcesFactory.class); + @Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception { if ((obj == null) || !(obj instanceof Reference)) { return null; @@ -171,7 +172,7 @@ public class GenericNamingResourcesFactory implements ObjectFactory { params[1] = value; if (setPropertyMethodBool != null) { try { - return (Boolean) setPropertyMethodBool.invoke(o, params); + return ((Boolean) setPropertyMethodBool.invoke(o, params)).booleanValue(); }catch (IllegalArgumentException biae) { //the boolean method had the wrong //parameter types. lets try the other diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java index 232a829fe..9ebc2635b 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java @@ -651,8 +651,10 @@ public class ConnectionPool { protected PooledConnection createConnection(long now, PooledConnection notUsed, String username, String password) throws SQLException { //no connections where available we'll create one PooledConnection con = create(false); - if (username!=null) con.getAttributes().put(con.PROP_USER, username); - if (password!=null) con.getAttributes().put(con.PROP_PASSWORD, password); + if (username!=null) con.getAttributes().put( + PooledConnection.PROP_USER, username); + if (password!=null) con.getAttributes().put( + PooledConnection.PROP_PASSWORD, password); boolean error = false; try { //connect and validate the connection @@ -1075,6 +1077,7 @@ public class ConnectionPool { /** * {@inheritDoc} */ + @Override public boolean cancel(boolean mayInterruptIfRunning) { if (pc!=null) { return false; @@ -1088,6 +1091,7 @@ public class ConnectionPool { /** * {@inheritDoc} */ + @Override public Connection get() throws InterruptedException, ExecutionException { try { return get(Long.MAX_VALUE, TimeUnit.MILLISECONDS); @@ -1099,6 +1103,7 @@ public class ConnectionPool { /** * {@inheritDoc} */ + @Override public Connection get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { PooledConnection pc = this.pc!=null?this.pc:pcFuture.get(timeout,unit); if (pc!=null) { @@ -1126,6 +1131,7 @@ public class ConnectionPool { /** * {@inheritDoc} */ + @Override public boolean isCancelled() { return pc==null && (pcFuture.isCancelled() || cancelled.get()); } @@ -1133,6 +1139,7 @@ public class ConnectionPool { /** * {@inheritDoc} */ + @Override public boolean isDone() { return pc!=null || pcFuture.isDone(); } @@ -1140,6 +1147,7 @@ public class ConnectionPool { /** * run method to be executed when cancelled by an executor */ + @Override public void run() { try { Connection con = get(); //complete this future diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java index f35df2fb3..65bd6c5fd 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSource.java @@ -67,6 +67,7 @@ public class DataSource extends DataSourceProxy implements javax.sql.DataSource, * Unregisters the underlying connection pool mbean.
* {@inheritDoc} */ + @Override public void postDeregister() { if (oname!=null) unregisterJmx(); } @@ -75,6 +76,7 @@ public class DataSource extends DataSourceProxy implements javax.sql.DataSource, * no-op
* {@inheritDoc} */ + @Override public void postRegister(Boolean registrationDone) { // NOOP } @@ -84,6 +86,7 @@ public class DataSource extends DataSourceProxy implements javax.sql.DataSource, * no-op
* {@inheritDoc} */ + @Override public void preDeregister() throws Exception { // NOOP } @@ -92,6 +95,7 @@ public class DataSource extends DataSourceProxy implements javax.sql.DataSource, * If the connection pool MBean exists, it will be registered during this operation.
* {@inheritDoc} */ + @Override public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception { try { this.oname = createObjectName(name); diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java index 1228b1dd1..d7435787a 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java @@ -17,7 +17,6 @@ package org.apache.tomcat.jdbc.pool; -import java.io.IOException; import java.sql.Connection; import java.util.Hashtable; import java.util.Properties; @@ -183,6 +182,7 @@ public class DataSourceFactory implements ObjectFactory { * * @exception Exception if an exception occurs creating the instance */ + @Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception { @@ -224,7 +224,7 @@ public class DataSourceFactory implements ObjectFactory { return createDataSource(properties,nameCtx,XA); } - public static PoolConfiguration parsePoolProperties(Properties properties) throws IOException{ + public static PoolConfiguration parsePoolProperties(Properties properties) { PoolConfiguration poolProperties = new PoolProperties(); String value = null; @@ -516,7 +516,7 @@ public class DataSourceFactory implements ObjectFactory { } if (jndiDS==null) { try { - context = (Context) (new InitialContext()); + context = new InitialContext(); jndiDS = context.lookup(poolProperties.getDataSourceJNDI()); } catch (NamingException e) { log.warn("The name \""+poolProperties.getDataSourceJNDI()+"\" can not be found in the InitialContext."); @@ -533,7 +533,7 @@ public class DataSourceFactory implements ObjectFactory { * @return Properties * @throws Exception */ - static protected Properties getProperties(String propText) throws IOException { + static protected Properties getProperties(String propText) { return PoolProperties.getProperties(propText,null); } diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java index 85f882c0f..38fa66c6d 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java @@ -206,6 +206,7 @@ public class DataSourceProxy implements PoolConfiguration { } + @Override public String toString() { return super.toString()+"{"+getPoolProperties()+"}"; } @@ -219,6 +220,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getPoolName() { return pool.getName(); } @@ -232,6 +234,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setDriverClassName(String driverClassName) { this.poolProperties.setDriverClassName(driverClassName); } @@ -240,6 +243,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setInitialSize(int initialSize) { this.poolProperties.setInitialSize(initialSize); } @@ -248,6 +252,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setInitSQL(String initSQL) { this.poolProperties.setInitSQL(initSQL); } @@ -256,6 +261,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setLogAbandoned(boolean logAbandoned) { this.poolProperties.setLogAbandoned(logAbandoned); } @@ -264,6 +270,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setMaxActive(int maxActive) { this.poolProperties.setMaxActive(maxActive); } @@ -272,6 +279,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setMaxIdle(int maxIdle) { this.poolProperties.setMaxIdle(maxIdle); } @@ -280,6 +288,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setMaxWait(int maxWait) { this.poolProperties.setMaxWait(maxWait); } @@ -288,6 +297,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis) { this.poolProperties.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); } @@ -296,6 +306,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setMinIdle(int minIdle) { this.poolProperties.setMinIdle(minIdle); } @@ -304,6 +315,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) { this.poolProperties.setNumTestsPerEvictionRun(numTestsPerEvictionRun); } @@ -312,6 +324,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setPassword(String password) { this.poolProperties.setPassword(password); this.poolProperties.getDbProperties().setProperty("password",this.poolProperties.getPassword()); @@ -321,6 +334,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setRemoveAbandoned(boolean removeAbandoned) { this.poolProperties.setRemoveAbandoned(removeAbandoned); } @@ -329,6 +343,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setRemoveAbandonedTimeout(int removeAbandonedTimeout) { this.poolProperties.setRemoveAbandonedTimeout(removeAbandonedTimeout); } @@ -337,6 +352,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setTestOnBorrow(boolean testOnBorrow) { this.poolProperties.setTestOnBorrow(testOnBorrow); } @@ -345,6 +361,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setTestOnConnect(boolean testOnConnect) { this.poolProperties.setTestOnConnect(testOnConnect); } @@ -353,6 +370,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setTestOnReturn(boolean testOnReturn) { this.poolProperties.setTestOnReturn(testOnReturn); } @@ -361,6 +379,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setTestWhileIdle(boolean testWhileIdle) { this.poolProperties.setTestWhileIdle(testWhileIdle); } @@ -369,6 +388,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis) { this.poolProperties.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); } @@ -377,6 +397,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setUrl(String url) { this.poolProperties.setUrl(url); } @@ -385,6 +406,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setUsername(String username) { this.poolProperties.setUsername(username); this.poolProperties.getDbProperties().setProperty("user",getPoolProperties().getUsername()); @@ -394,6 +416,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setValidationInterval(long validationInterval) { this.poolProperties.setValidationInterval(validationInterval); } @@ -402,6 +425,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setValidationQuery(String validationQuery) { this.poolProperties.setValidationQuery(validationQuery); } @@ -410,6 +434,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setValidatorClassName(String className) { this.poolProperties.setValidatorClassName(className); } @@ -418,6 +443,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setJdbcInterceptors(String interceptors) { this.getPoolProperties().setJdbcInterceptors(interceptors); } @@ -426,6 +452,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setJmxEnabled(boolean enabled) { this.getPoolProperties().setJmxEnabled(enabled); } @@ -434,6 +461,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setFairQueue(boolean fairQueue) { this.getPoolProperties().setFairQueue(fairQueue); } @@ -442,6 +470,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setUseLock(boolean useLock) { this.getPoolProperties().setUseLock(useLock); } @@ -450,6 +479,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setDefaultCatalog(String catalog) { this.getPoolProperties().setDefaultCatalog(catalog); } @@ -458,6 +488,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setDefaultAutoCommit(Boolean autocommit) { this.getPoolProperties().setDefaultAutoCommit(autocommit); } @@ -466,6 +497,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setDefaultTransactionIsolation(int defaultTransactionIsolation) { this.getPoolProperties().setDefaultTransactionIsolation(defaultTransactionIsolation); } @@ -474,6 +506,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setConnectionProperties(String properties) { try { java.util.Properties prop = DataSourceFactory @@ -495,6 +528,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setUseEquals(boolean useEquals) { this.getPoolProperties().setUseEquals(useEquals); } @@ -545,6 +579,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getSuspectTimeout() { return getPoolProperties().getSuspectTimeout(); } @@ -553,6 +588,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setSuspectTimeout(int seconds) { getPoolProperties().setSuspectTimeout(seconds); } @@ -661,6 +697,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getConnectionProperties() { return getPoolProperties().getConnectionProperties(); } @@ -669,6 +706,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public Properties getDbProperties() { return getPoolProperties().getDbProperties(); } @@ -677,6 +715,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getDefaultCatalog() { return getPoolProperties().getDefaultCatalog(); } @@ -685,6 +724,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getDefaultTransactionIsolation() { return getPoolProperties().getDefaultTransactionIsolation(); } @@ -693,6 +733,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getDriverClassName() { return getPoolProperties().getDriverClassName(); } @@ -702,6 +743,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getInitialSize() { return getPoolProperties().getInitialSize(); } @@ -710,6 +752,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getInitSQL() { return getPoolProperties().getInitSQL(); } @@ -718,6 +761,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getJdbcInterceptors() { return getPoolProperties().getJdbcInterceptors(); } @@ -726,6 +770,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getMaxActive() { return getPoolProperties().getMaxActive(); } @@ -734,6 +779,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getMaxIdle() { return getPoolProperties().getMaxIdle(); } @@ -742,6 +788,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getMaxWait() { return getPoolProperties().getMaxWait(); } @@ -750,6 +797,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getMinEvictableIdleTimeMillis() { return getPoolProperties().getMinEvictableIdleTimeMillis(); } @@ -758,6 +806,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getMinIdle() { return getPoolProperties().getMinIdle(); } @@ -766,6 +815,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public long getMaxAge() { return getPoolProperties().getMaxAge(); } @@ -774,6 +824,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getName() { return getPoolProperties().getName(); } @@ -782,6 +833,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getNumTestsPerEvictionRun() { return getPoolProperties().getNumTestsPerEvictionRun(); } @@ -789,6 +841,7 @@ public class DataSourceProxy implements PoolConfiguration { /** * @return DOES NOT RETURN THE PASSWORD, IT WOULD SHOW UP IN JMX */ + @Override public String getPassword() { return "Password not available as DataSource/JMX operation."; } @@ -797,6 +850,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getRemoveAbandonedTimeout() { return getPoolProperties().getRemoveAbandonedTimeout(); } @@ -806,6 +860,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getTimeBetweenEvictionRunsMillis() { return getPoolProperties().getTimeBetweenEvictionRunsMillis(); } @@ -814,6 +869,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getUrl() { return getPoolProperties().getUrl(); } @@ -822,6 +878,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getUsername() { return getPoolProperties().getUsername(); } @@ -830,6 +887,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public long getValidationInterval() { return getPoolProperties().getValidationInterval(); } @@ -838,6 +896,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getValidationQuery() { return getPoolProperties().getValidationQuery(); } @@ -846,6 +905,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getValidatorClassName() { return getPoolProperties().getValidatorClassName(); } @@ -854,6 +914,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public Validator getValidator() { return getPoolProperties().getValidator(); } @@ -861,6 +922,7 @@ public class DataSourceProxy implements PoolConfiguration { /** * {@inheritDoc} */ + @Override public void setValidator(Validator validator) { getPoolProperties().setValidator(validator); } @@ -870,6 +932,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isAccessToUnderlyingConnectionAllowed() { return getPoolProperties().isAccessToUnderlyingConnectionAllowed(); } @@ -878,6 +941,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public Boolean isDefaultAutoCommit() { return getPoolProperties().isDefaultAutoCommit(); } @@ -886,6 +950,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public Boolean isDefaultReadOnly() { return getPoolProperties().isDefaultReadOnly(); } @@ -894,6 +959,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isLogAbandoned() { return getPoolProperties().isLogAbandoned(); } @@ -902,6 +968,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isPoolSweeperEnabled() { return getPoolProperties().isPoolSweeperEnabled(); } @@ -910,6 +977,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isRemoveAbandoned() { return getPoolProperties().isRemoveAbandoned(); } @@ -918,6 +986,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getAbandonWhenPercentageFull() { return getPoolProperties().getAbandonWhenPercentageFull(); } @@ -926,6 +995,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isTestOnBorrow() { return getPoolProperties().isTestOnBorrow(); } @@ -934,6 +1004,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isTestOnConnect() { return getPoolProperties().isTestOnConnect(); } @@ -942,6 +1013,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isTestOnReturn() { return getPoolProperties().isTestOnReturn(); } @@ -950,6 +1022,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isTestWhileIdle() { return getPoolProperties().isTestWhileIdle(); } @@ -959,6 +1032,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public Boolean getDefaultAutoCommit() { return getPoolProperties().getDefaultAutoCommit(); } @@ -967,6 +1041,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public Boolean getDefaultReadOnly() { return getPoolProperties().getDefaultReadOnly(); } @@ -975,6 +1050,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public InterceptorDefinition[] getJdbcInterceptorsAsArray() { return getPoolProperties().getJdbcInterceptorsAsArray(); } @@ -983,6 +1059,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean getUseLock() { return getPoolProperties().getUseLock(); } @@ -991,6 +1068,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isFairQueue() { return getPoolProperties().isFairQueue(); } @@ -999,6 +1077,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isJmxEnabled() { return getPoolProperties().isJmxEnabled(); } @@ -1007,6 +1086,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isUseEquals() { return getPoolProperties().isUseEquals(); } @@ -1015,6 +1095,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setAbandonWhenPercentageFull(int percentage) { getPoolProperties().setAbandonWhenPercentageFull(percentage); } @@ -1023,6 +1104,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setAccessToUnderlyingConnectionAllowed(boolean accessToUnderlyingConnectionAllowed) { getPoolProperties().setAccessToUnderlyingConnectionAllowed(accessToUnderlyingConnectionAllowed); } @@ -1031,6 +1113,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setDbProperties(Properties dbProperties) { getPoolProperties().setDbProperties(dbProperties); } @@ -1039,6 +1122,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setDefaultReadOnly(Boolean defaultReadOnly) { getPoolProperties().setDefaultReadOnly(defaultReadOnly); } @@ -1047,6 +1131,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setMaxAge(long maxAge) { getPoolProperties().setMaxAge(maxAge); } @@ -1055,6 +1140,7 @@ public class DataSourceProxy implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setName(String name) { getPoolProperties().setName(name); } @@ -1062,6 +1148,7 @@ public class DataSourceProxy implements PoolConfiguration { /** * {@inheritDoc} */ + @Override public void setDataSource(Object ds) { getPoolProperties().setDataSource(ds); } @@ -1069,6 +1156,7 @@ public class DataSourceProxy implements PoolConfiguration { /** * {@inheritDoc} */ + @Override public Object getDataSource() { return getPoolProperties().getDataSource(); } @@ -1077,6 +1165,7 @@ public class DataSourceProxy implements PoolConfiguration { /** * {@inheritDoc} */ + @Override public void setDataSourceJNDI(String jndiDS) { getPoolProperties().setDataSourceJNDI(jndiDS); } @@ -1084,6 +1173,7 @@ public class DataSourceProxy implements PoolConfiguration { /** * {@inheritDoc} */ + @Override public String getDataSourceJNDI() { return getPoolProperties().getDataSourceJNDI(); } @@ -1091,6 +1181,7 @@ public class DataSourceProxy implements PoolConfiguration { /** * {@inheritDoc} */ + @Override public boolean isAlternateUsernameAllowed() { return getPoolProperties().isAlternateUsernameAllowed(); } @@ -1098,6 +1189,7 @@ public class DataSourceProxy implements PoolConfiguration { /** * {@inheritDoc} */ + @Override public void setAlternateUsernameAllowed(boolean alternateUsernameAllowed) { getPoolProperties().setAlternateUsernameAllowed(alternateUsernameAllowed); } diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java index ea56e8671..8e147dcff 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java @@ -88,6 +88,7 @@ public class FairBlockingQueue implements BlockingQueue { * Will always return true, queue is unbounded. * {@inheritDoc} */ + @Override public boolean offer(E e) { //during the offer, we will grab the main lock final ReentrantLock lock = this.lock; @@ -119,6 +120,7 @@ public class FairBlockingQueue implements BlockingQueue { * Once a lock has been acquired, the * {@inheritDoc} */ + @Override public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException { return offer(e); } @@ -128,6 +130,7 @@ public class FairBlockingQueue implements BlockingQueue { * Objects are returned in the order the threads requested them. * {@inheritDoc} */ + @Override public E poll(long timeout, TimeUnit unit) throws InterruptedException { E result = null; final ReentrantLock lock = this.lock; @@ -203,6 +206,7 @@ public class FairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public boolean remove(Object e) { final ReentrantLock lock = this.lock; lock.lock(); @@ -216,6 +220,7 @@ public class FairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public int size() { return items.size(); } @@ -223,6 +228,7 @@ public class FairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public Iterator iterator() { return new FairIterator(); } @@ -230,6 +236,7 @@ public class FairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public E poll() { final ReentrantLock lock = this.lock; lock.lock(); @@ -243,6 +250,7 @@ public class FairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public boolean contains(Object e) { final ReentrantLock lock = this.lock; lock.lock(); @@ -260,6 +268,7 @@ public class FairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public boolean add(E e) { return offer(e); } @@ -268,6 +277,7 @@ public class FairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public int drainTo(Collection c, int maxElements) { throw new UnsupportedOperationException("int drainTo(Collection c, int maxElements)"); } @@ -277,6 +287,7 @@ public class FairBlockingQueue implements BlockingQueue { * @throws UnsupportedOperationException - this operation is not supported */ + @Override public int drainTo(Collection c) { return drainTo(c,Integer.MAX_VALUE); } @@ -284,6 +295,7 @@ public class FairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public void put(E e) throws InterruptedException { offer(e); } @@ -291,6 +303,7 @@ public class FairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public int remainingCapacity() { return Integer.MAX_VALUE - size(); } @@ -298,6 +311,7 @@ public class FairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public E take() throws InterruptedException { return this.poll(Long.MAX_VALUE, TimeUnit.MILLISECONDS); } @@ -305,6 +319,7 @@ public class FairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public boolean addAll(Collection c) { Iterator i = c.iterator(); while (i.hasNext()) { @@ -318,6 +333,7 @@ public class FairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public void clear() { throw new UnsupportedOperationException("void clear()"); @@ -327,6 +343,7 @@ public class FairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public boolean containsAll(Collection c) { throw new UnsupportedOperationException("boolean containsAll(Collection c)"); } @@ -334,6 +351,7 @@ public class FairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public boolean isEmpty() { return size() == 0; } @@ -342,6 +360,7 @@ public class FairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public boolean removeAll(Collection c) { throw new UnsupportedOperationException("boolean removeAll(Collection c)"); } @@ -350,6 +369,7 @@ public class FairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public boolean retainAll(Collection c) { throw new UnsupportedOperationException("boolean retainAll(Collection c)"); } @@ -358,6 +378,7 @@ public class FairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public Object[] toArray() { throw new UnsupportedOperationException("Object[] toArray()"); } @@ -366,6 +387,7 @@ public class FairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public T[] toArray(T[] a) { throw new UnsupportedOperationException(" T[] toArray(T[] a)"); } @@ -374,6 +396,7 @@ public class FairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public E element() { throw new UnsupportedOperationException("E element()"); } @@ -382,6 +405,7 @@ public class FairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public E peek() { throw new UnsupportedOperationException("E peek()"); } @@ -390,6 +414,7 @@ public class FairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public E remove() { throw new UnsupportedOperationException("E remove()"); } @@ -412,10 +437,12 @@ public class FairBlockingQueue implements BlockingQueue { this.latch = latch; } + @Override public boolean cancel(boolean mayInterruptIfRunning) { return false; //don't allow cancel for now } + @Override public T get() throws InterruptedException, ExecutionException { if (item!=null) { return item; @@ -427,6 +454,7 @@ public class FairBlockingQueue implements BlockingQueue { } } + @Override public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { if (item!=null) { return item; @@ -439,10 +467,12 @@ public class FairBlockingQueue implements BlockingQueue { } } + @Override public boolean isCancelled() { return false; } + @Override public boolean isDone() { return (item!=null || latch.getItem()!=null); } @@ -484,10 +514,12 @@ public class FairBlockingQueue implements BlockingQueue { lock.unlock(); } } + @Override public boolean hasNext() { return index implements BlockingQueue { return element; } + @Override public void remove() { final ReentrantLock lock = FairBlockingQueue.this.lock; lock.lock(); diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java index 8d8096c5e..254032f89 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java @@ -90,6 +90,7 @@ public abstract class JdbcInterceptor implements InvocationHandler { * {@inheritDoc} */ + @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (getNext()!=null) return getNext().invoke(this,method,args); else throw new NullPointerException(); diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/MultiLockFairBlockingQueue.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/MultiLockFairBlockingQueue.java index f5fd28e83..45a5653df 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/MultiLockFairBlockingQueue.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/MultiLockFairBlockingQueue.java @@ -97,6 +97,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { * Will always return true, queue is unbounded. * {@inheritDoc} */ + @Override public boolean offer(E e) { int idx = getNextPut(); //during the offer, we will grab the main lock @@ -128,6 +129,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { * Once a lock has been acquired, the * {@inheritDoc} */ + @Override public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException { return offer(e); } @@ -137,6 +139,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { * Objects are returned in the order the threads requested them. * {@inheritDoc} */ + @Override public E poll(long timeout, TimeUnit unit) throws InterruptedException { int idx = getNextPoll(); E result = null; @@ -214,6 +217,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public boolean remove(Object e) { for (int idx=0; idx implements BlockingQueue { /** * {@inheritDoc} */ + @Override public int size() { int size = 0; for (int idx=0; idx implements BlockingQueue { /** * {@inheritDoc} */ + @Override public Iterator iterator() { return new FairIterator(); } @@ -249,6 +255,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public E poll() { int idx = getNextPoll(); final ReentrantLock lock = this.locks[idx]; @@ -263,6 +270,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public boolean contains(Object e) { for (int idx=0; idx implements BlockingQueue { /** * {@inheritDoc} */ + @Override public boolean add(E e) { return offer(e); } @@ -286,6 +295,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public int drainTo(Collection c, int maxElements) { throw new UnsupportedOperationException("int drainTo(Collection c, int maxElements)"); } @@ -294,6 +304,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public int drainTo(Collection c) { return drainTo(c,Integer.MAX_VALUE); } @@ -301,6 +312,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public void put(E e) throws InterruptedException { offer(e); } @@ -308,6 +320,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public int remainingCapacity() { return Integer.MAX_VALUE - size(); } @@ -315,6 +328,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public E take() throws InterruptedException { return this.poll(Long.MAX_VALUE, TimeUnit.MILLISECONDS); } @@ -322,6 +336,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public boolean addAll(Collection c) { Iterator i = c.iterator(); while (i.hasNext()) { @@ -335,6 +350,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public void clear() { throw new UnsupportedOperationException("void clear()"); @@ -344,6 +360,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public boolean containsAll(Collection c) { throw new UnsupportedOperationException("boolean containsAll(Collection c)"); } @@ -351,6 +368,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { /** * {@inheritDoc} */ + @Override public boolean isEmpty() { return size() == 0; } @@ -359,6 +377,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public boolean removeAll(Collection c) { throw new UnsupportedOperationException("boolean removeAll(Collection c)"); } @@ -367,6 +386,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public boolean retainAll(Collection c) { throw new UnsupportedOperationException("boolean retainAll(Collection c)"); } @@ -375,6 +395,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public Object[] toArray() { throw new UnsupportedOperationException("Object[] toArray()"); } @@ -383,6 +404,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public T[] toArray(T[] a) { throw new UnsupportedOperationException(" T[] toArray(T[] a)"); } @@ -391,6 +413,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public E element() { throw new UnsupportedOperationException("E element()"); } @@ -399,6 +422,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public E peek() { throw new UnsupportedOperationException("E peek()"); } @@ -407,6 +431,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { * {@inheritDoc} * @throws UnsupportedOperationException - this operation is not supported */ + @Override public E remove() { throw new UnsupportedOperationException("E remove()"); } @@ -429,10 +454,12 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { this.latch = latch; } + @Override public boolean cancel(boolean mayInterruptIfRunning) { return false; //don't allow cancel for now } + @Override public T get() throws InterruptedException, ExecutionException { if (item!=null) { return item; @@ -444,6 +471,7 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { } } + @Override public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { if (item!=null) { return item; @@ -456,10 +484,12 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { } } + @Override public boolean isCancelled() { return false; } + @Override public boolean isDone() { return (item!=null || latch.getItem()!=null); } @@ -507,10 +537,12 @@ public class MultiLockFairBlockingQueue implements BlockingQueue { elements = (E[]) new Object[list.size()]; list.toArray(elements); } + @Override public boolean hasNext() { return index implements BlockingQueue { return element; } + @Override public void remove() { for (int idx=0; idx100) abandonWhenPercentageFull = 100; @@ -99,6 +100,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getAbandonWhenPercentageFull() { return abandonWhenPercentageFull; } @@ -107,6 +109,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isFairQueue() { return fairQueue; } @@ -115,6 +118,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setFairQueue(boolean fairQueue) { this.fairQueue = fairQueue; } @@ -123,6 +127,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isAccessToUnderlyingConnectionAllowed() { return accessToUnderlyingConnectionAllowed; } @@ -131,6 +136,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getConnectionProperties() { return connectionProperties; } @@ -139,6 +145,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public Properties getDbProperties() { return dbProperties; } @@ -147,6 +154,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public Boolean isDefaultAutoCommit() { return defaultAutoCommit; } @@ -155,6 +163,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getDefaultCatalog() { return defaultCatalog; } @@ -163,6 +172,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public Boolean isDefaultReadOnly() { return defaultReadOnly; } @@ -171,6 +181,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getDefaultTransactionIsolation() { return defaultTransactionIsolation; } @@ -179,6 +190,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getDriverClassName() { return driverClassName; } @@ -187,6 +199,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getInitialSize() { return initialSize; } @@ -195,6 +208,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isLogAbandoned() { return logAbandoned; } @@ -203,6 +217,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getMaxActive() { return maxActive; } @@ -211,6 +226,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getMaxIdle() { return maxIdle; } @@ -219,6 +235,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getMaxWait() { return maxWait; } @@ -227,6 +244,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getMinEvictableIdleTimeMillis() { return minEvictableIdleTimeMillis; } @@ -235,6 +253,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getMinIdle() { return minIdle; } @@ -243,6 +262,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getName() { return name; } @@ -251,6 +271,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getNumTestsPerEvictionRun() { return numTestsPerEvictionRun; } @@ -259,6 +280,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getPassword() { return password; } @@ -267,6 +289,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getPoolName() { return getName(); } @@ -275,6 +298,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isRemoveAbandoned() { return removeAbandoned; } @@ -283,6 +307,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getRemoveAbandonedTimeout() { return removeAbandonedTimeout; } @@ -291,6 +316,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isTestOnBorrow() { return testOnBorrow; } @@ -299,6 +325,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isTestOnReturn() { return testOnReturn; } @@ -307,6 +334,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isTestWhileIdle() { return testWhileIdle; } @@ -315,6 +343,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getTimeBetweenEvictionRunsMillis() { return timeBetweenEvictionRunsMillis; } @@ -323,6 +352,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getUrl() { return url; } @@ -331,6 +361,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getUsername() { return username; } @@ -339,6 +370,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getValidationQuery() { return validationQuery; } @@ -347,6 +379,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getValidatorClassName() { return validatorClassName; } @@ -355,6 +388,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public Validator getValidator() { return validator; } @@ -362,6 +396,7 @@ public class PoolProperties implements PoolConfiguration { /** * {@inheritDoc} */ + @Override public void setValidator(Validator validator) { this.validator = validator; if (validator!=null) { @@ -376,6 +411,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public long getValidationInterval() { return validationInterval; } @@ -384,6 +420,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getInitSQL() { return initSQL; } @@ -392,6 +429,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isTestOnConnect() { return testOnConnect; } @@ -400,6 +438,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public String getJdbcInterceptors() { return jdbcInterceptors; } @@ -408,6 +447,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public InterceptorDefinition[] getJdbcInterceptorsAsArray() { if (interceptors == null) { if (jdbcInterceptors==null) { @@ -445,6 +485,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setAccessToUnderlyingConnectionAllowed(boolean accessToUnderlyingConnectionAllowed) { // NOOP } @@ -453,6 +494,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setConnectionProperties(String connectionProperties) { this.connectionProperties = connectionProperties; getProperties(connectionProperties, getDbProperties()); @@ -462,6 +504,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setDbProperties(Properties dbProperties) { this.dbProperties = dbProperties; } @@ -470,6 +513,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setDefaultAutoCommit(Boolean defaultAutoCommit) { this.defaultAutoCommit = defaultAutoCommit; } @@ -478,6 +522,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setDefaultCatalog(String defaultCatalog) { this.defaultCatalog = defaultCatalog; } @@ -486,6 +531,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setDefaultReadOnly(Boolean defaultReadOnly) { this.defaultReadOnly = defaultReadOnly; } @@ -494,6 +540,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setDefaultTransactionIsolation(int defaultTransactionIsolation) { this.defaultTransactionIsolation = defaultTransactionIsolation; } @@ -502,6 +549,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setDriverClassName(String driverClassName) { this.driverClassName = driverClassName; } @@ -510,6 +558,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setInitialSize(int initialSize) { this.initialSize = initialSize; } @@ -518,6 +567,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setLogAbandoned(boolean logAbandoned) { this.logAbandoned = logAbandoned; } @@ -526,6 +576,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setMaxActive(int maxActive) { this.maxActive = maxActive; } @@ -534,6 +585,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setMaxIdle(int maxIdle) { this.maxIdle = maxIdle; } @@ -542,6 +594,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setMaxWait(int maxWait) { this.maxWait = maxWait; } @@ -550,6 +603,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis) { this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis; } @@ -558,6 +612,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setMinIdle(int minIdle) { this.minIdle = minIdle; } @@ -566,6 +621,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setName(String name) { this.name = name; } @@ -574,6 +630,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) { this.numTestsPerEvictionRun = numTestsPerEvictionRun; } @@ -582,6 +639,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setPassword(String password) { this.password = password; } @@ -590,6 +648,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setRemoveAbandoned(boolean removeAbandoned) { this.removeAbandoned = removeAbandoned; } @@ -598,6 +657,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setRemoveAbandonedTimeout(int removeAbandonedTimeout) { this.removeAbandonedTimeout = removeAbandonedTimeout; } @@ -606,6 +666,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setTestOnBorrow(boolean testOnBorrow) { this.testOnBorrow = testOnBorrow; } @@ -614,6 +675,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setTestWhileIdle(boolean testWhileIdle) { this.testWhileIdle = testWhileIdle; } @@ -622,6 +684,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setTestOnReturn(boolean testOnReturn) { this.testOnReturn = testOnReturn; } @@ -630,6 +693,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis) { this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis; @@ -639,6 +703,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setUrl(String url) { this.url = url; } @@ -647,6 +712,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setUsername(String username) { this.username = username; } @@ -655,6 +721,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setValidationInterval(long validationInterval) { this.validationInterval = validationInterval; } @@ -663,6 +730,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setValidationQuery(String validationQuery) { this.validationQuery = validationQuery; } @@ -671,6 +739,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setValidatorClassName(String className) { this.validatorClassName = className; @@ -699,6 +768,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setInitSQL(String initSQL) { this.initSQL = initSQL; } @@ -707,6 +777,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setTestOnConnect(boolean testOnConnect) { this.testOnConnect = testOnConnect; } @@ -715,12 +786,14 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setJdbcInterceptors(String jdbcInterceptors) { this.jdbcInterceptors = jdbcInterceptors; this.interceptors = null; } + @Override public String toString() { StringBuilder buf = new StringBuilder("ConnectionPool["); try { @@ -759,6 +832,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isJmxEnabled() { return jmxEnabled; } @@ -767,6 +841,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setJmxEnabled(boolean jmxEnabled) { this.jmxEnabled = jmxEnabled; } @@ -775,6 +850,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public Boolean getDefaultAutoCommit() { return defaultAutoCommit; } @@ -783,6 +859,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public Boolean getDefaultReadOnly() { return defaultReadOnly; } @@ -792,6 +869,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public int getSuspectTimeout() { return this.suspectTimeout; } @@ -800,6 +878,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setSuspectTimeout(int seconds) { this.suspectTimeout = seconds; } @@ -808,6 +887,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isPoolSweeperEnabled() { boolean timer = getTimeBetweenEvictionRunsMillis()>0; boolean result = timer && (isRemoveAbandoned() && getRemoveAbandonedTimeout()>0); @@ -951,10 +1031,12 @@ public class PoolProperties implements PoolConfiguration { } } + @Override public int hashCode() { return name.hashCode(); } + @Override public boolean equals(Object o) { if (o==this) return true; if (o instanceof InterceptorProperty) { @@ -969,6 +1051,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean isUseEquals() { return useEquals; } @@ -977,6 +1060,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setUseEquals(boolean useEquals) { this.useEquals = useEquals; } @@ -985,6 +1069,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public long getMaxAge() { return maxAge; } @@ -993,6 +1078,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setMaxAge(long maxAge) { this.maxAge = maxAge; } @@ -1001,6 +1087,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public boolean getUseLock() { return useLock; } @@ -1009,6 +1096,7 @@ public class PoolProperties implements PoolConfiguration { * {@inheritDoc} */ + @Override public void setUseLock(boolean useLock) { this.useLock = useLock; } @@ -1017,6 +1105,7 @@ public class PoolProperties implements PoolConfiguration { /** * {@inheritDoc} */ + @Override public void setDataSource(Object ds) { this.dataSource = ds; } @@ -1024,6 +1113,7 @@ public class PoolProperties implements PoolConfiguration { /** * {@inheritDoc} */ + @Override public Object getDataSource() { return dataSource; } @@ -1032,6 +1122,7 @@ public class PoolProperties implements PoolConfiguration { /** * {@inheritDoc} */ + @Override public void setDataSourceJNDI(String jndiDS) { this.dataSourceJNDI = jndiDS; } @@ -1039,6 +1130,7 @@ public class PoolProperties implements PoolConfiguration { /** * {@inheritDoc} */ + @Override public String getDataSourceJNDI() { return this.dataSourceJNDI; } @@ -1059,6 +1151,7 @@ public class PoolProperties implements PoolConfiguration { /** * {@inheritDoc} */ + @Override public boolean isAlternateUsernameAllowed() { return alternateUsernameAllowed; } @@ -1066,6 +1159,7 @@ public class PoolProperties implements PoolConfiguration { /** * {@inheritDoc} */ + @Override public void setAlternateUsernameAllowed(boolean alternateUsernameAllowed) { this.alternateUsernameAllowed = alternateUsernameAllowed; } diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java index 1c36d7c9c..617a26228 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ProxyConnection.java @@ -119,7 +119,7 @@ public class ProxyConnection extends JdbcInterceptor { if (compare(UNWRAP_VAL,method)) { return unwrap((Class)args[0]); } else if (compare(ISWRAPPERFOR_VAL,method)) { - return this.isWrapperFor((Class)args[0]); + return Boolean.valueOf(this.isWrapperFor((Class)args[0])); } try { PooledConnection poolc = connection; diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java index 198cc8a19..42264c410 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java @@ -212,6 +212,7 @@ public abstract class AbstractQueryReport extends AbstractCreateStatementInterce this.query = query; } + @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { //get the name of the method for comparison final String name = method.getName(); diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java index ed4757a7a..317a7a3d0 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java @@ -131,9 +131,7 @@ public class SlowQueryReport extends AbstractQueryReport { //create the map to hold our stats //however TODO we need to improve the eviction //selection - queries = new ConcurrentHashMap() { - - }; + queries = new ConcurrentHashMap(); if (perPoolStats.putIfAbsent(pool.getName(), queries)!=null) { //there already was one queries = SlowQueryReport.perPoolStats.get(pool.getName()); diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java index 433519c90..02f47fd42 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java @@ -70,20 +70,24 @@ public class SlowQueryReportJmx extends SlowQueryReport implements NotificationE //==============================JMX STUFF======================== protected volatile NotificationBroadcasterSupport notifier = new NotificationBroadcasterSupport(); + @Override public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); } + @Override public MBeanNotificationInfo[] getNotificationInfo() { return notifier.getNotificationInfo(); } + @Override public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException { notifier.removeNotificationListener(listener); } + @Override public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException { notifier.removeNotificationListener(listener, filter, handback); @@ -224,6 +228,7 @@ public class SlowQueryReportJmx extends SlowQueryReport implements NotificationE * JMX operation - returns all the queries we have collected. * @return - the slow query report as composite data. */ + @Override public CompositeData[] getSlowQueriesCD() throws OpenDataException { CompositeDataSupport[] result = null; ConcurrentHashMap queries = perPoolStats.get(poolName); diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java index c48474c69..39fc6dbca 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java @@ -123,7 +123,8 @@ public class StatementDecoratorInterceptor extends AbstractCreateStatementInterc Object statement, Constructor constructor, String sql) throws InstantiationException, IllegalAccessException, InvocationTargetException { Object result = null; - StatementProxy statementProxy = new StatementProxy((Statement)statement,sql); + StatementProxy statementProxy = + new StatementProxy((Statement)statement,sql); result = constructor.newInstance(new Object[] { statementProxy }); statementProxy.setActualProxy(result); statementProxy.setConnection(proxy); @@ -198,6 +199,7 @@ public class StatementDecoratorInterceptor extends AbstractCreateStatementInterc delegate = null; } + @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (compare(TOSTRING_VAL,method)) { return toString(); @@ -243,6 +245,7 @@ public class StatementDecoratorInterceptor extends AbstractCreateStatementInterc return result; } + @Override public String toString() { StringBuffer buf = new StringBuffer(StatementProxy.class.getName()); buf.append("[Proxy="); @@ -268,6 +271,7 @@ public class StatementDecoratorInterceptor extends AbstractCreateStatementInterc this.delegate = delegate; } + @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (method.getName().equals("getStatement")) { return this.st; diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java index 6e6100b24..6614822a4 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java @@ -134,26 +134,32 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co // POOL STATS //================================================================= + @Override public int getSize() { return pool.getSize(); } + @Override public int getIdle() { return pool.getIdle(); } + @Override public int getActive() { return pool.getActive(); } + @Override public int getNumIdle() { return getIdle(); } + @Override public int getNumActive() { return getActive(); } + @Override public int getWaitCount() { return pool.getWaitCount(); } @@ -161,14 +167,17 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co //================================================================= // POOL OPERATIONS //================================================================= + @Override public void checkIdle() { pool.checkIdle(); } + @Override public void checkAbandoned() { pool.checkAbandoned(); } + @Override public void testIdle() { pool.testAllIdle(); } @@ -180,67 +189,83 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co //========================================================= + @Override public String getConnectionProperties() { return getPoolProperties().getConnectionProperties(); } + @Override public Properties getDbProperties() { return PoolUtilities.cloneWithoutPassword(getPoolProperties().getDbProperties()); } + @Override public String getDefaultCatalog() { return getPoolProperties().getDefaultCatalog(); } + @Override public int getDefaultTransactionIsolation() { return getPoolProperties().getDefaultTransactionIsolation(); } + @Override public String getDriverClassName() { return getPoolProperties().getDriverClassName(); } + @Override public int getInitialSize() { return getPoolProperties().getInitialSize(); } + @Override public String getInitSQL() { return getPoolProperties().getInitSQL(); } + @Override public String getJdbcInterceptors() { return getPoolProperties().getJdbcInterceptors(); } + @Override public int getMaxActive() { return getPoolProperties().getMaxActive(); } + @Override public int getMaxIdle() { return getPoolProperties().getMaxIdle(); } + @Override public int getMaxWait() { return getPoolProperties().getMaxWait(); } + @Override public int getMinEvictableIdleTimeMillis() { return getPoolProperties().getMinEvictableIdleTimeMillis(); } + @Override public int getMinIdle() { return getPoolProperties().getMinIdle(); } + @Override public long getMaxAge() { return getPoolProperties().getMaxAge(); } + @Override public String getName() { return this.getPoolName(); } + @Override public int getNumTestsPerEvictionRun() { return getPoolProperties().getNumTestsPerEvictionRun(); } @@ -248,31 +273,38 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co /** * @return DOES NOT RETURN THE PASSWORD, IT WOULD SHOW UP IN JMX */ + @Override public String getPassword() { return "Password not available as DataSource/JMX operation."; } + @Override public int getRemoveAbandonedTimeout() { return getPoolProperties().getRemoveAbandonedTimeout(); } + @Override public int getTimeBetweenEvictionRunsMillis() { return getPoolProperties().getTimeBetweenEvictionRunsMillis(); } + @Override public String getUrl() { return getPoolProperties().getUrl(); } + @Override public String getUsername() { return getPoolProperties().getUsername(); } + @Override public long getValidationInterval() { return getPoolProperties().getValidationInterval(); } + @Override public String getValidationQuery() { return getPoolProperties().getValidationQuery(); } @@ -281,6 +313,7 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co * {@inheritDoc} */ + @Override public String getValidatorClassName() { return getPoolProperties().getValidatorClassName(); } @@ -289,283 +322,340 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co * {@inheritDoc} */ + @Override public Validator getValidator() { return getPoolProperties().getValidator(); } + @Override public boolean isAccessToUnderlyingConnectionAllowed() { return getPoolProperties().isAccessToUnderlyingConnectionAllowed(); } + @Override public Boolean isDefaultAutoCommit() { return getPoolProperties().isDefaultAutoCommit(); } + @Override public Boolean isDefaultReadOnly() { return getPoolProperties().isDefaultReadOnly(); } + @Override public boolean isLogAbandoned() { return getPoolProperties().isLogAbandoned(); } + @Override public boolean isPoolSweeperEnabled() { return getPoolProperties().isPoolSweeperEnabled(); } + @Override public boolean isRemoveAbandoned() { return getPoolProperties().isRemoveAbandoned(); } + @Override public int getAbandonWhenPercentageFull() { return getPoolProperties().getAbandonWhenPercentageFull(); } + @Override public boolean isTestOnBorrow() { return getPoolProperties().isTestOnBorrow(); } + @Override public boolean isTestOnConnect() { return getPoolProperties().isTestOnConnect(); } + @Override public boolean isTestOnReturn() { return getPoolProperties().isTestOnReturn(); } + @Override public boolean isTestWhileIdle() { return getPoolProperties().isTestWhileIdle(); } + @Override public Boolean getDefaultAutoCommit() { return getPoolProperties().getDefaultAutoCommit(); } + @Override public Boolean getDefaultReadOnly() { return getPoolProperties().getDefaultReadOnly(); } + @Override public InterceptorDefinition[] getJdbcInterceptorsAsArray() { return getPoolProperties().getJdbcInterceptorsAsArray(); } + @Override public boolean getUseLock() { return getPoolProperties().getUseLock(); } + @Override public boolean isFairQueue() { return getPoolProperties().isFairQueue(); } + @Override public boolean isJmxEnabled() { return getPoolProperties().isJmxEnabled(); } + @Override public boolean isUseEquals() { return getPoolProperties().isUseEquals(); } + @Override public void setAbandonWhenPercentageFull(int percentage) { getPoolProperties().setAbandonWhenPercentageFull(percentage); } + @Override public void setAccessToUnderlyingConnectionAllowed(boolean accessToUnderlyingConnectionAllowed) { getPoolProperties().setAccessToUnderlyingConnectionAllowed(accessToUnderlyingConnectionAllowed); } + @Override public void setDbProperties(Properties dbProperties) { getPoolProperties().setDbProperties(dbProperties); } + @Override public void setDefaultReadOnly(Boolean defaultReadOnly) { getPoolProperties().setDefaultReadOnly(defaultReadOnly); } + @Override public void setMaxAge(long maxAge) { getPoolProperties().setMaxAge(maxAge); } + @Override public void setName(String name) { getPoolProperties().setName(name); } + @Override public String getPoolName() { return getPoolProperties().getName(); } + @Override public void setConnectionProperties(String connectionProperties) { getPoolProperties().setConnectionProperties(connectionProperties); } + @Override public void setDefaultAutoCommit(Boolean defaultAutoCommit) { getPoolProperties().setDefaultAutoCommit(defaultAutoCommit); } + @Override public void setDefaultCatalog(String defaultCatalog) { getPoolProperties().setDefaultCatalog(defaultCatalog); } + @Override public void setDefaultTransactionIsolation(int defaultTransactionIsolation) { getPoolProperties().setDefaultTransactionIsolation(defaultTransactionIsolation); } + @Override public void setDriverClassName(String driverClassName) { getPoolProperties().setDriverClassName(driverClassName); } + @Override public void setFairQueue(boolean fairQueue) { getPoolProperties().setFairQueue(fairQueue); } + @Override public void setInitialSize(int initialSize) { // TODO Auto-generated method stub } + @Override public void setInitSQL(String initSQL) { // TODO Auto-generated method stub } + @Override public void setJdbcInterceptors(String jdbcInterceptors) { // TODO Auto-generated method stub } + @Override public void setJmxEnabled(boolean jmxEnabled) { // TODO Auto-generated method stub } + @Override public void setLogAbandoned(boolean logAbandoned) { // TODO Auto-generated method stub } + @Override public void setMaxActive(int maxActive) { // TODO Auto-generated method stub } + @Override public void setMaxIdle(int maxIdle) { // TODO Auto-generated method stub } + @Override public void setMaxWait(int maxWait) { // TODO Auto-generated method stub } + @Override public void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis) { // TODO Auto-generated method stub } + @Override public void setMinIdle(int minIdle) { // TODO Auto-generated method stub } + @Override public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) { // TODO Auto-generated method stub } + @Override public void setPassword(String password) { // TODO Auto-generated method stub } + @Override public void setRemoveAbandoned(boolean removeAbandoned) { // TODO Auto-generated method stub } + @Override public void setRemoveAbandonedTimeout(int removeAbandonedTimeout) { // TODO Auto-generated method stub } + @Override public void setTestOnBorrow(boolean testOnBorrow) { // TODO Auto-generated method stub } + @Override public void setTestOnConnect(boolean testOnConnect) { // TODO Auto-generated method stub } + @Override public void setTestOnReturn(boolean testOnReturn) { // TODO Auto-generated method stub } + @Override public void setTestWhileIdle(boolean testWhileIdle) { // TODO Auto-generated method stub } + @Override public void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis) { // TODO Auto-generated method stub } + @Override public void setUrl(String url) { // TODO Auto-generated method stub } + @Override public void setUseEquals(boolean useEquals) { // TODO Auto-generated method stub } + @Override public void setUseLock(boolean useLock) { // TODO Auto-generated method stub } + @Override public void setUsername(String username) { // TODO Auto-generated method stub } + @Override public void setValidationInterval(long validationInterval) { // TODO Auto-generated method stub } + @Override public void setValidationQuery(String validationQuery) { // TODO Auto-generated method stub @@ -575,6 +665,7 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co * {@inheritDoc} */ + @Override public void setValidatorClassName(String className) { getPoolProperties().setValidatorClassName(className); } @@ -583,6 +674,7 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co * {@inheritDoc} */ + @Override public int getSuspectTimeout() { return getPoolProperties().getSuspectTimeout(); } @@ -591,6 +683,7 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co * {@inheritDoc} */ + @Override public void setSuspectTimeout(int seconds) { //no op } @@ -598,6 +691,7 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co /** * {@inheritDoc} */ + @Override public void setDataSource(Object ds) { getPoolProperties().setDataSource(ds); } @@ -605,6 +699,7 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co /** * {@inheritDoc} */ + @Override public Object getDataSource() { return getPoolProperties().getDataSource(); } @@ -613,6 +708,7 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co /** * {@inheritDoc} */ + @Override public void setDataSourceJNDI(String jndiDS) { //noop } @@ -620,6 +716,7 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co /** * {@inheritDoc} */ + @Override public String getDataSourceJNDI() { return getPoolProperties().getDataSourceJNDI(); } @@ -627,6 +724,7 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co /** * {@inheritDoc} */ + @Override public boolean isAlternateUsernameAllowed() { return getPoolProperties().isAlternateUsernameAllowed(); } @@ -634,6 +732,7 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co /** * {@inheritDoc} */ + @Override public void setAlternateUsernameAllowed(boolean alternateUsernameAllowed) { //noop } @@ -641,6 +740,7 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co /** * {@inheritDoc} */ + @Override public void setValidator(Validator validator) { //noop } diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPoolMBean.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPoolMBean.java index 7632d37c4..c645b61ce 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPoolMBean.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPoolMBean.java @@ -29,8 +29,6 @@ public interface ConnectionPoolMBean extends PoolConfiguration { public int getActive(); - public boolean isPoolSweeperEnabled(); - public int getNumIdle(); public int getNumActive();