You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2021/03/28 14:51:44 UTC

[GitHub] [commons-jcs] arturobernalg opened a new pull request #36: JCS-212 - Redundant local variable

arturobernalg opened a new pull request #36:
URL: https://github.com/apache/commons-jcs/pull/36


   Inline unnecessary local variables, which add nothing to the comprehensibility of a method
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-jcs] tvand commented on a change in pull request #36: JCS-212 - Redundant local variable

Posted by GitBox <gi...@apache.org>.
tvand commented on a change in pull request #36:
URL: https://github.com/apache/commons-jcs/pull/36#discussion_r602905659



##########
File path: commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCacheFactory.java
##########
@@ -222,45 +222,43 @@ protected DataSourceFactory getDataSourceFactory( final JDBCDiskCacheAttributes
         }
 
 
-    	final DataSourceFactory dsFactory = this.dsFactories.computeIfAbsent(poolName, key -> {
-    	    final DataSourceFactory newDsFactory;
-            JDBCDiskCacheAttributes dsConfig = null;
-
-            if (cattr.getConnectionPoolName() == null)
-            {
-                dsConfig = cattr;
-            }
-            else
-            {
-                dsConfig = new JDBCDiskCacheAttributes();
-                final String dsConfigAttributePrefix = POOL_CONFIGURATION_PREFIX + key + ATTRIBUTE_PREFIX;
-                PropertySetter.setProperties( dsConfig,
-                        configProps,
-                        dsConfigAttributePrefix + "." );
-
-                dsConfig.setConnectionPoolName(key);
-            }
-
-            if ( dsConfig.getJndiPath() != null )
-            {
-                newDsFactory = new JndiDataSourceFactory();
-            }
-            else
-            {
-                newDsFactory = new SharedPoolDataSourceFactory();
-            }
-
-            try
-            {
-                newDsFactory.initialize(dsConfig);
-            }
-            catch (final SQLException e)
-            {
-                throw new RuntimeException(e);
-            }
-    	    return newDsFactory;
-    	});
-
-    	return dsFactory;
+        return this.dsFactories.computeIfAbsent(poolName, key -> {

Review comment:
       The formatting is all broken

##########
File path: commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/indexed/IndexedDiskCache.java
##########
@@ -646,8 +646,7 @@ protected void processUpdate(final ICacheElement<K, V> ce)
 
             try
             {
-                final ICacheElement<K, V> readObject = dataFile.readObject(ded);
-                object = readObject;
+                object = dataFile.readObject(ded);

Review comment:
       Please merge master as I just fixed this myself.

##########
File path: commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/threadpool/ThreadPoolManager.java
##########
@@ -250,13 +249,12 @@ public static void dispose()
      */
     public ExecutorService getExecutorService( final String name )
     {
-    	final ExecutorService pool = pools.computeIfAbsent(name, key -> {
-            log.debug( "Creating pool for name [{0}]", key );
-            final PoolConfiguration config = loadConfig( PROP_NAME_ROOT + "." + key, defaultConfig );
-            return createPool( config, "JCS-ThreadPoolManager-" + key + "-" );
-    	});
 
-        return pool;
+        return pools.computeIfAbsent(name, key -> {

Review comment:
       Please check indentation.

##########
File path: commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/threadpool/ThreadPoolManager.java
##########
@@ -270,14 +268,13 @@ public ExecutorService getExecutorService( final String name )
      */
     public ScheduledExecutorService getSchedulerPool( final String name )
     {
-    	final ScheduledExecutorService pool = schedulerPools.computeIfAbsent(name, key -> {
-            log.debug( "Creating scheduler pool for name [{0}]", key );
-            final PoolConfiguration config = loadConfig( PROP_NAME_SCHEDULER_ROOT + "." + key,
-                    defaultSchedulerConfig );
-            return createSchedulerPool( config, "JCS-ThreadPoolManager-" + key + "-", Thread.NORM_PRIORITY );
-    	});
 
-        return pool;
+        return schedulerPools.computeIfAbsent(name, key -> {

Review comment:
       Please check indentation.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-jcs] arturobernalg commented on pull request #36: JCS-212 - Redundant local variable

Posted by GitBox <gi...@apache.org>.
arturobernalg commented on pull request #36:
URL: https://github.com/apache/commons-jcs/pull/36#issuecomment-808945459


   HI @tvand 
   I'm really sorry about the formatting. Don't know what could happened 
   Fixed 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-jcs] tvand merged pull request #36: JCS-212 - Redundant local variable

Posted by GitBox <gi...@apache.org>.
tvand merged pull request #36:
URL: https://github.com/apache/commons-jcs/pull/36


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org