Repository: commons-dbcp Updated Branches: refs/heads/master 75965fd2a -> 16f001b4e
Better lvar names. Project: http://git-wip-us.apache.org/repos/asf/commons-dbcp/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-dbcp/commit/16f001b4 Tree: http://git-wip-us.apache.org/repos/asf/commons-dbcp/tree/16f001b4 Diff: http://git-wip-us.apache.org/repos/asf/commons-dbcp/diff/16f001b4 Branch: refs/heads/master Commit: 16f001b4ed6a2507861a50f73f5deed8e86bc6ce Parents: 75965fd Author: Gary Gregory <garydgreg...@gmail.com> Authored: Mon Jun 11 09:14:40 2018 -0600 Committer: Gary Gregory <garydgreg...@gmail.com> Committed: Mon Jun 11 09:14:40 2018 -0600 ---------------------------------------------------------------------- .../InstanceKeyDataSourceFactory.java | 168 +++++++++---------- 1 file changed, 84 insertions(+), 84 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/16f001b4/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java b/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java index 15e554f..9c996be 100644 --- a/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java +++ b/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java @@ -47,9 +47,9 @@ abstract class InstanceKeyDataSourceFactory implements ObjectFactory { static synchronized String registerNewInstance(final InstanceKeyDataSource ds) { int max = 0; - final Iterator<String> i = instanceMap.keySet().iterator(); - while (i.hasNext()) { - final String s = i.next(); + final Iterator<String> iterator = instanceMap.keySet().iterator(); + while (iterator.hasNext()) { + final String s = iterator.next(); if (s != null) { try { max = Math.max(max, Integer.parseInt(s)); @@ -118,10 +118,10 @@ abstract class InstanceKeyDataSourceFactory implements ObjectFactory { if (refObj instanceof Reference) { final Reference ref = (Reference) refObj; if (isCorrectClass(ref.getClassName())) { - final RefAddr ra = ref.get("instanceKey"); - if (ra != null && ra.getContent() != null) { + final RefAddr refAddr = ref.get("instanceKey"); + if (refAddr != null && refAddr.getContent() != null) { // object was bound to jndi via Referenceable api. - obj = instanceMap.get(ra.getContent()); + obj = instanceMap.get(refAddr.getContent()); } else { // Tomcat JNDI creates a Reference out of server.xml // <ResourceParam> configuration and passes it to an @@ -148,141 +148,141 @@ abstract class InstanceKeyDataSourceFactory implements ObjectFactory { private void setCommonProperties(final Reference ref, final InstanceKeyDataSource ikds) throws IOException, ClassNotFoundException { - RefAddr ra = ref.get("dataSourceName"); - if (ra != null && ra.getContent() != null) { - ikds.setDataSourceName(ra.getContent().toString()); + RefAddr refAddr = ref.get("dataSourceName"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDataSourceName(refAddr.getContent().toString()); } - ra = ref.get("description"); - if (ra != null && ra.getContent() != null) { - ikds.setDescription(ra.getContent().toString()); + refAddr = ref.get("description"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDescription(refAddr.getContent().toString()); } - ra = ref.get("jndiEnvironment"); - if (ra != null && ra.getContent() != null) { - final byte[] serialized = (byte[]) ra.getContent(); + refAddr = ref.get("jndiEnvironment"); + if (refAddr != null && refAddr.getContent() != null) { + final byte[] serialized = (byte[]) refAddr.getContent(); ikds.setJndiEnvironment((Properties) deserialize(serialized)); } - ra = ref.get("loginTimeout"); - if (ra != null && ra.getContent() != null) { - ikds.setLoginTimeout(Integer.parseInt(ra.getContent().toString())); + refAddr = ref.get("loginTimeout"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setLoginTimeout(Integer.parseInt(refAddr.getContent().toString())); } // Pool properties - ra = ref.get("blockWhenExhausted"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultBlockWhenExhausted(Boolean.valueOf(ra.getContent().toString()).booleanValue()); + refAddr = ref.get("blockWhenExhausted"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultBlockWhenExhausted(Boolean.valueOf(refAddr.getContent().toString()).booleanValue()); } - ra = ref.get("evictionPolicyClassName"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultEvictionPolicyClassName(ra.getContent().toString()); + refAddr = ref.get("evictionPolicyClassName"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultEvictionPolicyClassName(refAddr.getContent().toString()); } // Pool properties - ra = ref.get("lifo"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultLifo(Boolean.valueOf(ra.getContent().toString()).booleanValue()); + refAddr = ref.get("lifo"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultLifo(Boolean.valueOf(refAddr.getContent().toString()).booleanValue()); } - ra = ref.get("maxIdlePerKey"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultMaxIdle(Integer.parseInt(ra.getContent().toString())); + refAddr = ref.get("maxIdlePerKey"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultMaxIdle(Integer.parseInt(refAddr.getContent().toString())); } - ra = ref.get("maxTotalPerKey"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultMaxTotal(Integer.parseInt(ra.getContent().toString())); + refAddr = ref.get("maxTotalPerKey"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultMaxTotal(Integer.parseInt(refAddr.getContent().toString())); } - ra = ref.get("maxWaitMillis"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultMaxWaitMillis(Long.parseLong(ra.getContent().toString())); + refAddr = ref.get("maxWaitMillis"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultMaxWaitMillis(Long.parseLong(refAddr.getContent().toString())); } - ra = ref.get("minEvictableIdleTimeMillis"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultMinEvictableIdleTimeMillis(Long.parseLong(ra.getContent().toString())); + refAddr = ref.get("minEvictableIdleTimeMillis"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultMinEvictableIdleTimeMillis(Long.parseLong(refAddr.getContent().toString())); } - ra = ref.get("minIdlePerKey"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultMinIdle(Integer.parseInt(ra.getContent().toString())); + refAddr = ref.get("minIdlePerKey"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultMinIdle(Integer.parseInt(refAddr.getContent().toString())); } - ra = ref.get("numTestsPerEvictionRun"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultNumTestsPerEvictionRun(Integer.parseInt(ra.getContent().toString())); + refAddr = ref.get("numTestsPerEvictionRun"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultNumTestsPerEvictionRun(Integer.parseInt(refAddr.getContent().toString())); } - ra = ref.get("softMinEvictableIdleTimeMillis"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultSoftMinEvictableIdleTimeMillis(Long.parseLong(ra.getContent().toString())); + refAddr = ref.get("softMinEvictableIdleTimeMillis"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultSoftMinEvictableIdleTimeMillis(Long.parseLong(refAddr.getContent().toString())); } - ra = ref.get("testOnCreate"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultTestOnCreate(Boolean.valueOf(ra.getContent().toString()).booleanValue()); + refAddr = ref.get("testOnCreate"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultTestOnCreate(Boolean.valueOf(refAddr.getContent().toString()).booleanValue()); } - ra = ref.get("testOnBorrow"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultTestOnBorrow(Boolean.valueOf(ra.getContent().toString()).booleanValue()); + refAddr = ref.get("testOnBorrow"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultTestOnBorrow(Boolean.valueOf(refAddr.getContent().toString()).booleanValue()); } - ra = ref.get("testOnReturn"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultTestOnReturn(Boolean.valueOf(ra.getContent().toString()).booleanValue()); + refAddr = ref.get("testOnReturn"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultTestOnReturn(Boolean.valueOf(refAddr.getContent().toString()).booleanValue()); } - ra = ref.get("testWhileIdle"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultTestWhileIdle(Boolean.valueOf(ra.getContent().toString()).booleanValue()); + refAddr = ref.get("testWhileIdle"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultTestWhileIdle(Boolean.valueOf(refAddr.getContent().toString()).booleanValue()); } - ra = ref.get("timeBetweenEvictionRunsMillis"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultTimeBetweenEvictionRunsMillis(Long.parseLong(ra.getContent().toString())); + refAddr = ref.get("timeBetweenEvictionRunsMillis"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultTimeBetweenEvictionRunsMillis(Long.parseLong(refAddr.getContent().toString())); } // Connection factory properties - ra = ref.get("validationQuery"); - if (ra != null && ra.getContent() != null) { - ikds.setValidationQuery(ra.getContent().toString()); + refAddr = ref.get("validationQuery"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setValidationQuery(refAddr.getContent().toString()); } - ra = ref.get("validationQueryTimeout"); - if (ra != null && ra.getContent() != null) { - ikds.setValidationQueryTimeout(Integer.parseInt(ra.getContent().toString())); + refAddr = ref.get("validationQueryTimeout"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setValidationQueryTimeout(Integer.parseInt(refAddr.getContent().toString())); } - ra = ref.get("rollbackAfterValidation"); - if (ra != null && ra.getContent() != null) { - ikds.setRollbackAfterValidation(Boolean.valueOf(ra.getContent().toString()).booleanValue()); + refAddr = ref.get("rollbackAfterValidation"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setRollbackAfterValidation(Boolean.valueOf(refAddr.getContent().toString()).booleanValue()); } - ra = ref.get("maxConnLifetimeMillis"); - if (ra != null && ra.getContent() != null) { - ikds.setMaxConnLifetimeMillis(Long.parseLong(ra.getContent().toString())); + refAddr = ref.get("maxConnLifetimeMillis"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setMaxConnLifetimeMillis(Long.parseLong(refAddr.getContent().toString())); } // Connection properties - ra = ref.get("defaultAutoCommit"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultAutoCommit(Boolean.valueOf(ra.getContent().toString())); + refAddr = ref.get("defaultAutoCommit"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultAutoCommit(Boolean.valueOf(refAddr.getContent().toString())); } - ra = ref.get("defaultTransactionIsolation"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultTransactionIsolation(Integer.parseInt(ra.getContent().toString())); + refAddr = ref.get("defaultTransactionIsolation"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultTransactionIsolation(Integer.parseInt(refAddr.getContent().toString())); } - ra = ref.get("defaultReadOnly"); - if (ra != null && ra.getContent() != null) { - ikds.setDefaultReadOnly(Boolean.valueOf(ra.getContent().toString())); + refAddr = ref.get("defaultReadOnly"); + if (refAddr != null && refAddr.getContent() != null) { + ikds.setDefaultReadOnly(Boolean.valueOf(refAddr.getContent().toString())); } }