Consistent declaration of private static final logger variables
Issue: SPR-11905
(cherry picked from commit c16032b)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -75,7 +75,7 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
|
||||
*/
|
||||
|
||||
/** We use a static Log to avoid serialization issues */
|
||||
private static Log logger = LogFactory.getLog(JdkDynamicAopProxy.class);
|
||||
private static final Log logger = LogFactory.getLog(JdkDynamicAopProxy.class);
|
||||
|
||||
/** Config used to configure this proxy */
|
||||
private final AdvisedSupport advised;
|
||||
@@ -114,7 +114,7 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Creating JDK dynamic proxy: target source is " + this.advised.getTargetSource());
|
||||
}
|
||||
Class[] proxiedInterfaces = AopProxyUtils.completeProxiedInterfaces(this.advised);
|
||||
Class<?>[] proxiedInterfaces = AopProxyUtils.completeProxiedInterfaces(this.advised);
|
||||
findDefinedEqualsAndHashCodeMethods(proxiedInterfaces);
|
||||
return Proxy.newProxyInstance(classLoader, proxiedInterfaces, this);
|
||||
}
|
||||
@@ -124,8 +124,8 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
|
||||
* on the supplied set of interfaces.
|
||||
* @param proxiedInterfaces the interfaces to introspect
|
||||
*/
|
||||
private void findDefinedEqualsAndHashCodeMethods(Class[] proxiedInterfaces) {
|
||||
for (Class proxiedInterface : proxiedInterfaces) {
|
||||
private void findDefinedEqualsAndHashCodeMethods(Class<?>[] proxiedInterfaces) {
|
||||
for (Class<?> proxiedInterface : proxiedInterfaces) {
|
||||
Method[] methods = proxiedInterface.getDeclaredMethods();
|
||||
for (Method method : methods) {
|
||||
if (AopUtils.isEqualsMethod(method)) {
|
||||
@@ -153,7 +153,7 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
|
||||
boolean setProxyContext = false;
|
||||
|
||||
TargetSource targetSource = this.advised.targetSource;
|
||||
Class targetClass = null;
|
||||
Class<?> targetClass = null;
|
||||
Object target = null;
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,7 +38,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public abstract class ValidationUtils {
|
||||
|
||||
private static Log logger = LogFactory.getLog(ValidationUtils.class);
|
||||
private static final Log logger = LogFactory.getLog(ValidationUtils.class);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,7 +54,7 @@ import org.springframework.util.ClassUtils;
|
||||
*/
|
||||
public class LocalVariableTableParameterNameDiscoverer implements ParameterNameDiscoverer {
|
||||
|
||||
private static Log logger = LogFactory.getLog(LocalVariableTableParameterNameDiscoverer.class);
|
||||
private static final Log logger = LogFactory.getLog(LocalVariableTableParameterNameDiscoverer.class);
|
||||
|
||||
// marker object for classes that do not have any debug info
|
||||
private static final Map<Member, String[]> NO_DEBUG_INFO_MAP = Collections.emptyMap();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,26 +30,42 @@ import org.springframework.jdbc.datasource.init.DatabasePopulatorUtils;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Creates a {@link EmbeddedDatabase} instance. Callers are guaranteed that the returned database has been fully
|
||||
* initialized and populated.
|
||||
* Factory for creating {@link EmbeddedDatabase} instances.
|
||||
*
|
||||
* <p>Can be configured:<br>
|
||||
* Call {@link #setDatabaseName(String)} to change the name of the database.<br>
|
||||
* Call {@link #setDatabaseType(EmbeddedDatabaseType)} to set the database type if you wish to use one of the supported types.<br>
|
||||
* Call {@link #setDatabaseConfigurer(EmbeddedDatabaseConfigurer)} to configure support for your own embedded database type.<br>
|
||||
* Call {@link #setDatabasePopulator(DatabasePopulator)} to change the algorithm used to populate the database.<br>
|
||||
* Call {@link #setDataSourceFactory(DataSourceFactory)} to change the type of DataSource used to connect to the database.<br>
|
||||
* Call {@link #getDatabase()} to get the {@link EmbeddedDatabase} instance.<br>
|
||||
* <p>Callers are guaranteed that a returned database has been fully initialized
|
||||
* and populated.
|
||||
*
|
||||
* <p>Can be configured:
|
||||
* <ul>
|
||||
* <li>Call {@link #setDatabaseName(String)} to change the name of the database.
|
||||
* <li>Call {@link #setDatabaseType(EmbeddedDatabaseType)} to set the database
|
||||
* type if you wish to use one of the supported types.
|
||||
* <li>Call {@link #setDatabaseConfigurer(EmbeddedDatabaseConfigurer)} to
|
||||
* configure support for your own embedded database type.
|
||||
* <li>Call {@link #setDatabasePopulator(DatabasePopulator)} to change the
|
||||
* algorithm used to populate the database.
|
||||
* <li>Call {@link #setDataSourceFactory(DataSourceFactory)} to change the type
|
||||
* of {@link DataSource} used to connect to the database.
|
||||
* </ul>
|
||||
*
|
||||
* <p>Call {@link #getDatabase()} to get the {@link EmbeddedDatabase} instance.
|
||||
*
|
||||
* @author Keith Donald
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
* @since 3.0
|
||||
*/
|
||||
public class EmbeddedDatabaseFactory {
|
||||
|
||||
private static Log logger = LogFactory.getLog(EmbeddedDatabaseFactory.class);
|
||||
/**
|
||||
* Default name for an embedded database: "testdb".
|
||||
*/
|
||||
public static final String DEFAULT_DATABASE_NAME = "testdb";
|
||||
|
||||
private String databaseName = "testdb";
|
||||
|
||||
private static final Log logger = LogFactory.getLog(EmbeddedDatabaseFactory.class);
|
||||
|
||||
private String databaseName = DEFAULT_DATABASE_NAME;
|
||||
|
||||
private DataSourceFactory dataSourceFactory = new SimpleDriverDataSourceFactory();
|
||||
|
||||
@@ -61,16 +77,18 @@ public class EmbeddedDatabaseFactory {
|
||||
|
||||
|
||||
/**
|
||||
* Set the name of the database. Defaults to "testdb".
|
||||
* @param databaseName name of the test database
|
||||
* Set the name of the database.
|
||||
* <p>Defaults to {@value #DEFAULT_DATABASE_NAME}.
|
||||
* @param databaseName name of the embedded database
|
||||
*/
|
||||
public void setDatabaseName(String databaseName) {
|
||||
Assert.notNull(databaseName, "Database name is required");
|
||||
Assert.hasText(databaseName, "Database name is required");
|
||||
this.databaseName = databaseName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the factory to use to create the DataSource instance that connects to the embedded database.
|
||||
* Set the factory to use to create the {@link DataSource} instance that
|
||||
* connects to the embedded database.
|
||||
* <p>Defaults to {@link SimpleDriverDataSourceFactory}.
|
||||
*/
|
||||
public void setDataSourceFactory(DataSourceFactory dataSourceFactory) {
|
||||
@@ -79,9 +97,10 @@ public class EmbeddedDatabaseFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the type of embedded database to use. Call this when you wish to configure
|
||||
* one of the pre-supported types. Defaults to HSQL.
|
||||
* @param type the test database type
|
||||
* Set the type of embedded database to use.
|
||||
* <p>Call this when you wish to configure one of the pre-supported types.
|
||||
* <p>Defaults to HSQL.
|
||||
* @param type the database type
|
||||
*/
|
||||
public void setDatabaseType(EmbeddedDatabaseType type) {
|
||||
this.databaseConfigurer = EmbeddedDatabaseConfigurerFactory.getConfigurer(type);
|
||||
@@ -96,15 +115,17 @@ public class EmbeddedDatabaseFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the strategy that will be used to populate the embedded database. Defaults to null.
|
||||
* @see org.springframework.jdbc.datasource.init.DataSourceInitializer#setDatabasePopulator
|
||||
* Set the strategy that will be used to initialize or populate the embedded
|
||||
* database.
|
||||
* <p>Defaults to {@code null}.
|
||||
*/
|
||||
public void setDatabasePopulator(DatabasePopulator populator) {
|
||||
this.databasePopulator = populator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method that returns the embedded database instance.
|
||||
* Factory method that returns the {@link EmbeddedDatabase embedded database}
|
||||
* instance, which is also a {@link DataSource}.
|
||||
*/
|
||||
public EmbeddedDatabase getDatabase() {
|
||||
if (this.dataSource == null) {
|
||||
@@ -115,8 +136,10 @@ public class EmbeddedDatabaseFactory {
|
||||
|
||||
|
||||
/**
|
||||
* Hook to initialize the embedded database. Subclasses may call to force initialization. After calling this method,
|
||||
* {@link #getDataSource()} returns the DataSource providing connectivity to the db.
|
||||
* Hook to initialize the embedded database. Subclasses may call this method
|
||||
* to force initialization.
|
||||
* <p>After calling this method, {@link #getDataSource()} returns the
|
||||
* {@link DataSource} providing connectivity to the database.
|
||||
*/
|
||||
protected void initDatabase() {
|
||||
// Create the embedded database source first
|
||||
@@ -144,8 +167,10 @@ public class EmbeddedDatabaseFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to shutdown the embedded database. Subclasses may call to force shutdown.
|
||||
* After calling, {@link #getDataSource()} returns null. Does nothing if no embedded database has been initialized.
|
||||
* Hook to shutdown the embedded database. Subclasses may call this method
|
||||
* to force shutdown.
|
||||
* <p>After calling, {@link #getDataSource()} returns {@code null}.
|
||||
* <p>Does nothing if no embedded database has been initialized.
|
||||
*/
|
||||
protected void shutdownDatabase() {
|
||||
if (this.dataSource != null) {
|
||||
@@ -155,9 +180,11 @@ public class EmbeddedDatabaseFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook that gets the DataSource that provides the connectivity to the embedded database.
|
||||
* <p>Returns {@code null} if the DataSource has not been initialized or the database
|
||||
* has been shut down. Subclasses may call to access the DataSource instance directly.
|
||||
* Hook that gets the {@link DataSource} that provides the connectivity to the
|
||||
* embedded database.
|
||||
* <p>Returns {@code null} if the {@code DataSource} has not been initialized
|
||||
* or if the database has been shut down. Subclasses may call this method to
|
||||
* access the {@code DataSource} instance directly.
|
||||
*/
|
||||
protected final DataSource getDataSource() {
|
||||
return this.dataSource;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,7 +44,7 @@ import java.util.concurrent.Callable;
|
||||
public class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapter
|
||||
implements DeferredResultProcessingInterceptor {
|
||||
|
||||
private static Log logger = LogFactory.getLog(AsyncRequestInterceptor.class);
|
||||
private static final Log logger = LogFactory.getLog(AsyncRequestInterceptor.class);
|
||||
|
||||
private final SessionFactory sessionFactory;
|
||||
|
||||
@@ -52,11 +52,13 @@ public class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapte
|
||||
|
||||
private volatile boolean timeoutInProgress;
|
||||
|
||||
|
||||
public AsyncRequestInterceptor(SessionFactory sessionFactory, SessionHolder sessionHolder) {
|
||||
this.sessionFactory = sessionFactory;
|
||||
this.sessionHolder = sessionHolder;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public <T> void preProcess(NativeWebRequest request, Callable<T> task) {
|
||||
bindSession();
|
||||
@@ -90,11 +92,17 @@ public class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapte
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Implementation of DeferredResultProcessingInterceptor methods
|
||||
|
||||
public <T> void beforeConcurrentHandling(NativeWebRequest request, DeferredResult<T> deferredResult) { }
|
||||
public <T> void preProcess(NativeWebRequest request, DeferredResult<T> deferredResult) { }
|
||||
public <T> void postProcess(NativeWebRequest request, DeferredResult<T> deferredResult, Object result) { }
|
||||
public <T> void beforeConcurrentHandling(NativeWebRequest request, DeferredResult<T> deferredResult) {
|
||||
}
|
||||
|
||||
public <T> void preProcess(NativeWebRequest request, DeferredResult<T> deferredResult) {
|
||||
}
|
||||
|
||||
public <T> void postProcess(NativeWebRequest request, DeferredResult<T> deferredResult, Object result) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> deferredResult) {
|
||||
@@ -106,4 +114,5 @@ public class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapte
|
||||
public <T> void afterCompletion(NativeWebRequest request, DeferredResult<T> deferredResult) {
|
||||
closeAfterTimeout();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,7 +44,7 @@ import java.util.concurrent.Callable;
|
||||
public class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapter
|
||||
implements DeferredResultProcessingInterceptor {
|
||||
|
||||
private static Log logger = LogFactory.getLog(AsyncRequestInterceptor.class);
|
||||
private static final Log logger = LogFactory.getLog(AsyncRequestInterceptor.class);
|
||||
|
||||
private final EntityManagerFactory emFactory;
|
||||
|
||||
@@ -58,6 +58,7 @@ public class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapte
|
||||
this.emHolder = emHolder;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public <T> void preProcess(NativeWebRequest request, Callable<T> task) {
|
||||
bindSession();
|
||||
@@ -91,11 +92,17 @@ public class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapte
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Implementation of DeferredResultProcessingInterceptor methods
|
||||
|
||||
public <T> void beforeConcurrentHandling(NativeWebRequest request, DeferredResult<T> deferredResult) { }
|
||||
public <T> void preProcess(NativeWebRequest request, DeferredResult<T> deferredResult) { }
|
||||
public <T> void postProcess(NativeWebRequest request, DeferredResult<T> deferredResult, Object result) { }
|
||||
public <T> void beforeConcurrentHandling(NativeWebRequest request, DeferredResult<T> deferredResult) {
|
||||
}
|
||||
|
||||
public <T> void preProcess(NativeWebRequest request, DeferredResult<T> deferredResult) {
|
||||
}
|
||||
|
||||
public <T> void postProcess(NativeWebRequest request, DeferredResult<T> deferredResult, Object result) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> deferredResult) {
|
||||
@@ -107,5 +114,5 @@ public class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapte
|
||||
public <T> void afterCompletion(NativeWebRequest request, DeferredResult<T> deferredResult) {
|
||||
closeAfterTimeout();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,7 +31,7 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||
*/
|
||||
class CallableInterceptorChain {
|
||||
|
||||
private static Log logger = LogFactory.getLog(CallableInterceptorChain.class);
|
||||
private static final Log logger = LogFactory.getLog(CallableInterceptorChain.class);
|
||||
|
||||
private final List<CallableProcessingInterceptor> interceptors;
|
||||
|
||||
@@ -102,4 +102,5 @@ class CallableInterceptorChain {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,7 +29,7 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||
*/
|
||||
class DeferredResultInterceptorChain {
|
||||
|
||||
private static Log logger = LogFactory.getLog(DeferredResultInterceptorChain.class);
|
||||
private static final Log logger = LogFactory.getLog(DeferredResultInterceptorChain.class);
|
||||
|
||||
private final List<DeferredResultProcessingInterceptor> interceptors;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user