Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

Transaction.java

00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 2002-2005
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: Transaction.java,v 12.2 2005/06/16 20:23:04 bostic Exp $
00008  */
00009 
00010 package com.sleepycat.db;
00011 
00012 import com.sleepycat.db.internal.DbConstants;
00013 import com.sleepycat.db.internal.DbTxn;
00014 
00015 public class Transaction {
00016     /*package */ final DbTxn txn;
00017 
00018     Transaction(final DbTxn txn) {
00019         this.txn = txn;
00020     }
00021 
00022     public void abort()
00023         throws DatabaseException {
00024 
00025         txn.abort();
00026     }
00027 
00028     public void commit()
00029         throws DatabaseException {
00030 
00031         txn.commit(0);
00032     }
00033 
00034     public void commitSync()
00035         throws DatabaseException {
00036 
00037         txn.commit(DbConstants.DB_TXN_SYNC);
00038     }
00039 
00040     public void commitNoSync()
00041         throws DatabaseException {
00042 
00043         txn.commit(DbConstants.DB_TXN_NOSYNC);
00044     }
00045 
00046     public void discard()
00047         throws DatabaseException {
00048 
00049         txn.discard(0);
00050     }
00051 
00052     public int getId()
00053         throws DatabaseException {
00054 
00055         return txn.id();
00056     }
00057 
00058     public String getName()
00059         throws DatabaseException {
00060 
00061         return txn.get_name();
00062     }
00063 
00064     public void prepare(final byte[] gid)
00065         throws DatabaseException {
00066 
00067         txn.prepare(gid);
00068     }
00069 
00070     public void setName(final String name)
00071         throws DatabaseException {
00072 
00073         txn.set_name(name);
00074     }
00075 
00076     public void setTxnTimeout(final long timeOut)
00077         throws DatabaseException {
00078 
00079         txn.set_timeout(timeOut, DbConstants.DB_SET_TXN_TIMEOUT);
00080     }
00081 
00082     public void setLockTimeout(final long timeOut)
00083         throws DatabaseException {
00084 
00085         txn.set_timeout(timeOut, DbConstants.DB_SET_LOCK_TIMEOUT);
00086     }
00087 }

Generated on Sun Dec 25 12:14:33 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2