diff --git a/changes/en-us/develop.md b/changes/en-us/develop.md index 3766764a22d..af224973635 100644 --- a/changes/en-us/develop.md +++ b/changes/en-us/develop.md @@ -12,8 +12,7 @@ Add changes here for all PR submitted to the develop branch. - [[#5224](https://github.com/seata/seata/pull/5224)] fix oracle initialize script index_name is duplicate - [[#5233](https://github.com/seata/seata/pull/5233)] fix the inconsistent configuration item names related to LoadBalance - [[#5245](https://github.com/seata/seata/pull/5245)] fix the incomplete dependency of distribution module - - +- [[#5239](https://github.com/seata/seata/pull/5239)] fix `getConfig` throw `ClassCastException` when use JDK proxy ### optimize: - [[#5208](https://github.com/seata/seata/pull/5208)] optimize throwable getCause once more @@ -26,7 +25,6 @@ Add changes here for all PR submitted to the develop branch. ### security: - [[#5172](https://github.com/seata/seata/pull/5172)] fix some security vulnerabilities - ### test: - [[#xxx](https://github.com/seata/seata/pull/xxx)] add test for xxx @@ -42,6 +40,7 @@ Thanks to these contributors for their code commits. Please report an unintended - [xingfudeshi](https://github.com/xingfudeshi) - [Bughue](https://github.com/Bughue) - [pengten](https://github.com/pengten) +- [wangliang181230](https://github.com/wangliang181230) Also, we receive many valuable issues, questions and advices from our community. Thanks for you all. diff --git a/changes/zh-cn/develop.md b/changes/zh-cn/develop.md index e4cf69bbdab..2d91a3337d7 100644 --- a/changes/zh-cn/develop.md +++ b/changes/zh-cn/develop.md @@ -12,7 +12,7 @@ - [[#5224](https://github.com/seata/seata/pull/5224)] 修复 oracle初始化脚本索引名重复的问题 - [[#5233](https://github.com/seata/seata/pull/5233)] 修复LoadBalance相关配置不一致的问题 - [[#5245](https://github.com/seata/seata/pull/5245)] 修复不完整的distribution模块依赖 - +- [[#5239](https://github.com/seata/seata/pull/5239)] 修复当使用JDK代理时,`getConfig` 方法获取部分配置时抛出 `ClassCastException` 异常的问题 ### optimize: - [[#5208](https://github.com/seata/seata/pull/5208)] 优化多次重复获取Throwable#getCause问题 @@ -40,6 +40,7 @@ - [xingfudeshi](https://github.com/xingfudeshi) - [Bughue](https://github.com/Bughue) - [pengten](https://github.com/pengten) +- [wangliang181230](https://github.com/wangliang181230) 同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。 diff --git a/common/src/main/java/io/seata/common/DefaultValues.java b/common/src/main/java/io/seata/common/DefaultValues.java index a2086b27587..bf12a6c3668 100644 --- a/common/src/main/java/io/seata/common/DefaultValues.java +++ b/common/src/main/java/io/seata/common/DefaultValues.java @@ -226,7 +226,7 @@ public interface DefaultValues { int DEFAULT_SERVICE_SESSION_RELOAD_READ_SIZE = 100; /** - *the constant DEFAULT_PROMETHEUS_PORT + * the constant DEFAULT_PROMETHEUS_PORT */ int DEFAULT_PROMETHEUS_PORT = 9898; @@ -248,12 +248,12 @@ public interface DefaultValues { /** * the const DEFAULT_MAX_COMMIT_RETRY_TIMEOUT */ - long DEFAULT_MAX_COMMIT_RETRY_TIMEOUT = 100; + long DEFAULT_MAX_COMMIT_RETRY_TIMEOUT = -1L; /** * the const DEFAULT_MAX_ROLLBACK_RETRY_TIMEOUT */ - long DEFAULT_MAX_ROLLBACK_RETRY_TIMEOUT = 100; + long DEFAULT_MAX_ROLLBACK_RETRY_TIMEOUT = -1L; /** * the const DEFAULT_ROLLBACK_RETRY_TIMEOUT_UNLOCK_ENABLE @@ -281,4 +281,9 @@ public interface DefaultValues { int DEFAULT_REDIS_MIN_IDLE = 10; int DEFAULT_QUERY_LIMIT = 1000; + + /** + * Default druid location in classpath + */ + String DRUID_LOCATION = "lib/sqlparser/druid.jar"; } diff --git a/common/src/main/java/io/seata/common/loader/EnhancedServiceLoader.java b/common/src/main/java/io/seata/common/loader/EnhancedServiceLoader.java index 547b7a9cc1a..3b6942c8a40 100644 --- a/common/src/main/java/io/seata/common/loader/EnhancedServiceLoader.java +++ b/common/src/main/java/io/seata/common/loader/EnhancedServiceLoader.java @@ -397,14 +397,12 @@ private S loadExtension(ClassLoader loader, Class[] argTypes, loadAllExtensionClass(loader); ExtensionDefinition defaultExtensionDefinition = getDefaultExtensionDefinition(); return getExtensionInstance(defaultExtensionDefinition, loader, argTypes, args); + } catch (EnhancedServiceNotFoundException e) { + throw e; } catch (Throwable e) { - if (e instanceof EnhancedServiceNotFoundException) { - throw (EnhancedServiceNotFoundException)e; - } else { - throw new EnhancedServiceNotFoundException( - "not found service provider for : " + type.getName() + " caused by " + ExceptionUtils - .getFullStackTrace(e)); - } + throw new EnhancedServiceNotFoundException( + "not found service provider for : " + type.getName() + + " caused by " + ExceptionUtils.getFullStackTrace(e)); } } @@ -519,7 +517,10 @@ private void loadFile(String dir, ClassLoader loader, List 0) { + hasClasses = true; try { ExtensionDefinition extensionDefinition = getUnloadedExtensionDefinition(line, loader); if (extensionDefinition == null) { @@ -540,7 +542,7 @@ private void loadFile(String dir, ClassLoader loader, List getClassByName(String className) throws ClassNotFoundExce return Class.forName(className, true, Thread.currentThread().getContextClassLoader()); } + /** + * Get the wrapped class + * + * @param clazz the class + * @return the wrapped class + */ + public static Class getWrappedClass(Class clazz) { + if (clazz.isPrimitive()) { + if (clazz.equals(byte.class)) { + return Byte.class; + } + if (clazz.equals(boolean.class)) { + return Boolean.class; + } + if (clazz.equals(char.class)) { + return Character.class; + } + if (clazz.equals(short.class)) { + return Short.class; + } + if (clazz.equals(int.class)) { + return Integer.class; + } + if (clazz.equals(long.class)) { + return Long.class; + } + if (clazz.equals(float.class)) { + return Float.class; + } + if (clazz.equals(double.class)) { + return Double.class; + } + if (clazz.equals(void.class)) { + return Void.class; + } + } + + return clazz; + } + //endregion diff --git a/config/seata-config-core/src/main/java/io/seata/config/ConfigurationCache.java b/config/seata-config-core/src/main/java/io/seata/config/ConfigurationCache.java index f887f7810e5..e837ce78fae 100644 --- a/config/seata-config-core/src/main/java/io/seata/config/ConfigurationCache.java +++ b/config/seata-config-core/src/main/java/io/seata/config/ConfigurationCache.java @@ -104,18 +104,18 @@ public Configuration proxy(Configuration originalConfiguration) throws Exception return new ByteBuddy().subclass(Configuration.class).method(ElementMatchers.any()) .intercept(InvocationHandlerAdapter.of((proxy, method, args) -> { String methodName = method.getName(); - if (methodName.startsWith(METHOD_PREFIX) && !method.getName().equalsIgnoreCase(METHOD_LATEST_CONFIG)) { + if (methodName.startsWith(METHOD_PREFIX) && !methodName.equalsIgnoreCase(METHOD_LATEST_CONFIG)) { String rawDataId = (String)args[0]; ObjectWrapper wrapper = CONFIG_CACHE.get(rawDataId); ObjectWrapper.ConfigType type = - ObjectWrapper.getTypeByName(method.getName().substring(METHOD_PREFIX.length())); + ObjectWrapper.getTypeByName(methodName.substring(METHOD_PREFIX.length())); Object defaultValue = null; if (args.length > 1 - && method.getParameterTypes()[1].getSimpleName().equalsIgnoreCase(type.name())) { + && method.getParameterTypes()[1].getSimpleName().equalsIgnoreCase(type.name())) { defaultValue = args[1]; } if (null == wrapper - || (null != defaultValue && !Objects.equals(defaultValue, wrapper.lastDefaultValue))) { + || (null != defaultValue && !Objects.equals(defaultValue, wrapper.lastDefaultValue))) { Object result = method.invoke(originalConfiguration, args); // The wrapper.data only exists in the cache when it is not null. if (result != null) { diff --git a/config/seata-config-core/src/main/java/io/seata/config/ConfigurationFactory.java b/config/seata-config-core/src/main/java/io/seata/config/ConfigurationFactory.java index f71f14198c3..55eb54d3fbc 100644 --- a/config/seata-config-core/src/main/java/io/seata/config/ConfigurationFactory.java +++ b/config/seata-config-core/src/main/java/io/seata/config/ConfigurationFactory.java @@ -69,10 +69,12 @@ private static void load() { LOGGER.info("load Configuration from :{}", extConfiguration == null ? configuration.getClass().getSimpleName() : "Spring Configuration"); } - } catch (EnhancedServiceNotFoundException ignore) { - + } catch (EnhancedServiceNotFoundException e) { + if (LOGGER.isDebugEnabled()) { + LOGGER.warn("failed to load extConfiguration: {}", e.getMessage(), e); + } } catch (Exception e) { - LOGGER.error("failed to load extConfiguration:{}", e.getMessage(), e); + LOGGER.error("failed to load extConfiguration: {}", e.getMessage(), e); } CURRENT_FILE_INSTANCE = extConfiguration == null ? configuration : extConfiguration; } diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/AbstractTableMetaCache.java b/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/AbstractTableMetaCache.java index dccd807f76f..2c1470447a7 100755 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/AbstractTableMetaCache.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/AbstractTableMetaCache.java @@ -44,8 +44,17 @@ public abstract class AbstractTableMetaCache implements TableMetaCache { private static final long EXPIRE_TIME = 900 * 1000; - private static final Cache TABLE_META_CACHE = Caffeine.newBuilder().maximumSize(CACHE_SIZE) - .expireAfterWrite(EXPIRE_TIME, TimeUnit.MILLISECONDS).softValues().build(); + private static final Cache TABLE_META_CACHE; + + static { + try { + TABLE_META_CACHE = Caffeine.newBuilder().maximumSize(CACHE_SIZE) + .expireAfterWrite(EXPIRE_TIME, TimeUnit.MILLISECONDS).softValues().build(); + } catch (Throwable t) { + LOGGER.error("Build the `TABLE_META_CACHE` failed:", t); + throw t; + } + } @Override diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/util/JdbcUtils.java b/rm-datasource/src/main/java/io/seata/rm/datasource/util/JdbcUtils.java index b462bc131dd..2f2e119dbeb 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/util/JdbcUtils.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/util/JdbcUtils.java @@ -104,7 +104,7 @@ public static String buildResourceId(String jdbcUrl) { } public static Driver loadDriver(String driverClassName) throws SQLException { - Class clazz = null; + Class clazz = null; try { ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); if (contextLoader != null) { @@ -124,9 +124,7 @@ public static Driver loadDriver(String driverClassName) throws SQLException { try { return (Driver)clazz.newInstance(); - } catch (IllegalAccessException e) { - throw new SQLException(e.getMessage(), e); - } catch (InstantiationException e) { + } catch (IllegalAccessException | InstantiationException e) { throw new SQLException(e.getMessage(), e); } } diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/io/seata/spring/boot/autoconfigure/properties/ShutdownProperties.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/io/seata/spring/boot/autoconfigure/properties/ShutdownProperties.java index 9010ede0942..8dec76f747a 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/io/seata/spring/boot/autoconfigure/properties/ShutdownProperties.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/io/seata/spring/boot/autoconfigure/properties/ShutdownProperties.java @@ -30,13 +30,13 @@ public class ShutdownProperties { /** * when destroy server, wait seconds */ - private long wait = DEFAULT_SHUTDOWN_TIMEOUT_SEC; + private int wait = DEFAULT_SHUTDOWN_TIMEOUT_SEC; - public long getWait() { + public int getWait() { return wait; } - public ShutdownProperties setWait(long wait) { + public ShutdownProperties setWait(int wait) { this.wait = wait; return this; } diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/io/seata/spring/boot/autoconfigure/properties/config/ConfigZooKeeperProperties.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/io/seata/spring/boot/autoconfigure/properties/config/ConfigZooKeeperProperties.java index 897f97eb5ac..e4c1556b588 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/io/seata/spring/boot/autoconfigure/properties/config/ConfigZooKeeperProperties.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/io/seata/spring/boot/autoconfigure/properties/config/ConfigZooKeeperProperties.java @@ -27,8 +27,8 @@ @ConfigurationProperties(prefix = CONFIG_ZK_PREFIX) public class ConfigZooKeeperProperties { private String serverAddr; - private long sessionTimeout = 6000L; - private long connectTimeout = 2000L; + private int sessionTimeout = 6000; + private int connectTimeout = 2000; private String username; private String password; private String nodePath = "/seata/seata.properties"; @@ -46,16 +46,16 @@ public long getSessionTimeout() { return sessionTimeout; } - public ConfigZooKeeperProperties setSessionTimeout(long sessionTimeout) { + public ConfigZooKeeperProperties setSessionTimeout(int sessionTimeout) { this.sessionTimeout = sessionTimeout; return this; } - public long getConnectTimeout() { + public int getConnectTimeout() { return connectTimeout; } - public ConfigZooKeeperProperties setConnectTimeout(long connectTimeout) { + public ConfigZooKeeperProperties setConnectTimeout(int connectTimeout) { this.connectTimeout = connectTimeout; return this; } diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/io/seata/spring/boot/autoconfigure/properties/registry/RegistryZooKeeperProperties.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/io/seata/spring/boot/autoconfigure/properties/registry/RegistryZooKeeperProperties.java index dcb0c407a86..90c494a9f29 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/io/seata/spring/boot/autoconfigure/properties/registry/RegistryZooKeeperProperties.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/io/seata/spring/boot/autoconfigure/properties/registry/RegistryZooKeeperProperties.java @@ -28,8 +28,8 @@ public class RegistryZooKeeperProperties { private String cluster = "default"; private String serverAddr = "127.0.0.1:2181"; - private long sessionTimeout = 6000L; - private long connectTimeout = 2000L; + private int sessionTimeout = 6000; + private int connectTimeout = 2000; private String username; private String password; @@ -51,20 +51,20 @@ public RegistryZooKeeperProperties setServerAddr(String serverAddr) { return this; } - public long getSessionTimeout() { + public int getSessionTimeout() { return sessionTimeout; } - public RegistryZooKeeperProperties setSessionTimeout(long sessionTimeout) { + public RegistryZooKeeperProperties setSessionTimeout(int sessionTimeout) { this.sessionTimeout = sessionTimeout; return this; } - public long getConnectTimeout() { + public int getConnectTimeout() { return connectTimeout; } - public RegistryZooKeeperProperties setConnectTimeout(long connectTimeout) { + public RegistryZooKeeperProperties setConnectTimeout(int connectTimeout) { this.connectTimeout = connectTimeout; return this; } diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/io/seata/spring/boot/autoconfigure/provider/SpringBootConfigurationProvider.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/io/seata/spring/boot/autoconfigure/provider/SpringBootConfigurationProvider.java index c552a6f0792..5a3c4cdd07c 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/io/seata/spring/boot/autoconfigure/provider/SpringBootConfigurationProvider.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/io/seata/spring/boot/autoconfigure/provider/SpringBootConfigurationProvider.java @@ -16,22 +16,26 @@ package io.seata.spring.boot.autoconfigure.provider; import java.lang.reflect.Field; -import java.util.HashMap; +import java.time.Duration; import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Stream; + import io.seata.common.exception.ShouldNeverHappenException; import io.seata.common.holder.ObjectHolder; +import io.seata.common.util.CollectionUtils; +import io.seata.common.util.ReflectionUtil; import io.seata.config.Configuration; import io.seata.config.ExtConfigurationProvider; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.cglib.proxy.Enhancer; import org.springframework.cglib.proxy.MethodInterceptor; import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.lang.Nullable; import static io.seata.common.Constants.OBJECT_KEY_SPRING_CONFIGURABLE_ENVIRONMENT; import static io.seata.common.util.StringFormatUtils.DOT; @@ -52,7 +56,7 @@ public class SpringBootConfigurationProvider implements ExtConfigurationProvider private static final String INTERCEPT_METHOD_PREFIX = "get"; - private static final Map PROPERTY_BEAN_INSTANCE_MAP = new HashMap<>(64); + private static final Map PROPERTY_BEAN_INSTANCE_MAP = new ConcurrentHashMap<>(64); @Override public Configuration provide(Configuration originalConfiguration) { @@ -61,20 +65,49 @@ public Configuration provide(Configuration originalConfiguration) { if (method.getName().startsWith(INTERCEPT_METHOD_PREFIX) && args.length > 0) { Object result; String rawDataId = (String)args[0]; + Class dataType = ReflectionUtil.getWrappedClass(method.getReturnType()); + + // 1. Get config value from the system property result = originalConfiguration.getConfigFromSys(rawDataId); - if (null == result) { - if (args.length == 1) { - result = get(convertDataId(rawDataId)); - } else { - result = get(convertDataId(rawDataId), args[1]); + + if (result == null) { + String dataId = convertDataId(rawDataId); + + // 2. Get config value from the springboot environment + result = getConfigFromEnvironment(dataId, dataType); + if (result != null) { + return result; + } + + // 3. Get config defaultValue from the arguments + if (args.length > 1) { + result = args[1]; + + if (result != null) { + // See Configuration#getConfig(String dataId, long timeoutMills) + if (dataType.isAssignableFrom(result.getClass())) { + return result; + } else { + result = null; + } + } + } + + // 4. Get config defaultValue from the property object + try { + result = getDefaultValueFromPropertyObject(dataId); + } catch (Throwable t) { + LOGGER.error("Get config '{}' default value from the property object failed:", dataId, t); } } + if (result != null) { - // If the return type is String,need to convert the object to string - if (method.getReturnType().equals(String.class)) { - return String.valueOf(result); + if (dataType.isAssignableFrom(result.getClass())) { + return result; } - return result; + + // Convert type + return this.convertType(result, dataType); } } @@ -82,62 +115,53 @@ public Configuration provide(Configuration originalConfiguration) { }); } - private Object get(String dataId, Object defaultValue) throws IllegalAccessException, InstantiationException { - Object result = get(dataId); - if (result == null) { - return defaultValue; - } - return result; - } - - private Object get(String dataId) throws IllegalAccessException { + private Object getDefaultValueFromPropertyObject(String dataId) throws IllegalAccessException { String propertyPrefix = getPropertyPrefix(dataId); String propertySuffix = getPropertySuffix(dataId); - Class propertyClass = PROPERTY_BEAN_MAP.get(propertyPrefix); - Object valueObject = null; - if (propertyClass != null) { - try { - valueObject = getFieldValue( - Objects.requireNonNull(PROPERTY_BEAN_INSTANCE_MAP.computeIfAbsent(propertyPrefix, k -> { - try { - return propertyClass.newInstance(); - } catch (InstantiationException | IllegalAccessException e) { - LOGGER.error("PropertyClass for prefix: [" + propertyPrefix - + "] should not be null. error :" + e.getMessage(), e); - } - return null; - })), propertySuffix, dataId); - } catch (NoSuchBeanDefinitionException ignore) { - } - } else { + // Get the property class + final Class propertyClass = PROPERTY_BEAN_MAP.get(propertyPrefix); + if (propertyClass == null) { throw new ShouldNeverHappenException("PropertyClass for prefix: [" + propertyPrefix + "] should not be null."); } - return valueObject; + // Instantiate the property object + Object propertyObj = CollectionUtils.computeIfAbsent(PROPERTY_BEAN_INSTANCE_MAP, propertyPrefix, k -> { + try { + return propertyClass.newInstance(); + } catch (InstantiationException | IllegalAccessException e) { + LOGGER.warn("PropertyClass for prefix: [" + propertyPrefix + "] should not be null. error :" + e.getMessage(), e); + } + return null; + }); + Objects.requireNonNull(propertyObj, () -> "Instantiate the property object fail: " + propertyClass.getName()); + + // Get defaultValue from the property object + return getDefaultValueFromPropertyObject(propertyObj, propertySuffix); } /** - * get field value + * Get defaultValue from the property object * - * @param object - * @param fieldName - * @param dataId - * @return java.lang.Object + * @param propertyObj the property object + * @param fieldName the field name + * @return defaultValue * @author xingfudeshi@gmail.com */ - private Object getFieldValue(Object object, String fieldName, String dataId) throws IllegalAccessException { - Optional fieldOptional = Stream.of(object.getClass().getDeclaredFields()) + @Nullable + private Object getDefaultValueFromPropertyObject(Object propertyObj, String fieldName) throws IllegalAccessException { + Optional fieldOptional = Stream.of(propertyObj.getClass().getDeclaredFields()) .filter(f -> f.getName().equalsIgnoreCase(fieldName)).findAny(); + + // Get defaultValue from the field if (fieldOptional.isPresent()) { Field field = fieldOptional.get(); - if (Objects.equals(field.getType(), Map.class)) { - return getConfig(dataId, null, String.class); + if (!Map.class.isAssignableFrom(field.getType())) { + field.setAccessible(true); + return field.get(propertyObj); } - field.setAccessible(true); - Object defaultValue = field.get(object); - return getConfig(dataId, defaultValue, field.getType()); } + return null; } @@ -191,19 +215,41 @@ private String getPropertySuffix(String dataId) { /** * get spring config - * @param dataId data id - * @param defaultValue default value - * @param type type + * + * @param dataId data id + * @param dataType data type * @return object */ - private Object getConfig(String dataId, Object defaultValue, Class type) { - ConfigurableEnvironment environment = - (ConfigurableEnvironment)ObjectHolder.INSTANCE.getObject(OBJECT_KEY_SPRING_CONFIGURABLE_ENVIRONMENT); - Object value = environment.getProperty(dataId, type); + @Nullable + private Object getConfigFromEnvironment(String dataId, Class dataType) { + ConfigurableEnvironment environment = (ConfigurableEnvironment)ObjectHolder.INSTANCE.getObject(OBJECT_KEY_SPRING_CONFIGURABLE_ENVIRONMENT); + Object value = environment.getProperty(dataId, dataType); if (value == null) { - value = environment.getProperty(io.seata.common.util.StringUtils.hump2Line(dataId), type); + value = environment.getProperty(io.seata.common.util.StringUtils.hump2Line(dataId), dataType); + } + return value; + } + + private Object convertType(Object configValue, Class dataType) { + if (String.class.equals(dataType)) { + return String.valueOf(configValue); + } + if (Long.class.equals(dataType)) { + return Long.parseLong(String.valueOf(configValue)); + } + if (Integer.class.equals(dataType)) { + return Integer.parseInt(String.valueOf(configValue)); + } + if (Short.class.equals(dataType)) { + return Short.parseShort(String.valueOf(configValue)); + } + if (Boolean.class.equals(dataType)) { + return Boolean.parseBoolean(String.valueOf(configValue)); + } + if (Duration.class.equals(dataType)) { + return Duration.parse(String.valueOf(configValue)); } - return value != null ? value : defaultValue; + return configValue; } } diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/test/java/io/seata/spring/boot/autoconfigure/BasePropertiesTest.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/test/java/io/seata/spring/boot/autoconfigure/BasePropertiesTest.java index 7501da2ef67..e450017a2bb 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/test/java/io/seata/spring/boot/autoconfigure/BasePropertiesTest.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/test/java/io/seata/spring/boot/autoconfigure/BasePropertiesTest.java @@ -43,8 +43,8 @@ public class BasePropertiesTest { protected static final String STR_TEST_EEE = "eee"; protected static final String STR_TEST_FFF = "fff"; - protected static final long LONG_TEST_ONE = 1L; - protected static final long LONG_TEST_TWO = 2L; + protected static final int LONG_TEST_ONE = 1; + protected static final int LONG_TEST_TWO = 2; @BeforeEach public void setUp() throws IOException { diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/test/java/io/seata/spring/boot/autoconfigure/properties/config/test/ZooKeeperPropertiesTest.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/test/java/io/seata/spring/boot/autoconfigure/properties/config/test/ZooKeeperPropertiesTest.java index 4a95734e907..a86afbae9ca 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/test/java/io/seata/spring/boot/autoconfigure/properties/config/test/ZooKeeperPropertiesTest.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/test/java/io/seata/spring/boot/autoconfigure/properties/config/test/ZooKeeperPropertiesTest.java @@ -49,8 +49,8 @@ public void testConfigZooKeeperProperties() { assertEquals(STR_TEST_BBB, currentConfiguration.getConfig("config.zk.serverAddr")); assertEquals(STR_TEST_CCC, currentConfiguration.getConfig("config.zk.username")); assertEquals(STR_TEST_DDD, currentConfiguration.getConfig("config.zk.password")); - assertEquals(LONG_TEST_ONE, currentConfiguration.getLong("config.zk.connectTimeout")); - assertEquals(LONG_TEST_TWO, currentConfiguration.getLong("config.zk.sessionTimeout")); + assertEquals(LONG_TEST_ONE, currentConfiguration.getInt("config.zk.connectTimeout")); + assertEquals(LONG_TEST_TWO, currentConfiguration.getInt("config.zk.sessionTimeout")); } } diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/ServerProperties.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/ServerProperties.java index 8bb69d771a9..7aec3ff5274 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/ServerProperties.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/ServerProperties.java @@ -15,9 +15,6 @@ */ package io.seata.spring.boot.autoconfigure.properties.server; -import java.time.Duration; - -import io.seata.common.util.DurationUtil; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @@ -29,8 +26,8 @@ @Component @ConfigurationProperties(prefix = SERVER_PREFIX) public class ServerProperties { - private Duration maxCommitRetryTimeout = DurationUtil.DEFAULT_DURATION; - private Duration maxRollbackRetryTimeout = DurationUtil.DEFAULT_DURATION; + private long maxCommitRetryTimeout = -1L; + private long maxRollbackRetryTimeout = -1L; private Boolean rollbackRetryTimeoutUnlockEnable = false; private Boolean enableCheckAuth = true; private Boolean enableParallelRequestHandle = false; @@ -38,20 +35,20 @@ public class ServerProperties { private Integer servicePort; private Integer xaerNotaRetryTimeout = 60000; - public Duration getMaxCommitRetryTimeout() { + public long getMaxCommitRetryTimeout() { return maxCommitRetryTimeout; } - public ServerProperties setMaxCommitRetryTimeout(Duration maxCommitRetryTimeout) { + public ServerProperties setMaxCommitRetryTimeout(long maxCommitRetryTimeout) { this.maxCommitRetryTimeout = maxCommitRetryTimeout; return this; } - public Duration getMaxRollbackRetryTimeout() { + public long getMaxRollbackRetryTimeout() { return maxRollbackRetryTimeout; } - public ServerProperties setMaxRollbackRetryTimeout(Duration maxRollbackRetryTimeout) { + public ServerProperties setMaxRollbackRetryTimeout(long maxRollbackRetryTimeout) { this.maxRollbackRetryTimeout = maxRollbackRetryTimeout; return this; } diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/ServerRecoveryProperties.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/ServerRecoveryProperties.java index bd2eb2b0021..9935f1402e0 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/ServerRecoveryProperties.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/ServerRecoveryProperties.java @@ -31,43 +31,43 @@ @ConfigurationProperties(prefix = SERVER_RECOVERY_PREFIX) public class ServerRecoveryProperties { - private int committingRetryPeriod = DEFAULT_COMMITING_RETRY_PERIOD; - private int asyncCommittingRetryPeriod = DEFAULT_ASYNC_COMMITTING_RETRY_PERIOD; - private int rollbackingRetryPeriod = DEFAULT_ROLLBACKING_RETRY_PERIOD; - private int timeoutRetryPeriod = DEFAULT_TIMEOUT_RETRY_PERIOD; + private long committingRetryPeriod = DEFAULT_COMMITING_RETRY_PERIOD; + private long asyncCommittingRetryPeriod = DEFAULT_ASYNC_COMMITTING_RETRY_PERIOD; + private long rollbackingRetryPeriod = DEFAULT_ROLLBACKING_RETRY_PERIOD; + private long timeoutRetryPeriod = DEFAULT_TIMEOUT_RETRY_PERIOD; - public int getCommittingRetryPeriod() { + public long getCommittingRetryPeriod() { return committingRetryPeriod; } - public ServerRecoveryProperties setCommittingRetryPeriod(int committingRetryPeriod) { + public ServerRecoveryProperties setCommittingRetryPeriod(long committingRetryPeriod) { this.committingRetryPeriod = committingRetryPeriod; return this; } - public int getAsyncCommittingRetryPeriod() { + public long getAsyncCommittingRetryPeriod() { return asyncCommittingRetryPeriod; } - public ServerRecoveryProperties setAsyncCommittingRetryPeriod(int asyncCommittingRetryPeriod) { + public ServerRecoveryProperties setAsyncCommittingRetryPeriod(long asyncCommittingRetryPeriod) { this.asyncCommittingRetryPeriod = asyncCommittingRetryPeriod; return this; } - public int getRollbackingRetryPeriod() { + public long getRollbackingRetryPeriod() { return rollbackingRetryPeriod; } - public ServerRecoveryProperties setRollbackingRetryPeriod(int rollbackingRetryPeriod) { + public ServerRecoveryProperties setRollbackingRetryPeriod(long rollbackingRetryPeriod) { this.rollbackingRetryPeriod = rollbackingRetryPeriod; return this; } - public Integer getTimeoutRetryPeriod() { + public long getTimeoutRetryPeriod() { return timeoutRetryPeriod; } - public ServerRecoveryProperties setTimeoutRetryPeriod(int timeoutRetryPeriod) { + public ServerRecoveryProperties setTimeoutRetryPeriod(long timeoutRetryPeriod) { this.timeoutRetryPeriod = timeoutRetryPeriod; return this; } diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/ServerUndoProperties.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/ServerUndoProperties.java index f1fc876ab3a..895b60d9216 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/ServerUndoProperties.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/ServerUndoProperties.java @@ -28,14 +28,14 @@ @Component @ConfigurationProperties(prefix = SERVER_UNDO_PREFIX) public class ServerUndoProperties { - private int logSaveDays = DEFAULT_SAVE_DAYS; + private short logSaveDays = DEFAULT_SAVE_DAYS; private long logDeletePeriod = DEFAULT_UNDO_LOG_DELETE_PERIOD; - public int getLogSaveDays() { + public short getLogSaveDays() { return logSaveDays; } - public ServerUndoProperties setLogSaveDays(int logSaveDays) { + public ServerUndoProperties setLogSaveDays(short logSaveDays) { this.logSaveDays = logSaveDays; return this; } diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreDBProperties.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreDBProperties.java index 0bd3c8db313..68771a0764a 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreDBProperties.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreDBProperties.java @@ -42,7 +42,7 @@ public class StoreDBProperties { private String lockTable = "lock_table"; private String distributedLockTable = "distributed_lock"; private Integer queryLimit = DEFAULT_QUERY_LIMIT; - private Integer maxWait = 5000; + private Long maxWait = 5000L; public String getDatasource() { return datasource; @@ -160,11 +160,11 @@ public StoreDBProperties setQueryLimit(Integer queryLimit) { return this; } - public Integer getMaxWait() { + public Long getMaxWait() { return maxWait; } - public StoreDBProperties setMaxWait(Integer maxWait) { + public StoreDBProperties setMaxWait(Long maxWait) { this.maxWait = maxWait; return this; } diff --git a/server/src/main/java/io/seata/server/coordinator/DefaultCoordinator.java b/server/src/main/java/io/seata/server/coordinator/DefaultCoordinator.java index a4c8cb1b72c..75c09ac2d2a 100644 --- a/server/src/main/java/io/seata/server/coordinator/DefaultCoordinator.java +++ b/server/src/main/java/io/seata/server/coordinator/DefaultCoordinator.java @@ -15,7 +15,6 @@ */ package io.seata.server.coordinator; -import java.time.Duration; import java.util.Collection; import java.util.Map; import java.util.concurrent.ArrayBlockingQueue; @@ -26,7 +25,6 @@ import io.netty.channel.Channel; import io.seata.common.thread.NamedThreadFactory; import io.seata.common.util.CollectionUtils; -import io.seata.common.util.DurationUtil; import io.seata.config.ConfigurationFactory; import io.seata.core.constants.ConfigurationKeys; import io.seata.core.context.RootContext; @@ -142,11 +140,11 @@ public class DefaultCoordinator extends AbstractTCInboundHandler implements Tran */ private static final int BRANCH_ASYNC_POOL_SIZE = Runtime.getRuntime().availableProcessors() * 2; - private static final Duration MAX_COMMIT_RETRY_TIMEOUT = ConfigurationFactory.getInstance().getDuration( - ConfigurationKeys.MAX_COMMIT_RETRY_TIMEOUT, DurationUtil.DEFAULT_DURATION, DEFAULT_MAX_COMMIT_RETRY_TIMEOUT); + private static final long MAX_COMMIT_RETRY_TIMEOUT = ConfigurationFactory.getInstance().getLong( + ConfigurationKeys.MAX_COMMIT_RETRY_TIMEOUT, DEFAULT_MAX_COMMIT_RETRY_TIMEOUT); - private static final Duration MAX_ROLLBACK_RETRY_TIMEOUT = ConfigurationFactory.getInstance().getDuration( - ConfigurationKeys.MAX_ROLLBACK_RETRY_TIMEOUT, DurationUtil.DEFAULT_DURATION, DEFAULT_MAX_ROLLBACK_RETRY_TIMEOUT); + private static final long MAX_ROLLBACK_RETRY_TIMEOUT = ConfigurationFactory.getInstance().getLong( + ConfigurationKeys.MAX_ROLLBACK_RETRY_TIMEOUT, DEFAULT_MAX_ROLLBACK_RETRY_TIMEOUT); private static final boolean ROLLBACK_RETRY_TIMEOUT_UNLOCK_ENABLE = ConfigurationFactory.getInstance().getBoolean( ConfigurationKeys.ROLLBACK_RETRY_TIMEOUT_UNLOCK_ENABLE, DEFAULT_ROLLBACK_RETRY_TIMEOUT_UNLOCK_ENABLE); @@ -381,7 +379,7 @@ protected void handleRetryRollbacking() { // The function of this 'return' is 'continue'. return; } - if (isRetryTimeout(now, MAX_ROLLBACK_RETRY_TIMEOUT.toMillis(), rollbackingSession.getBeginTime())) { + if (isRetryTimeout(now, MAX_ROLLBACK_RETRY_TIMEOUT, rollbackingSession.getBeginTime())) { if (ROLLBACK_RETRY_TIMEOUT_UNLOCK_ENABLE) { rollbackingSession.clean(); } @@ -422,7 +420,7 @@ protected void handleRetryCommitting() { // The function of this 'return' is 'continue'. return; } - if (isRetryTimeout(now, MAX_COMMIT_RETRY_TIMEOUT.toMillis(), committingSession.getBeginTime())) { + if (isRetryTimeout(now, MAX_COMMIT_RETRY_TIMEOUT, committingSession.getBeginTime())) { // Prevent thread safety issues SessionHolder.getRetryCommittingSessionManager().removeGlobalSession(committingSession); LOGGER.error("Global transaction commit retry timeout and has removed [{}]", committingSession.getXid()); diff --git a/server/src/test/java/io/seata/server/coordinator/DefaultCoordinatorTest.java b/server/src/test/java/io/seata/server/coordinator/DefaultCoordinatorTest.java index c83eefdc30c..594d92c0188 100644 --- a/server/src/test/java/io/seata/server/coordinator/DefaultCoordinatorTest.java +++ b/server/src/test/java/io/seata/server/coordinator/DefaultCoordinatorTest.java @@ -16,7 +16,6 @@ package io.seata.server.coordinator; import java.io.IOException; -import java.time.Duration; import java.util.Collection; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; @@ -24,9 +23,9 @@ import java.util.stream.Stream; import io.netty.channel.Channel; +import io.seata.common.DefaultValues; import io.seata.common.XID; import io.seata.common.loader.EnhancedServiceLoader; -import io.seata.common.util.DurationUtil; import io.seata.common.util.NetUtil; import io.seata.common.util.ReflectionUtil; import io.seata.config.Configuration; @@ -61,6 +60,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.ApplicationContext; + /** * The type DefaultCoordinator test. * @@ -169,7 +169,7 @@ public void test_handleRetryRollbackingTimeOut() throws TransactionException, In Assertions.assertNotNull(globalSession.getBranchSessions()); Assertions.assertNotNull(branchId); - ReflectionUtil.modifyStaticFinalField(defaultCoordinator.getClass(), "MAX_ROLLBACK_RETRY_TIMEOUT", Duration.ofMillis(10)); + ReflectionUtil.modifyStaticFinalField(defaultCoordinator.getClass(), "MAX_ROLLBACK_RETRY_TIMEOUT", 10L); ReflectionUtil.modifyStaticFinalField(defaultCoordinator.getClass(), "ROLLBACK_RETRY_TIMEOUT_UNLOCK_ENABLE", false); TimeUnit.MILLISECONDS.sleep(100); globalSession.queueToRetryRollback(); @@ -180,7 +180,7 @@ public void test_handleRetryRollbackingTimeOut() throws TransactionException, In } finally { globalSession.closeAndClean(); ReflectionUtil.modifyStaticFinalField(defaultCoordinator.getClass(), "MAX_ROLLBACK_RETRY_TIMEOUT", - ConfigurationFactory.getInstance().getDuration(ConfigurationKeys.MAX_ROLLBACK_RETRY_TIMEOUT, DurationUtil.DEFAULT_DURATION, 100)); + ConfigurationFactory.getInstance().getLong(ConfigurationKeys.MAX_ROLLBACK_RETRY_TIMEOUT, DefaultValues.DEFAULT_MAX_ROLLBACK_RETRY_TIMEOUT)); } } @@ -196,7 +196,7 @@ public void test_handleRetryRollbackingTimeOut_unlock() throws TransactionExcept Assertions.assertNotNull(globalSession.getBranchSessions()); Assertions.assertNotNull(branchId); - ReflectionUtil.modifyStaticFinalField(defaultCoordinator.getClass(), "MAX_ROLLBACK_RETRY_TIMEOUT", Duration.ofMillis(10)); + ReflectionUtil.modifyStaticFinalField(defaultCoordinator.getClass(), "MAX_ROLLBACK_RETRY_TIMEOUT", 10L); ReflectionUtil.modifyStaticFinalField(defaultCoordinator.getClass(), "ROLLBACK_RETRY_TIMEOUT_UNLOCK_ENABLE", true); TimeUnit.MILLISECONDS.sleep(100); @@ -209,7 +209,7 @@ public void test_handleRetryRollbackingTimeOut_unlock() throws TransactionExcept } finally { globalSession.closeAndClean(); ReflectionUtil.modifyStaticFinalField(defaultCoordinator.getClass(), "MAX_ROLLBACK_RETRY_TIMEOUT", - ConfigurationFactory.getInstance().getDuration(ConfigurationKeys.MAX_ROLLBACK_RETRY_TIMEOUT, DurationUtil.DEFAULT_DURATION, 100)); + ConfigurationFactory.getInstance().getLong(ConfigurationKeys.MAX_ROLLBACK_RETRY_TIMEOUT, DefaultValues.DEFAULT_MAX_ROLLBACK_RETRY_TIMEOUT)); } } diff --git a/spring/src/main/java/io/seata/spring/annotation/GlobalTransactionScanner.java b/spring/src/main/java/io/seata/spring/annotation/GlobalTransactionScanner.java index b8f74400ef8..ef455ea6e54 100644 --- a/spring/src/main/java/io/seata/spring/annotation/GlobalTransactionScanner.java +++ b/spring/src/main/java/io/seata/spring/annotation/GlobalTransactionScanner.java @@ -288,8 +288,8 @@ protected Object wrapIfNecessary(Object bean, String beanName, Object cacheKey) Class serviceInterface = SpringProxyUtils.findTargetClass(bean); Class[] interfacesIfJdk = SpringProxyUtils.findInterfaces(bean); - if (!existsAnnotation(new Class[]{serviceInterface}) - && !existsAnnotation(interfacesIfJdk)) { + if (!existsAnnotation(serviceInterface) + && !existsAnnotation(interfacesIfJdk)) { return bean; } @@ -302,7 +302,7 @@ protected Object wrapIfNecessary(Object bean, String beanName, Object cacheKey) interceptor = globalTransactionalInterceptor; } - LOGGER.info("Bean[{}] with name [{}] would use interceptor [{}]", bean.getClass().getName(), beanName, interceptor.getClass().getName()); + LOGGER.info("Bean [{}] with name [{}] would use interceptor [{}]", bean.getClass().getName(), beanName, interceptor.getClass().getName()); if (!AopUtils.isAopProxy(bean)) { bean = super.wrapIfNecessary(bean, beanName, cacheKey); } else { @@ -325,7 +325,7 @@ protected Object wrapIfNecessary(Object bean, String beanName, Object cacheKey) private boolean doCheckers(Object bean, String beanName) { if (PROXYED_SET.contains(beanName) || EXCLUDE_BEAN_NAME_SET.contains(beanName) - || FactoryBean.class.isAssignableFrom(bean.getClass())) { + || FactoryBean.class.isAssignableFrom(bean.getClass())) { return false; } @@ -461,7 +461,7 @@ private boolean isTransactionInterceptor(Advisor advisor) { //endregion the methods about findAddSeataAdvisorPosition END - private boolean existsAnnotation(Class[] classes) { + private boolean existsAnnotation(Class... classes) { if (CollectionUtils.isNotEmpty(classes)) { for (Class clazz : classes) { if (clazz == null) { diff --git a/spring/src/main/java/io/seata/spring/annotation/datasource/SeataAutoDataSourceProxyCreator.java b/spring/src/main/java/io/seata/spring/annotation/datasource/SeataAutoDataSourceProxyCreator.java index a3b50c84119..b5fdb69d4d3 100644 --- a/spring/src/main/java/io/seata/spring/annotation/datasource/SeataAutoDataSourceProxyCreator.java +++ b/spring/src/main/java/io/seata/spring/annotation/datasource/SeataAutoDataSourceProxyCreator.java @@ -88,6 +88,7 @@ protected Object wrapIfNecessary(Object bean, String beanName, Object cacheKey) DataSource origin = (DataSource) bean; SeataDataSourceProxy proxy = buildProxy(origin, dataSourceProxyMode); DataSourceProxyHolder.put(origin, proxy); + LOGGER.info("Auto proxy data source '{}' by '{}' mode.", beanName, dataSourceProxyMode); return enhancer; } diff --git a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/DefaultDruidLoader.java b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/DefaultDruidLoader.java index a03904bf358..c19ca7d34af 100644 --- a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/DefaultDruidLoader.java +++ b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/DefaultDruidLoader.java @@ -22,14 +22,12 @@ import java.net.URL; import java.security.CodeSource; +import static io.seata.common.DefaultValues.DRUID_LOCATION; + /** * @author ggndnn */ class DefaultDruidLoader implements DruidLoader { - /** - * Default druid location in classpath - */ - private final static String DRUID_LOCATION = "lib/sqlparser/druid.jar"; private final static DefaultDruidLoader DRUID_LOADER = new DefaultDruidLoader(DRUID_LOCATION);