forked from apache/incubator-seata
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'apache:2.x' into 2.x_readonly
- Loading branch information
Showing
47 changed files
with
2,805 additions
and
59 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
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
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
28 changes: 28 additions & 0 deletions
28
compatible/src/main/java/io/seata/common/LockStrategyMode.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,28 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
package io.seata.common; | ||
|
||
public enum LockStrategyMode { | ||
/** | ||
* Optimistic lock mode is recommended when resources are not reused in the current global transaction. | ||
*/ | ||
OPTIMISTIC, | ||
/** | ||
* Pessimistic lock mode is recommended when there may be repeated use of the same resource in a global transaction. | ||
*/ | ||
PESSIMISTIC | ||
} |
56 changes: 56 additions & 0 deletions
56
compatible/src/main/java/io/seata/core/exception/TransactionException.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,56 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
package io.seata.core.exception; | ||
|
||
|
||
/** | ||
* The type Transaction exception. | ||
*/ | ||
public class TransactionException extends org.apache.seata.core.exception.TransactionException { | ||
|
||
private static org.apache.seata.core.exception.TransactionExceptionCode convertApacheSeataTransactionExceptionCode(TransactionExceptionCode transactionExceptionCode) { | ||
return org.apache.seata.core.exception.TransactionExceptionCode.get(transactionExceptionCode.ordinal()); | ||
} | ||
|
||
public TransactionException(TransactionExceptionCode code) { | ||
super(convertApacheSeataTransactionExceptionCode(code)); | ||
} | ||
|
||
public TransactionException(TransactionExceptionCode code, Throwable cause) { | ||
super(convertApacheSeataTransactionExceptionCode(code), cause); | ||
} | ||
|
||
public TransactionException(String message) { | ||
super(message); | ||
} | ||
|
||
public TransactionException(TransactionExceptionCode code, String message) { | ||
super(convertApacheSeataTransactionExceptionCode(code), message); | ||
} | ||
|
||
public TransactionException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
public TransactionException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public TransactionException(TransactionExceptionCode code, String message, Throwable cause) { | ||
super(convertApacheSeataTransactionExceptionCode(code), message, cause); | ||
} | ||
} |
172 changes: 172 additions & 0 deletions
172
compatible/src/main/java/io/seata/core/exception/TransactionExceptionCode.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,172 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
package io.seata.core.exception; | ||
|
||
/** | ||
* The enum Transaction exception code. | ||
* | ||
*/ | ||
public enum TransactionExceptionCode { | ||
|
||
/** | ||
* Unknown transaction exception code. | ||
*/ | ||
Unknown, | ||
|
||
/** | ||
* BeginFailed | ||
*/ | ||
BeginFailed, | ||
|
||
/** | ||
* Lock key conflict transaction exception code. | ||
*/ | ||
LockKeyConflict, | ||
|
||
/** | ||
* Io transaction exception code. | ||
*/ | ||
IO, | ||
|
||
/** | ||
* Branch rollback failed retriable transaction exception code. | ||
*/ | ||
BranchRollbackFailed_Retriable, | ||
|
||
/** | ||
* Branch rollback failed unretriable transaction exception code. | ||
*/ | ||
BranchRollbackFailed_Unretriable, | ||
|
||
/** | ||
* Branch register failed transaction exception code. | ||
*/ | ||
BranchRegisterFailed, | ||
|
||
/** | ||
* Branch report failed transaction exception code. | ||
*/ | ||
BranchReportFailed, | ||
|
||
/** | ||
* Lockable check failed transaction exception code. | ||
*/ | ||
LockableCheckFailed, | ||
|
||
/** | ||
* Branch transaction not exist transaction exception code. | ||
*/ | ||
BranchTransactionNotExist, | ||
|
||
/** | ||
* Global transaction not exist transaction exception code. | ||
*/ | ||
GlobalTransactionNotExist, | ||
|
||
/** | ||
* Global transaction not active transaction exception code. | ||
*/ | ||
GlobalTransactionNotActive, | ||
|
||
/** | ||
* Global transaction status invalid transaction exception code. | ||
*/ | ||
GlobalTransactionStatusInvalid, | ||
|
||
/** | ||
* Failed to send branch commit request transaction exception code. | ||
*/ | ||
FailedToSendBranchCommitRequest, | ||
|
||
/** | ||
* Failed to send branch rollback request transaction exception code. | ||
*/ | ||
FailedToSendBranchRollbackRequest, | ||
|
||
/** | ||
* Failed to add branch transaction exception code. | ||
*/ | ||
FailedToAddBranch, | ||
|
||
/** | ||
* Failed to lock global transaction exception code. | ||
*/ | ||
FailedLockGlobalTranscation, | ||
|
||
/** | ||
* FailedWriteSession | ||
*/ | ||
FailedWriteSession, | ||
|
||
/** | ||
* Failed to store exception code | ||
*/ | ||
FailedStore, | ||
|
||
/** | ||
* not raft leader exception code | ||
*/ | ||
NotRaftLeader, | ||
|
||
/** | ||
* Lock key conflict fail fast transaction exception code. | ||
*/ | ||
LockKeyConflictFailFast, | ||
|
||
/** | ||
* transaction already timeout | ||
*/ | ||
TransactionTimeout, | ||
|
||
/** | ||
* Commit heuristic transaction exception code. | ||
*/ | ||
CommitHeuristic, | ||
|
||
/** | ||
* Broken transaction exception code. | ||
*/ | ||
Broken; | ||
|
||
|
||
/** | ||
* Get transaction exception code. | ||
* | ||
* @param ordinal the ordinal | ||
* @return the transaction exception code | ||
*/ | ||
public static TransactionExceptionCode get(byte ordinal) { | ||
return get((int)ordinal); | ||
} | ||
|
||
/** | ||
* Get transaction exception code. | ||
* | ||
* @param ordinal the ordinal | ||
* @return the transaction exception code | ||
*/ | ||
public static TransactionExceptionCode get(int ordinal) { | ||
TransactionExceptionCode value = null; | ||
try { | ||
value = TransactionExceptionCode.values()[ordinal]; | ||
} catch (Exception e) { | ||
throw new IllegalArgumentException("Unknown TransactionExceptionCode[" + ordinal + "]"); | ||
} | ||
return value; | ||
} | ||
|
||
} |
Oops, something went wrong.