1/* ---------------------------------------------------------------------------- 2 * This file was automatically generated by SWIG (http://www.swig.org). 3 * Version 1.3.33 4 * 5 * Do not make changes to this file unless you know what you are doing--modify 6 * the SWIG interface file instead. 7 * ----------------------------------------------------------------------------- */ 8 9package com.sleepycat.db.internal; 10 11import com.sleepycat.db.*; 12import java.util.Comparator; 13 14public class DbTxn { 15 private long swigCPtr; 16 protected boolean swigCMemOwn; 17 18 protected DbTxn(long cPtr, boolean cMemoryOwn) { 19 swigCMemOwn = cMemoryOwn; 20 swigCPtr = cPtr; 21 } 22 23 protected static long getCPtr(DbTxn obj) { 24 return (obj == null) ? 0 : obj.swigCPtr; 25 } 26 27 /* package */ synchronized void delete() { 28 if(swigCPtr != 0 && swigCMemOwn) { 29 swigCMemOwn = false; 30 throw new UnsupportedOperationException("C++ destructor does not have public access"); 31 } 32 swigCPtr = 0; 33 } 34 35 public void abort() throws DatabaseException { 36 try { 37 abort0(); 38 } finally { 39 swigCPtr = 0; 40 } 41 } 42 43 public void commit(int flags) throws DatabaseException { 44 try { 45 commit0(flags); 46 } finally { 47 swigCPtr = 0; 48 } 49 } 50 51 public void discard(int flags) throws DatabaseException { 52 try { 53 discard0(flags); 54 } finally { 55 swigCPtr = 0; 56 } 57 } 58 59 /* 60 * We override Object.equals because it is possible for the Java API to 61 * create multiple DbTxns that reference the same underlying object. 62 * This can happen for example during DbEnv.txn_recover(). 63 */ 64 public boolean equals(Object obj) 65 { 66 if (this == obj) 67 return true; 68 69 if (obj != null && (obj instanceof DbTxn)) { 70 DbTxn that = (DbTxn)obj; 71 return (this.swigCPtr == that.swigCPtr); 72 } 73 return false; 74 } 75 76 /* 77 * We must override Object.hashCode whenever we override 78 * Object.equals() to enforce the maxim that equal objects have the 79 * same hashcode. 80 */ 81 public int hashCode() 82 { 83 return ((int)swigCPtr ^ (int)(swigCPtr >> 32)); 84 } 85 86 /* package */ void abort0() { db_javaJNI.DbTxn_abort0(swigCPtr, this); } 87 88 /* package */ void commit0(int flags) { db_javaJNI.DbTxn_commit0(swigCPtr, this, flags); } 89 90 /* package */ void discard0(int flags) { db_javaJNI.DbTxn_discard0(swigCPtr, this, flags); } 91 92 public String get_name() throws com.sleepycat.db.DatabaseException { 93 return db_javaJNI.DbTxn_get_name(swigCPtr, this); 94 } 95 96 public int id() throws com.sleepycat.db.DatabaseException { return db_javaJNI.DbTxn_id(swigCPtr, this); } 97 98 public void prepare(byte[] gid) throws com.sleepycat.db.DatabaseException { db_javaJNI.DbTxn_prepare(swigCPtr, this, gid); } 99 100 public void set_timeout(long timeout, int flags) throws com.sleepycat.db.DatabaseException { db_javaJNI.DbTxn_set_timeout(swigCPtr, this, timeout, flags); } 101 102 public void set_name(String name) throws com.sleepycat.db.DatabaseException { db_javaJNI.DbTxn_set_name(swigCPtr, this, name); } 103 104} 105