Skip to content

Commit

Permalink
Set the transaction lock mode
Browse files Browse the repository at this point in the history
  • Loading branch information
trajano committed Jun 20, 2011
1 parent f491027 commit 7ef94a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseEntry;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.LockMode;
import com.sleepycat.je.OperationStatus;
import com.sleepycat.je.Transaction;

Expand Down Expand Up @@ -66,7 +67,7 @@ public HttpCacheEntry getEntry(final Transaction txn, final String key)
try {
final DatabaseEntry data = new DatabaseEntry();
final OperationStatus status = database.get(txn, new DatabaseEntry(
key.getBytes()), data, null);
key.getBytes()), data, LockMode.READ_COMMITTED);
if (status == OperationStatus.NOTFOUND) {
return null;
} else if (status == OperationStatus.SUCCESS) {
Expand Down Expand Up @@ -159,7 +160,7 @@ public void updateEntry(final Transaction txn, final String key,
// Made not final as this will get replaced.
HttpCacheEntry entry;
final OperationStatus status = database.get(txn, new DatabaseEntry(
key.getBytes()), data, null);
key.getBytes()), data, LockMode.READ_COMMITTED);
if (status == OperationStatus.NOTFOUND) {
entry = null;
} else if (status == OperationStatus.SUCCESS) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Internal classes used by BerkleyDbHttpCacheStorage.
* Internal classes used by BerkleyDbHttpCacheStorage. Clients should not use
* any of the classes in this package directly.
*/
package net.trajano.berkeleydbhttpcachestorage.internal;

0 comments on commit 7ef94a2

Please sign in to comment.