ASF Bugzilla – Attachment 12666 Details for
Bug 31105
Transient locks are not released due to suspended state within ExtendedStore
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Diff for ExtendedStore.java
ExtendedStore.diff (text/plain), 4.04 KB, created by
Steve Vaughan
on 2004-09-07 19:10:23 UTC
(
hide
)
Description:
Diff for ExtendedStore.java
Filename:
MIME Type:
Creator:
Steve Vaughan
Created:
2004-09-07 19:10:23 UTC
Size:
4.04 KB
patch
obsolete
>Index: src/share/org/apache/slide/store/ExtendedStore.java >=================================================================== >RCS file: /home/cvspublic/jakarta-slide/src/share/org/apache/slide/store/ExtendedStore.java,v >retrieving revision 1.18 >diff -u -r1.18 ExtendedStore.java >--- src/share/org/apache/slide/store/ExtendedStore.java 9 Aug 2004 22:56:12 -0000 1.18 >+++ src/share/org/apache/slide/store/ExtendedStore.java 7 Sep 2004 19:07:59 -0000 >@@ -938,7 +938,7 @@ > // > > public void forget(Xid xid) throws XAException { >- releaseTransientLocks(); >+ releaseTransientLocks(xid); > > Xid txId = (Xid) XidWrapper.wrap(xid); > activeTransactionBranch.set(null); >@@ -953,7 +953,7 @@ > } > > public void rollback(Xid xid) throws XAException { >- releaseTransientLocks(); >+ releaseTransientLocks(xid); > > Xid txId = (Xid) XidWrapper.wrap(xid); > activeTransactionBranch.set(null); >@@ -968,7 +968,7 @@ > } > > public void commit(Xid xid, boolean onePhase) throws XAException { >- releaseTransientLocks(); >+ releaseTransientLocks(xid); > > Xid txId = (Xid) XidWrapper.wrap(xid); > activeTransactionBranch.set(null); >@@ -1001,6 +1001,7 @@ > activeTransactionBranch.set(txId); > if (flags == TMNOFLAGS || flags == TMJOIN) { > >+ // svaughan: Do we want to throw away the locks when joining? > locks.set(new HashSet()); > > objectsCache.getTxCache().start(txId); >@@ -1028,6 +1029,17 @@ > Xid txId = (Xid) XidWrapper.wrap(xid); > suspendedLocks.put(txId, locks.get()); > } >+ else { >+ // svaughan: The active transaction branch is being cleared, and >+ // locks is being nulled, so I suspect we should really >+ // just release transient locks here. >+ // >+ // This seems wrong since the transaction hasn't been >+ // committed or rolled back. You would think that you >+ // would want to hold on to the locks until the >+ // transaction is complete. >+ releaseTransientLocks(xid); >+ } > locks.set(null); > activeTransactionBranch.set(null); > } >@@ -1038,12 +1050,23 @@ > return getName() + "(" + getClass().getName() + ")"; > } > >- protected void releaseTransientLocks() { >+ protected void releaseTransientLocks(Xid xid) { >+ // If the transaction was suspended, then we need to resume by moving >+ // the transient locks back from the suspendedLocks map. >+ Xid txId = XidWrapper.wrap(xid); >+ if (suspendedLocks.containsKey(txId)) { >+ locks.set(suspendedLocks.remove(txId)); >+ } >+ > // XXX can be the case when an external transaction took up work in another thread > // no need to implement suspend and resume here as tlocks will not be used with external transactions > if (locks.get() == null) return; > >- Xid txId = (Xid) activeTransactionBranch.get(); >+ // svaughan: What if the transaction has been suspended? It is called >+ // from forget. Except for this next line, this method >+ // doesn't require that the transaction be active now that >+ // handling for suspended locks has been added. >+ // Xid txId = (Xid) activeTransactionBranch.get(); > for (Iterator it = ((HashSet)locks.get()).iterator(); it.hasNext();) { > GenericLock lock = (GenericLock) it.next(); > lock.release(txId); >@@ -1052,6 +1075,12 @@ > LOG_CHANNEL, > Logger.DEBUG); > } >+ >+ // svaughan: Remove the transient locks from the thread local since we >+ // have released all of the locks. locks.set(null) is called >+ // in end(xid, int), but not in commit(xid, boolean), >+ // rollback(xid), or forget(xid). >+ locks.set(null); > } > > protected Vector fillPermissionsCache(Uri uri) throws ServiceAccessException {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 31105
: 12666