|
@@ -1,7 +1,11 @@
|
|
|
package org.hswebframework.web.datasource.jta;
|
|
|
|
|
|
import com.atomikos.jdbc.AtomikosDataSourceBean;
|
|
|
+import lombok.Data;
|
|
|
+import lombok.EqualsAndHashCode;
|
|
|
+import lombok.Getter;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.hswebframework.web.datasource.config.DynamicDataSourceConfig;
|
|
|
|
|
|
import java.sql.SQLException;
|
|
|
import java.util.Properties;
|
|
@@ -9,8 +13,11 @@ import java.util.Properties;
|
|
|
/**
|
|
|
* @author zhouhao
|
|
|
*/
|
|
|
+@EqualsAndHashCode(callSuper = true)
|
|
|
@Slf4j
|
|
|
-public class AtomikosDataSourceConfig {
|
|
|
+@Data
|
|
|
+public class AtomikosDataSourceConfig extends DynamicDataSourceConfig{
|
|
|
+ private static final long serialVersionUID = 5588085000663972571L;
|
|
|
private int minPoolSize = 5;
|
|
|
private int maxPoolSize = 200;
|
|
|
private int borrowConnectionTimeout = 60;
|
|
@@ -26,139 +33,6 @@ public class AtomikosDataSourceConfig {
|
|
|
//初始化超时时间
|
|
|
private int initTimeout = 10;
|
|
|
|
|
|
- @Override
|
|
|
- public int hashCode() {
|
|
|
- return toString().hashCode();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public boolean equals(Object obj) {
|
|
|
- return obj instanceof AtomikosDataSourceConfig && hashCode() == obj.hashCode();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public String toString() {
|
|
|
- return "AtomikosDataSourceConfig{" +
|
|
|
- "minPoolSize=" + minPoolSize +
|
|
|
- ", maxPoolSize=" + maxPoolSize +
|
|
|
- ", borrowConnectionTimeout=" + borrowConnectionTimeout +
|
|
|
- ", reapTimeout=" + reapTimeout +
|
|
|
- ", maxIdleTime=" + maxIdleTime +
|
|
|
- ", maintenanceInterval=" + maintenanceInterval +
|
|
|
- ", defaultIsolationLevel=" + defaultIsolationLevel +
|
|
|
- ", xaDataSourceClassName='" + xaDataSourceClassName + '\'' +
|
|
|
- ", loginTimeout=" + loginTimeout +
|
|
|
- ", testQuery='" + testQuery + '\'' +
|
|
|
- ", maxLifetime=" + maxLifetime +
|
|
|
- ", xaProperties=" + xaProperties +
|
|
|
- ", initTimeout=" + initTimeout +
|
|
|
- '}';
|
|
|
- }
|
|
|
-
|
|
|
- public Properties getXaProperties() {
|
|
|
- return xaProperties;
|
|
|
- }
|
|
|
-
|
|
|
- public void setXaProperties(Properties xaProperties) {
|
|
|
- this.xaProperties = xaProperties;
|
|
|
- }
|
|
|
-
|
|
|
- public int getMinPoolSize() {
|
|
|
- return minPoolSize;
|
|
|
- }
|
|
|
-
|
|
|
- public void setMinPoolSize(int minPoolSize) {
|
|
|
- this.minPoolSize = minPoolSize;
|
|
|
- }
|
|
|
-
|
|
|
- public int getMaxPoolSize() {
|
|
|
- return maxPoolSize;
|
|
|
- }
|
|
|
-
|
|
|
- public void setMaxPoolSize(int maxPoolSize) {
|
|
|
- this.maxPoolSize = maxPoolSize;
|
|
|
- }
|
|
|
-
|
|
|
- public int getBorrowConnectionTimeout() {
|
|
|
- return borrowConnectionTimeout;
|
|
|
- }
|
|
|
-
|
|
|
- public void setBorrowConnectionTimeout(int borrowConnectionTimeout) {
|
|
|
- this.borrowConnectionTimeout = borrowConnectionTimeout;
|
|
|
- }
|
|
|
-
|
|
|
- public int getReapTimeout() {
|
|
|
- return reapTimeout;
|
|
|
- }
|
|
|
-
|
|
|
- public void setReapTimeout(int reapTimeout) {
|
|
|
- this.reapTimeout = reapTimeout;
|
|
|
- }
|
|
|
-
|
|
|
- public int getMaxIdleTime() {
|
|
|
- return maxIdleTime;
|
|
|
- }
|
|
|
-
|
|
|
- public void setMaxIdleTime(int maxIdleTime) {
|
|
|
- this.maxIdleTime = maxIdleTime;
|
|
|
- }
|
|
|
-
|
|
|
- public int getMaintenanceInterval() {
|
|
|
- return maintenanceInterval;
|
|
|
- }
|
|
|
-
|
|
|
- public void setMaintenanceInterval(int maintenanceInterval) {
|
|
|
- this.maintenanceInterval = maintenanceInterval;
|
|
|
- }
|
|
|
-
|
|
|
- public int getDefaultIsolationLevel() {
|
|
|
- return defaultIsolationLevel;
|
|
|
- }
|
|
|
-
|
|
|
- public void setDefaultIsolationLevel(int defaultIsolationLevel) {
|
|
|
- this.defaultIsolationLevel = defaultIsolationLevel;
|
|
|
- }
|
|
|
-
|
|
|
- public String getXaDataSourceClassName() {
|
|
|
- return xaDataSourceClassName;
|
|
|
- }
|
|
|
-
|
|
|
- public void setXaDataSourceClassName(String xaDataSourceClassName) {
|
|
|
- this.xaDataSourceClassName = xaDataSourceClassName;
|
|
|
- }
|
|
|
-
|
|
|
- public int getLoginTimeout() {
|
|
|
- return loginTimeout;
|
|
|
- }
|
|
|
-
|
|
|
- public void setLoginTimeout(int loginTimeout) {
|
|
|
- this.loginTimeout = loginTimeout;
|
|
|
- }
|
|
|
-
|
|
|
- public String getTestQuery() {
|
|
|
- return testQuery;
|
|
|
- }
|
|
|
-
|
|
|
- public void setTestQuery(String testQuery) {
|
|
|
- this.testQuery = testQuery;
|
|
|
- }
|
|
|
-
|
|
|
- public int getMaxLifetime() {
|
|
|
- return maxLifetime;
|
|
|
- }
|
|
|
-
|
|
|
- public void setMaxLifetime(int maxLifetime) {
|
|
|
- this.maxLifetime = maxLifetime;
|
|
|
- }
|
|
|
-
|
|
|
- public int getInitTimeout() {
|
|
|
- return initTimeout;
|
|
|
- }
|
|
|
-
|
|
|
- public void setInitTimeout(int initTimeout) {
|
|
|
- this.initTimeout = initTimeout;
|
|
|
- }
|
|
|
-
|
|
|
public void putProperties(AtomikosDataSourceBean atomikosDataSourceBean) {
|
|
|
if (null != xaProperties) {
|
|
|
xaProperties.entrySet().forEach(entry -> entry.setValue(String.valueOf(entry.getValue())));
|