00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 package com.sleepycat.db;
00011
00012 import com.sleepycat.db.internal.DbConstants;
00013
00014 public final class LockMode {
00015 private String lockModeName;
00016 private int flag;
00017
00018 private LockMode(String lockModeName, int flag) {
00019 this.lockModeName = lockModeName;
00020 this.flag = flag;
00021 }
00022
00023 public static final LockMode DEFAULT =
00024 new LockMode("DEFAULT", 0);
00025 public static final LockMode READ_UNCOMMITTED =
00026 new LockMode("READ_UNCOMMITTED", DbConstants.DB_READ_UNCOMMITTED);
00027 public static final LockMode READ_COMMITTED =
00028 new LockMode("READ_COMMITTED", DbConstants.DB_READ_COMMITTED);
00029 public static final LockMode RMW =
00030 new LockMode("RMW", DbConstants.DB_RMW);
00031
00033 public static final LockMode DIRTY_READ = READ_UNCOMMITTED;
00035 public static final LockMode DEGREE_2 = READ_COMMITTED;
00036
00037 public String toString() {
00038 return "LockMode." + lockModeName;
00039 }
00040
00041
00042 static int getFlag(LockMode mode) {
00043 return ((mode == null) ? DEFAULT : mode).flag;
00044 }
00045 }