KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > objectserver > persistence > sleepycat > TransactionWrapper


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.objectserver.persistence.sleepycat;
5
6 import com.sleepycat.je.DatabaseException;
7 import com.sleepycat.je.Transaction;
8 import com.tc.objectserver.persistence.api.PersistenceTransaction;
9
10 class TransactionWrapper implements PersistenceTransaction {
11   private final Transaction tx;
12
13   public TransactionWrapper(Transaction tx) {
14     this.tx = tx;
15   }
16
17   public Transaction getTransaction() {
18     return tx;
19   }
20
21   public void commit() {
22     if (tx != null) try {
23       tx.commit();
24     } catch (DatabaseException e) {
25       throw new DBException(e);
26     }
27   }
28 }
Popular Tags