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 #1495 from hchiorean/MODE-2545
MODE-2545 Removes XA support for JcrSession and refactors a bunch of transaction-related code
- Loading branch information
Showing
28 changed files
with
329 additions
and
519 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
77 changes: 77 additions & 0 deletions
77
modeshape-jca/src/main/java/org/modeshape/jca/JcrLocalTransaction.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,77 @@ | ||
/* | ||
* ModeShape (http://www.modeshape.org) | ||
* | ||
* 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. | ||
*/ | ||
package org.modeshape.jca; | ||
|
||
import javax.resource.ResourceException; | ||
import javax.resource.spi.LocalTransaction; | ||
import javax.resource.spi.LocalTransactionException; | ||
import javax.transaction.HeuristicMixedException; | ||
import javax.transaction.HeuristicRollbackException; | ||
import javax.transaction.NotSupportedException; | ||
import javax.transaction.RollbackException; | ||
import javax.transaction.SystemException; | ||
import org.modeshape.common.annotation.Immutable; | ||
import org.modeshape.jcr.txn.Transactions; | ||
|
||
/** | ||
* ModeShape's JCA implementation of a {@link javax.resource.spi.LocalTransaction}. | ||
* | ||
* @author Horia Chiorean (hchiorea@redhat.com) | ||
*/ | ||
@Immutable | ||
public final class JcrLocalTransaction implements LocalTransaction { | ||
|
||
private final Transactions transactions; | ||
|
||
protected JcrLocalTransaction(Transactions transactions) { | ||
this.transactions = transactions; | ||
} | ||
|
||
@Override | ||
public void begin() throws ResourceException { | ||
try { | ||
transactions.begin(); | ||
} catch (NotSupportedException | SystemException e) { | ||
throw new LocalTransactionException(e); | ||
} | ||
} | ||
|
||
@Override | ||
public void commit() throws ResourceException { | ||
try { | ||
final Transactions.Transaction transaction = transactions.currentModeShapeTransaction(); | ||
if (transaction == null) { | ||
throw new LocalTransactionException("A local transaction does not exist"); | ||
} | ||
transaction.commit(); | ||
} catch (RollbackException | HeuristicMixedException | HeuristicRollbackException | SystemException e) { | ||
throw new LocalTransactionException(e); | ||
} | ||
} | ||
|
||
@Override | ||
public void rollback() throws ResourceException { | ||
final Transactions.Transaction transaction = transactions.currentModeShapeTransaction(); | ||
if (transaction == null) { | ||
throw new LocalTransactionException("A local transaction does not exist"); | ||
} | ||
try { | ||
transaction.rollback(); | ||
} catch (SystemException e) { | ||
throw new LocalTransactionException(e); | ||
} | ||
} | ||
} |
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
101 changes: 0 additions & 101 deletions
101
modeshape-jcr/src/main/java/org/modeshape/jcr/JcrXaSession.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.