-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1217 from cherrylzhao/dev-new
Move local transaction to sharding-jdbc
- Loading branch information
Showing
15 changed files
with
166 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...bc/src/main/java/io/shardingsphere/core/transaction/LocalTransactionListenerRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2016-2018 shardingsphere.io. | ||
* <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.shardingsphere.core.transaction; | ||
|
||
import io.shardingsphere.core.event.ShardingEventListenerRegistry; | ||
|
||
/** | ||
* Transaction listener registry. | ||
* | ||
* @author zhangliang | ||
*/ | ||
public final class LocalTransactionListenerRegistry implements ShardingEventListenerRegistry { | ||
|
||
@Override | ||
public void register() { | ||
new LocalTransactionListener().register(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...ng-jdbc/src/main/java/io/shardingsphere/core/transaction/ShardingTransactionListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 2016-2018 shardingsphere.io. | ||
* <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.shardingsphere.core.transaction; | ||
|
||
import io.shardingsphere.core.event.transaction.ShardingTransactionEvent; | ||
|
||
import java.sql.SQLException; | ||
|
||
/** | ||
* Sharding transaction listener. | ||
* | ||
* @author zhangliang | ||
* | ||
* @param <T> transaction event type | ||
*/ | ||
// TODO maybe move this listener to sharding-core is better. | ||
public interface ShardingTransactionListener<T extends ShardingTransactionEvent> { | ||
|
||
/** | ||
* Register sharding transaction listener into event bus. | ||
*/ | ||
void register(); | ||
|
||
/** | ||
* Listen event. | ||
* | ||
* @param transactionEvent transaction event | ||
* @throws SQLException SQL exception | ||
*/ | ||
void listen(T transactionEvent) throws SQLException; | ||
} |
57 changes: 57 additions & 0 deletions
57
...ing-jdbc/src/main/java/io/shardingsphere/core/transaction/ShardingTransactionManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2016-2018 shardingsphere.io. | ||
* <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.shardingsphere.core.transaction; | ||
|
||
import io.shardingsphere.core.event.transaction.ShardingTransactionEvent; | ||
|
||
import java.sql.SQLException; | ||
|
||
/** | ||
* Sharding transaction manager. | ||
* | ||
* @author zhaojun | ||
* @author zhangliang | ||
* | ||
* @param <T> transaction event type | ||
*/ | ||
public interface ShardingTransactionManager<T extends ShardingTransactionEvent> { | ||
|
||
/** | ||
* Begin transaction. | ||
* | ||
* @param transactionEvent transaction event | ||
* @throws SQLException SQL exception | ||
*/ | ||
void begin(T transactionEvent) throws SQLException; | ||
|
||
/** | ||
* Commit transaction. | ||
* | ||
* @param transactionEvent transaction event | ||
* @throws SQLException SQL exception | ||
*/ | ||
void commit(T transactionEvent) throws SQLException; | ||
|
||
/** | ||
* Rollback transaction. | ||
* | ||
* @param transactionEvent transaction event | ||
* @throws SQLException SQL exception | ||
*/ | ||
void rollback(T transactionEvent) throws SQLException; | ||
} |
1 change: 1 addition & 0 deletions
1
...in/resources/META-INF/services/io.shardingsphere.core.event.ShardingEventListenerRegistry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.shardingsphere.core.transaction.LocalTransactionListenerRegistry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
com.atomikos.icatch.serial_jta_transactions = false | ||
com.atomikos.icatch.default_jta_timeout = 1000000 | ||
com.atomikos.icatch.max_actives = 10000 | ||
com.atomikos.icatch.enable_logging = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters