This is an automated email from the ASF dual-hosted git repository. tv pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-jcs.git
The following commit(s) were added to refs/heads/master by this push: new 3e365b68 Using static modifier to normalize methods contract and performance new b1c860c3 Merge pull request #138 from tbw777/static 3e365b68 is described below commit 3e365b68148d9bfe9c2bced4ed3e68d9a45928c9 Author: Andrey Bruykhov <andreybr...@gmail.com> AuthorDate: Fri Feb 3 18:35:47 2023 +0300 Using static modifier to normalize methods contract and performance --- .../disk/jdbc/dsfactory/JndiDataSourceFactory.java | 2 +- .../disk/jdbc/dsfactory/SharedPoolDataSourceFactory.java | 4 ++-- .../auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java | 2 +- .../remote/http/server/AbstractRemoteCacheService.java | 2 +- .../jcs3/auxiliary/remote/server/RemoteCacheServer.java | 4 ++-- .../commons/jcs3/utils/threadpool/ThreadPoolManager.java | 2 +- .../commons/jcs3/jcache/extras/web/JCacheFilter.java | 2 +- .../org/apache/commons/jcs3/jcache/JCSCachingManager.java | 4 ++-- .../apache/commons/jcs3/jcache/cdi/CDIJCacheHelper.java | 14 +++++++------- .../jcs3/jcache/cdi/CacheInvocationContextImpl.java | 2 +- .../jcs3/jcache/cdi/MakeJCacheCDIInterceptorFriendly.java | 2 +- .../jcs/auxiliary/lateral/xmlrpc/LateralXMLRPCSender.java | 2 +- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/dsfactory/JndiDataSourceFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/dsfactory/JndiDataSourceFactory.java index 91f58f12..2f10a6a3 100644 --- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/dsfactory/JndiDataSourceFactory.java +++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/dsfactory/JndiDataSourceFactory.java @@ -159,7 +159,7 @@ public class JndiDataSourceFactory implements DataSourceFactory * @param ctx the context * @throws NamingException */ - private void debugCtx(final Context ctx) throws NamingException + private static void debugCtx(final Context ctx) throws NamingException { log.trace("InitialContext -------------------------------"); final Map<?, ?> env = ctx.getEnvironment(); diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/dsfactory/SharedPoolDataSourceFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/dsfactory/SharedPoolDataSourceFactory.java index 4e817488..ef7f009d 100644 --- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/dsfactory/SharedPoolDataSourceFactory.java +++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/dsfactory/SharedPoolDataSourceFactory.java @@ -108,7 +108,7 @@ public class SharedPoolDataSourceFactory implements DataSourceFactory * @throws SQLException if a property set fails * @return a configured <code>ConnectionPoolDataSource</code> */ - private ConnectionPoolDataSource initCPDS(final JDBCDiskCacheAttributes config) + private static ConnectionPoolDataSource initCPDS(final JDBCDiskCacheAttributes config) throws SQLException { log.debug("Starting initCPDS"); @@ -139,7 +139,7 @@ public class SharedPoolDataSourceFactory implements DataSourceFactory * * @throws SQLException if a property set fails. */ - private void initJdbc2Pool(final InstanceKeyDataSource dataSource, final JDBCDiskCacheAttributes config) + private static void initJdbc2Pool(final InstanceKeyDataSource dataSource, final JDBCDiskCacheAttributes config) throws SQLException { log.debug("Starting initJdbc2Pool"); diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java index bc0a5366..4e74fc19 100644 --- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java +++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/mysql/MySQLDiskCacheFactory.java @@ -140,7 +140,7 @@ public class MySQLDiskCacheFactory /** * This calls the optimizers' optimize table method. This is used by the timer. */ - private void optimizeTable(final MySQLTableOptimizer optimizer) + private static void optimizeTable(final MySQLTableOptimizer optimizer) { if ( optimizer != null ) { diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/server/AbstractRemoteCacheService.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/server/AbstractRemoteCacheService.java index d13db135..09a95d16 100644 --- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/server/AbstractRemoteCacheService.java +++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/http/server/AbstractRemoteCacheService.java @@ -54,7 +54,7 @@ public abstract class AbstractRemoteCacheService<K, V> private int puts; /** The interval at which we will log updates. */ - private final int logInterval = 100; + private final static int logInterval = 100; /** log instance */ private static final Log log = LogManager.getLog( AbstractRemoteCacheService.class ); diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServer.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServer.java index bd79da84..527839d2 100644 --- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServer.java +++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheServer.java @@ -107,7 +107,7 @@ public class RemoteCacheServer<K, V> final IRemoteCacheServerAttributes remoteCacheServerAttributes; /** The interval at which we will log updates. */ - private final int logInterval = 100; + private static final int logInterval = 100; /** An optional event logger */ private transient ICacheEventLogger cacheEventLogger; @@ -178,7 +178,7 @@ public class RemoteCacheServer<K, V> * * @throws CacheException if the configuration cannot be loaded */ - private CompositeCacheManager createCacheManager( final Properties prop ) throws CacheException + private static CompositeCacheManager createCacheManager( final Properties prop ) throws CacheException { final CompositeCacheManager hub = CompositeCacheManager.getUnconfiguredInstance(); hub.configure( prop ); diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/threadpool/ThreadPoolManager.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/threadpool/ThreadPoolManager.java index c8271855..8a7c1617 100644 --- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/threadpool/ThreadPoolManager.java +++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/threadpool/ThreadPoolManager.java @@ -324,7 +324,7 @@ public class ThreadPoolManager * @param defaultPoolConfiguration the default configuration * @return PoolConfiguration */ - private PoolConfiguration loadConfig( final String root, final PoolConfiguration defaultPoolConfiguration ) + private static PoolConfiguration loadConfig( final String root, final PoolConfiguration defaultPoolConfiguration ) { final PoolConfiguration config = defaultPoolConfiguration.clone(); PropertySetter.setProperties( config, props, root + "." ); diff --git a/commons-jcs-jcache-extras/src/main/java/org/apache/commons/jcs3/jcache/extras/web/JCacheFilter.java b/commons-jcs-jcache-extras/src/main/java/org/apache/commons/jcs3/jcache/extras/web/JCacheFilter.java index ce8782df..eaf804c8 100644 --- a/commons-jcs-jcache-extras/src/main/java/org/apache/commons/jcs3/jcache/extras/web/JCacheFilter.java +++ b/commons-jcs-jcache-extras/src/main/java/org/apache/commons/jcs3/jcache/extras/web/JCacheFilter.java @@ -221,7 +221,7 @@ public class JCacheFilter implements Filter return servletRequest.toString(); } - private void checkResponse(final ServletResponse servletResponse) + private static void checkResponse(final ServletResponse servletResponse) { if (servletResponse.isCommitted()) { throw new IllegalStateException("Response committed"); diff --git a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCachingManager.java b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCachingManager.java index 629276ff..3d4706e8 100644 --- a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCachingManager.java +++ b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCachingManager.java @@ -117,7 +117,7 @@ public class JCSCachingManager implements CacheManager delegate.configure(this.properties); } - private Properties readConfig(final URI uri, final ClassLoader loader, final Properties properties) { + private static Properties readConfig(final URI uri, final ClassLoader loader, final Properties properties) { final Properties props = new Properties(); try { if (JCSCachingProvider.DEFAULT_URI.toString().equals(uri.toString()) || uri.toURL().getProtocol().equals("jcs")) @@ -164,7 +164,7 @@ public class JCSCachingManager implements CacheManager return props; } - private void addProperties(final URL url, final Properties aggregator) + private static void addProperties(final URL url, final Properties aggregator) { try (InputStream inStream = url.openStream()) { aggregator.load(inStream); diff --git a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CDIJCacheHelper.java b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CDIJCacheHelper.java index c74105e5..2476f826 100644 --- a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CDIJCacheHelper.java +++ b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CDIJCacheHelper.java @@ -104,7 +104,7 @@ public class CDIJCacheHelper return methodMeta; } - private Class<?> findKeyType(final Object target) + private static Class<?> findKeyType(final Object target) { if (null == target) { @@ -183,7 +183,7 @@ public class CDIJCacheHelper cacheRemoveAll); } - private Integer[] getKeyParameters(final List<Set<Annotation>> annotations) + private static Integer[] getKeyParameters(final List<Set<Annotation>> annotations) { final Collection<Integer> list = new ArrayList<>(); int idx = 0; @@ -208,7 +208,7 @@ public class CDIJCacheHelper return list.toArray(new Integer[0]); } - private Integer getValueParameter(final List<Set<Annotation>> annotations) + private static Integer getValueParameter(final List<Set<Annotation>> annotations) { final int idx = 0; for (final Set<Annotation> set : annotations) @@ -224,7 +224,7 @@ public class CDIJCacheHelper return -1; } - private String defaultName(final Method method, final CacheDefaults defaults, final String cacheName) + private static String defaultName(final Method method, final CacheDefaults defaults, final String cacheName) { if (!cacheName.isEmpty()) { @@ -256,7 +256,7 @@ public class CDIJCacheHelper return name.toString(); } - private CacheDefaults findDefaults(final Class<?> targetType, final Method method) + private static CacheDefaults findDefaults(final Class<?> targetType, final Method method) { if (Proxy.isProxyClass(targetType)) // target doesn't hold annotations { @@ -274,7 +274,7 @@ public class CDIJCacheHelper return extractDefaults(targetType); } - private CacheDefaults extractDefaults(final Class<?> type) + private static CacheDefaults extractDefaults(final Class<?> type) { CacheDefaults annotation = null; Class<?> clazz = type; @@ -397,7 +397,7 @@ public class CDIJCacheHelper return defaultCacheResolverFactory; } - private Integer[] keyParameterIndexes(final Method method) + private static Integer[] keyParameterIndexes(final Method method) { final List<Integer> keys = new LinkedList<>(); final Annotation[][] parameterAnnotations = method.getParameterAnnotations(); diff --git a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CacheInvocationContextImpl.java b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CacheInvocationContextImpl.java index c4b776e2..74f37ba7 100644 --- a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CacheInvocationContextImpl.java +++ b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CacheInvocationContextImpl.java @@ -90,7 +90,7 @@ public class CacheInvocationContextImpl<A extends Annotation> extends CacheMetho return parametersAsArray; } - private CacheInvocationParameterImpl newCacheInvocationParameterImpl(final Class<?> type, final Object arg, + private static CacheInvocationParameterImpl newCacheInvocationParameterImpl(final Class<?> type, final Object arg, final Set<Annotation> annotations, final int i) { return new CacheInvocationParameterImpl(type, arg, annotations, i); } diff --git a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/MakeJCacheCDIInterceptorFriendly.java b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/MakeJCacheCDIInterceptorFriendly.java index 426441f0..b5e3e985 100644 --- a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/MakeJCacheCDIInterceptorFriendly.java +++ b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/MakeJCacheCDIInterceptorFriendly.java @@ -118,7 +118,7 @@ public class MakeJCacheCDIInterceptorFriendly implements Extension } // TODO: make it better for ear+cluster case with CDI 1.0 - private String findIdSuffix() { + private static String findIdSuffix() { // big disadvantage is all deployments of a cluster needs to be in the exact same order but it works with ears if (USE_ID) { return "lib" + id.incrementAndGet(); diff --git a/src/experimental/org/apache/commons/jcs/auxiliary/lateral/xmlrpc/LateralXMLRPCSender.java b/src/experimental/org/apache/commons/jcs/auxiliary/lateral/xmlrpc/LateralXMLRPCSender.java index 6c6623b2..09786a72 100644 --- a/src/experimental/org/apache/commons/jcs/auxiliary/lateral/xmlrpc/LateralXMLRPCSender.java +++ b/src/experimental/org/apache/commons/jcs/auxiliary/lateral/xmlrpc/LateralXMLRPCSender.java @@ -130,7 +130,7 @@ public class LateralXMLRPCSender implements IXMLRPCConstants * @return The addressByName value * @param host */ - private InetAddress getAddressByName( String host ) + private static InetAddress getAddressByName( String host ) { try {