Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
abeb37ad
Shardingsphere
项目概览
apache
/
Shardingsphere
通知
56
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Shardingsphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
abeb37ad
编写于
3月 13, 2018
作者:
T
terrymanu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove async job
上级
48c59e70
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
2 addition
and
178 deletion
+2
-178
sharding-jdbc-transaction-parent/sharding-jdbc-transaction/src/main/java/io/shardingjdbc/transaction/api/SoftTransactionManager.java
.../shardingjdbc/transaction/api/SoftTransactionManager.java
+2
-6
sharding-jdbc-transaction-parent/sharding-jdbc-transaction/src/main/java/io/shardingjdbc/transaction/bed/async/AbstractBestEffortsDeliveryJobFactory.java
...tion/bed/async/AbstractBestEffortsDeliveryJobFactory.java
+0
-61
sharding-jdbc-transaction-parent/sharding-jdbc-transaction/src/main/java/io/shardingjdbc/transaction/bed/async/NestedBestEffortsDeliveryJob.java
...c/transaction/bed/async/NestedBestEffortsDeliveryJob.java
+0
-68
sharding-jdbc-transaction-parent/sharding-jdbc-transaction/src/main/java/io/shardingjdbc/transaction/bed/async/NestedBestEffortsDeliveryJobFactory.java
...action/bed/async/NestedBestEffortsDeliveryJobFactory.java
+0
-43
未找到文件。
sharding-jdbc-transaction-parent/sharding-jdbc-transaction/src/main/java/io/shardingjdbc/transaction/api/SoftTransactionManager.java
浏览文件 @
abeb37ad
...
...
@@ -17,17 +17,16 @@
package
io.shardingjdbc.transaction.api
;
import
com.google.common.base.Optional
;
import
com.google.common.base.Preconditions
;
import
io.shardingjdbc.core.executor.threadlocal.ExecutorDataMap
;
import
io.shardingjdbc.core.util.EventBusInstance
;
import
io.shardingjdbc.transaction.api.config.SoftTransactionConfiguration
;
import
io.shardingjdbc.transaction.bed.BEDSoftTransaction
;
import
io.shardingjdbc.transaction.bed.async.NestedBestEffortsDeliveryJobFactory
;
import
io.shardingjdbc.transaction.bed.sync.BestEffortsDeliveryListener
;
import
io.shardingjdbc.transaction.constants.SoftTransactionType
;
import
io.shardingjdbc.transaction.constants.TransactionLogDataSourceType
;
import
io.shardingjdbc.transaction.tcc.TCCSoftTransaction
;
import
com.google.common.base.Optional
;
import
com.google.common.base.Preconditions
;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -62,9 +61,6 @@ public final class SoftTransactionManager {
Preconditions
.
checkNotNull
(
transactionConfig
.
getTransactionLogDataSource
());
createTable
();
}
if
(
transactionConfig
.
getBestEffortsDeliveryJobConfiguration
().
isPresent
())
{
new
NestedBestEffortsDeliveryJobFactory
(
transactionConfig
).
init
();
}
}
private
void
createTable
()
throws
SQLException
{
...
...
sharding-jdbc-transaction-parent/sharding-jdbc-transaction/src/main/java/io/shardingjdbc/transaction/bed/async/AbstractBestEffortsDeliveryJobFactory.java
已删除
100644 → 0
浏览文件 @
48c59e70
/*
* Copyright 1999-2015 dangdang.com.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package
io.shardingjdbc.transaction.bed.async
;
import
com.dangdang.ddframe.job.api.JobConfiguration
;
import
com.dangdang.ddframe.job.api.JobScheduler
;
import
io.shardingjdbc.transaction.api.config.AbstractBestEffortsDeliveryJobConfiguration
;
import
io.shardingjdbc.transaction.api.config.SoftTransactionConfiguration
;
import
io.shardingjdbc.transaction.storage.TransactionLogStorageFactory
;
import
com.dangdang.ddframe.reg.base.CoordinatorRegistryCenter
;
import
com.dangdang.ddframe.reg.zookeeper.ZookeeperConfiguration
;
import
com.dangdang.ddframe.reg.zookeeper.ZookeeperRegistryCenter
;
import
lombok.RequiredArgsConstructor
;
/**
* Best efforts delivery B.A.S.E transaction asynchronized job abstract factory.
*
* @author zhangliang
*/
@RequiredArgsConstructor
public
abstract
class
AbstractBestEffortsDeliveryJobFactory
<
T
extends
AbstractBestEffortsDeliveryJobConfiguration
>
{
private
final
SoftTransactionConfiguration
transactionConfig
;
/**
* initialize asynchronized job.
*/
public
final
void
init
()
{
@SuppressWarnings
(
"unchecked"
)
T
bedJobConfig
=
(
T
)
transactionConfig
.
getBestEffortsDeliveryJobConfiguration
().
get
();
CoordinatorRegistryCenter
regCenter
=
new
ZookeeperRegistryCenter
(
createZookeeperConfiguration
(
bedJobConfig
));
regCenter
.
init
();
JobScheduler
jobScheduler
=
new
JobScheduler
(
regCenter
,
createBedJobConfiguration
(
bedJobConfig
));
jobScheduler
.
setField
(
"transactionConfig"
,
transactionConfig
);
jobScheduler
.
setField
(
"transactionLogStorage"
,
TransactionLogStorageFactory
.
createTransactionLogStorage
(
transactionConfig
.
buildTransactionLogDataSource
()));
jobScheduler
.
init
();
}
protected
abstract
ZookeeperConfiguration
createZookeeperConfiguration
(
T
config
);
private
JobConfiguration
createBedJobConfiguration
(
final
T
bedJobConfig
)
{
JobConfiguration
result
=
new
JobConfiguration
(
bedJobConfig
.
getJobName
(),
NestedBestEffortsDeliveryJob
.
class
,
1
,
bedJobConfig
.
getCron
());
result
.
setFetchDataCount
(
bedJobConfig
.
getTransactionLogFetchDataCount
());
return
result
;
}
}
sharding-jdbc-transaction-parent/sharding-jdbc-transaction/src/main/java/io/shardingjdbc/transaction/bed/async/NestedBestEffortsDeliveryJob.java
已删除
100644 → 0
浏览文件 @
48c59e70
/*
* Copyright 1999-2015 dangdang.com.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package
io.shardingjdbc.transaction.bed.async
;
import
com.dangdang.ddframe.job.api.JobExecutionMultipleShardingContext
;
import
com.dangdang.ddframe.job.plugin.job.type.dataflow.AbstractIndividualThroughputDataFlowElasticJob
;
import
io.shardingjdbc.core.exception.ShardingJdbcException
;
import
io.shardingjdbc.transaction.api.config.SoftTransactionConfiguration
;
import
io.shardingjdbc.transaction.storage.TransactionLog
;
import
io.shardingjdbc.transaction.storage.TransactionLogStorage
;
import
lombok.Setter
;
import
lombok.extern.slf4j.Slf4j
;
import
java.sql.SQLException
;
import
java.util.List
;
/**
* Best efforts delivery B.A.S.E transaction asynchronized job.
*
* @author zhangliang
* @author caohao
*/
@Slf4j
public
class
NestedBestEffortsDeliveryJob
extends
AbstractIndividualThroughputDataFlowElasticJob
<
TransactionLog
>
{
@Setter
private
SoftTransactionConfiguration
transactionConfig
;
@Setter
private
TransactionLogStorage
transactionLogStorage
;
@Override
public
List
<
TransactionLog
>
fetchData
(
final
JobExecutionMultipleShardingContext
context
)
{
return
transactionLogStorage
.
findEligibleTransactionLogs
(
context
.
getFetchDataCount
(),
transactionConfig
.
getBestEffortsDeliveryJobConfiguration
().
get
().
getAsyncMaxDeliveryTryTimes
(),
transactionConfig
.
getBestEffortsDeliveryJobConfiguration
().
get
().
getAsyncMaxDeliveryTryDelayMillis
());
}
@Override
public
boolean
processData
(
final
JobExecutionMultipleShardingContext
context
,
final
TransactionLog
data
)
{
try
{
return
transactionLogStorage
.
processData
(
transactionConfig
.
getTargetConnection
(
data
.
getDataSource
()),
data
,
transactionConfig
.
getBestEffortsDeliveryJobConfiguration
().
get
().
getAsyncMaxDeliveryTryTimes
());
}
catch
(
final
SQLException
ex
)
{
throw
new
ShardingJdbcException
(
ex
);
}
}
@Override
public
boolean
isStreamingProcess
()
{
return
false
;
}
}
sharding-jdbc-transaction-parent/sharding-jdbc-transaction/src/main/java/io/shardingjdbc/transaction/bed/async/NestedBestEffortsDeliveryJobFactory.java
已删除
100644 → 0
浏览文件 @
48c59e70
/*
* Copyright 1999-2015 dangdang.com.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package
io.shardingjdbc.transaction.bed.async
;
import
io.shardingjdbc.transaction.api.config.NestedBestEffortsDeliveryJobConfiguration
;
import
io.shardingjdbc.transaction.api.config.SoftTransactionConfiguration
;
import
com.dangdang.ddframe.reg.zookeeper.ZookeeperConfiguration
;
/**
* Best efforts delivery B.A.S.E transaction asynchronized job factory.
*
* @author zhangliang
*/
public
final
class
NestedBestEffortsDeliveryJobFactory
extends
AbstractBestEffortsDeliveryJobFactory
<
NestedBestEffortsDeliveryJobConfiguration
>
{
public
NestedBestEffortsDeliveryJobFactory
(
final
SoftTransactionConfiguration
transactionConfig
)
{
super
(
transactionConfig
);
}
@Override
protected
ZookeeperConfiguration
createZookeeperConfiguration
(
final
NestedBestEffortsDeliveryJobConfiguration
config
)
{
ZookeeperConfiguration
result
=
new
ZookeeperConfiguration
(
String
.
format
(
"localhost:%s"
,
config
.
getZookeeperPort
()),
config
.
getJobNamespace
(),
config
.
getZookeeperBaseSleepTimeMilliseconds
(),
config
.
getZookeeperMaxSleepTimeMilliseconds
(),
config
.
getZookeeperMaxRetries
());
result
.
setNestedPort
(
config
.
getZookeeperPort
());
result
.
setNestedDataDir
(
config
.
getZookeeperDataDir
());
return
result
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录