You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by oz...@apache.org on 2004/05/10 10:23:26 UTC
cvs commit: jakarta-slide/src/stores/org/apache/slide/store/txfile AbstractTxFileStoreService.java TxXMLFileDescriptorsStore.java
ozeigermann 2004/05/10 01:23:26
Modified: src/stores/org/apache/slide/store/txfile
AbstractTxFileStoreService.java
TxXMLFileDescriptorsStore.java
Log:
Refactoring: Cleaned exception creation
Revision Changes Path
1.12 +16 -20 jakarta-slide/src/stores/org/apache/slide/store/txfile/AbstractTxFileStoreService.java
Index: AbstractTxFileStoreService.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/stores/org/apache/slide/store/txfile/AbstractTxFileStoreService.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- AbstractTxFileStoreService.java 10 May 2004 08:12:45 -0000 1.11
+++ AbstractTxFileStoreService.java 10 May 2004 08:23:26 -0000 1.12
@@ -165,19 +165,17 @@
long msecs = rm.getTransactionTimeout(getActiveTxId());
return Math.round(msecs / (float) 1000);
} catch (ResourceManagerException e) {
- throwXAException(e);
+ throw createXAException(e);
}
- // XXX just to make compiler quiet (throwXAException will always throw an exception, so this can never happen)
- return -1;
}
public boolean setTransactionTimeout(int seconds) throws XAException {
try {
rm.setTransactionTimeout(getActiveTxId(), seconds * 1000);
+ return true;
} catch (ResourceManagerException e) {
- throwXAException(e);
+ throw createXAException(e);
}
- return true;
}
public boolean isSameRM(XAResource xares) throws XAException {
@@ -215,10 +213,8 @@
e,
LOG_CHANNEL,
Logger.CRITICAL);
- throwXAException(e);
+ throw createXAException(e);
}
- // XXX just to make compiler quiet (throwXAException will always throw an exception, so this can never happen)
- return 0;
}
public synchronized void rollback(Xid xid) throws XAException {
@@ -237,7 +233,7 @@
e,
LOG_CHANNEL,
Logger.CRITICAL);
- throwXAException(e);
+ throw createXAException(e);
}
}
@@ -261,7 +257,7 @@
e,
LOG_CHANNEL,
Logger.CRITICAL);
- throwXAException(e);
+ throw createXAException(e);
}
}
@@ -290,7 +286,7 @@
try {
rm.markTransactionForRollback(XidWrapper.wrap(xid));
} catch (ResourceManagerException e) {
- throwXAException(e);
+ throw createXAException(e);
}
break;
case TMSUCCESS :
@@ -323,7 +319,7 @@
rm.startTransaction(txId);
activeTransactionBranch.set(txId);
} catch (ResourceManagerException e) {
- throwXAException(e);
+ throw createXAException(e);
}
break;
case TMJOIN :
@@ -336,7 +332,7 @@
throw new XAException(XAException.XAER_INVAL);
}
} catch (ResourceManagerException e) {
- throwXAException(e);
+ throw createXAException(e);
}
activeTransactionBranch.set(txId);
break;
@@ -448,13 +444,13 @@
return txId;
}
- protected void throwXAException(ResourceManagerException e) throws XAException {
+ protected XAException createXAException(ResourceManagerException e) {
if (e.getStatus() == ResourceManagerException.ERR_DUP_TX) {
- throw new XAException(XAException.XAER_DUPID);
+ return new XAException(XAException.XAER_DUPID);
} else if (e.getStatus() == ResourceManagerException.ERR_TXID_INVALID) {
- throw new XAException(XAException.XAER_NOTA);
+ return new XAException(XAException.XAER_NOTA);
} else {
- throw new XAException(e.toString());
+ return new XAException(e.toString());
}
}
1.12 +6 -8 jakarta-slide/src/stores/org/apache/slide/store/txfile/TxXMLFileDescriptorsStore.java
Index: TxXMLFileDescriptorsStore.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/stores/org/apache/slide/store/txfile/TxXMLFileDescriptorsStore.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TxXMLFileDescriptorsStore.java 21 Apr 2004 08:30:23 -0000 1.11
+++ TxXMLFileDescriptorsStore.java 10 May 2004 08:23:26 -0000 1.12
@@ -423,10 +423,8 @@
e,
LOG_CHANNEL,
Logger.CRITICAL);
- throwXAException(e);
+ throw createXAException(e);
}
- // XXX just to make compiler quiet (throwXAException will always throw an exception, so this can never happen)
- return 0;
}
public synchronized void start(Xid xid, int flags) throws XAException {
@@ -453,7 +451,7 @@
TxContext txContext = new TxContext(txId);
activeTransactionBranch.set(txContext);
} catch (ResourceManagerException e) {
- throwXAException(e);
+ throw createXAException(e);
}
break;
case TMJOIN :
@@ -466,7 +464,7 @@
throw new XAException(XAException.XAER_INVAL);
}
} catch (ResourceManagerException e) {
- throwXAException(e);
+ throw createXAException(e);
}
TxContext txContext = new TxContext(txId);
activeTransactionBranch.set(txContext);
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org