mirror of https://github.com/apache/activemq.git
minor javadoc and spelling fixes
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@729437 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
99819f378f
commit
185711e2f5
|
@ -18,7 +18,6 @@ package org.apache.activemq;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
@ -70,7 +69,7 @@ public class TransactionContext implements XAResource {
|
||||||
private final ActiveMQConnection connection;
|
private final ActiveMQConnection connection;
|
||||||
private final LongSequenceGenerator localTransactionIdGenerator;
|
private final LongSequenceGenerator localTransactionIdGenerator;
|
||||||
private final ConnectionId connectionId;
|
private final ConnectionId connectionId;
|
||||||
private List<Synchronization> synchornizations;
|
private List<Synchronization> synchronizations;
|
||||||
|
|
||||||
// To track XA transactions.
|
// To track XA transactions.
|
||||||
private Xid associatedXid;
|
private Xid associatedXid;
|
||||||
|
@ -116,59 +115,59 @@ public class TransactionContext implements XAResource {
|
||||||
// ///////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public void addSynchronization(Synchronization s) {
|
public void addSynchronization(Synchronization s) {
|
||||||
if (synchornizations == null) {
|
if (synchronizations == null) {
|
||||||
synchornizations = new ArrayList<Synchronization>(10);
|
synchronizations = new ArrayList<Synchronization>(10);
|
||||||
}
|
}
|
||||||
synchornizations.add(s);
|
synchronizations.add(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void afterRollback() throws JMSException {
|
private void afterRollback() throws JMSException {
|
||||||
if (synchornizations == null) {
|
if (synchronizations == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int size = synchornizations.size();
|
int size = synchronizations.size();
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
synchornizations.get(i).afterRollback();
|
synchronizations.get(i).afterRollback();
|
||||||
}
|
}
|
||||||
} catch (JMSException e) {
|
} catch (JMSException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
throw JMSExceptionSupport.create(e);
|
throw JMSExceptionSupport.create(e);
|
||||||
} finally {
|
} finally {
|
||||||
synchornizations = null;
|
synchronizations = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void afterCommit() throws JMSException {
|
private void afterCommit() throws JMSException {
|
||||||
if (synchornizations == null) {
|
if (synchronizations == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int size = synchornizations.size();
|
int size = synchronizations.size();
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
synchornizations.get(i).afterCommit();
|
synchronizations.get(i).afterCommit();
|
||||||
}
|
}
|
||||||
} catch (JMSException e) {
|
} catch (JMSException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
throw JMSExceptionSupport.create(e);
|
throw JMSExceptionSupport.create(e);
|
||||||
} finally {
|
} finally {
|
||||||
synchornizations = null;
|
synchronizations = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void beforeEnd() throws JMSException {
|
private void beforeEnd() throws JMSException {
|
||||||
if (synchornizations == null) {
|
if (synchronizations == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int size = synchornizations.size();
|
int size = synchronizations.size();
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
synchornizations.get(i).beforeEnd();
|
synchronizations.get(i).beforeEnd();
|
||||||
}
|
}
|
||||||
} catch (JMSException e) {
|
} catch (JMSException e) {
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -189,6 +188,7 @@ public class TransactionContext implements XAResource {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a local transaction.
|
* Start a local transaction.
|
||||||
|
* @throws javax.jms.JMSException on internal error
|
||||||
*/
|
*/
|
||||||
public void begin() throws JMSException {
|
public void begin() throws JMSException {
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ public class TransactionContext implements XAResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transactionId == null) {
|
if (transactionId == null) {
|
||||||
synchornizations = null;
|
synchronizations = null;
|
||||||
this.transactionId = new LocalTransactionId(connectionId, localTransactionIdGenerator.getNextSequenceId());
|
this.transactionId = new LocalTransactionId(connectionId, localTransactionIdGenerator.getNextSequenceId());
|
||||||
TransactionInfo info = new TransactionInfo(getConnectionId(), transactionId, TransactionInfo.BEGIN);
|
TransactionInfo info = new TransactionInfo(getConnectionId(), transactionId, TransactionInfo.BEGIN);
|
||||||
this.connection.ensureConnectionInfoSent();
|
this.connection.ensureConnectionInfoSent();
|
||||||
|
@ -244,8 +244,6 @@ public class TransactionContext implements XAResource {
|
||||||
*
|
*
|
||||||
* @throws JMSException if the JMS provider fails to commit the transaction
|
* @throws JMSException if the JMS provider fails to commit the transaction
|
||||||
* due to some internal error.
|
* due to some internal error.
|
||||||
* @throws TransactionRolledBackException if the transaction is rolled back
|
|
||||||
* due to some internal error during commit.
|
|
||||||
* @throws javax.jms.IllegalStateException if the method is not called by a
|
* @throws javax.jms.IllegalStateException if the method is not called by a
|
||||||
* transacted session.
|
* transacted session.
|
||||||
*/
|
*/
|
||||||
|
@ -298,12 +296,12 @@ public class TransactionContext implements XAResource {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// associate
|
// associate
|
||||||
synchornizations = null;
|
synchronizations = null;
|
||||||
setXid(xid);
|
setXid(xid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return connectionId for connection
|
||||||
*/
|
*/
|
||||||
private ConnectionId getConnectionId() {
|
private ConnectionId getConnectionId() {
|
||||||
return connection.getConnectionInfo().getConnectionId();
|
return connection.getConnectionInfo().getConnectionId();
|
||||||
|
@ -418,8 +416,7 @@ public class TransactionContext implements XAResource {
|
||||||
|
|
||||||
List<TransactionContext> l = ENDED_XA_TRANSACTION_CONTEXTS.remove(x);
|
List<TransactionContext> l = ENDED_XA_TRANSACTION_CONTEXTS.remove(x);
|
||||||
if (l != null && !l.isEmpty()) {
|
if (l != null && !l.isEmpty()) {
|
||||||
for (Iterator<TransactionContext> iter = l.iterator(); iter.hasNext();) {
|
for (TransactionContext ctx : l) {
|
||||||
TransactionContext ctx = iter.next();
|
|
||||||
ctx.afterRollback();
|
ctx.afterRollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -458,8 +455,7 @@ public class TransactionContext implements XAResource {
|
||||||
|
|
||||||
List<TransactionContext> l = ENDED_XA_TRANSACTION_CONTEXTS.remove(x);
|
List<TransactionContext> l = ENDED_XA_TRANSACTION_CONTEXTS.remove(x);
|
||||||
if (l != null && !l.isEmpty()) {
|
if (l != null && !l.isEmpty()) {
|
||||||
for (Iterator iter = l.iterator(); iter.hasNext();) {
|
for (TransactionContext ctx : l) {
|
||||||
TransactionContext ctx = (TransactionContext)iter.next();
|
|
||||||
ctx.afterCommit();
|
ctx.afterCommit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -525,7 +521,7 @@ public class TransactionContext implements XAResource {
|
||||||
|
|
||||||
DataArrayResponse receipt = (DataArrayResponse)this.connection.syncSendPacket(info);
|
DataArrayResponse receipt = (DataArrayResponse)this.connection.syncSendPacket(info);
|
||||||
DataStructure[] data = receipt.getData();
|
DataStructure[] data = receipt.getData();
|
||||||
XATransactionId[] answer = null;
|
XATransactionId[] answer;
|
||||||
if (data instanceof XATransactionId[]) {
|
if (data instanceof XATransactionId[]) {
|
||||||
answer = (XATransactionId[])data;
|
answer = (XATransactionId[])data;
|
||||||
} else {
|
} else {
|
||||||
|
@ -614,8 +610,8 @@ public class TransactionContext implements XAResource {
|
||||||
* Converts a JMSException from the server to an XAException. if the
|
* Converts a JMSException from the server to an XAException. if the
|
||||||
* JMSException contained a linked XAException that is returned instead.
|
* JMSException contained a linked XAException that is returned instead.
|
||||||
*
|
*
|
||||||
* @param e
|
* @param e JMSException to convert
|
||||||
* @return
|
* @return XAException wrapping original exception or its message
|
||||||
*/
|
*/
|
||||||
private XAException toXAException(JMSException e) {
|
private XAException toXAException(JMSException e) {
|
||||||
if (e.getCause() != null && e.getCause() instanceof XAException) {
|
if (e.getCause() != null && e.getCause() instanceof XAException) {
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class ActiveMQConnectionSupport {
|
||||||
/**
|
/**
|
||||||
* Sets the connection request information as a whole.
|
* Sets the connection request information as a whole.
|
||||||
*
|
*
|
||||||
* @param the connection request information
|
* @param connectionRequestInfo the connection request information
|
||||||
*/
|
*/
|
||||||
protected void setInfo(ActiveMQConnectionRequestInfo connectionRequestInfo){
|
protected void setInfo(ActiveMQConnectionRequestInfo connectionRequestInfo){
|
||||||
info = connectionRequestInfo;
|
info = connectionRequestInfo;
|
||||||
|
|
Loading…
Reference in New Issue