00001
00002
00003
00004
00005
00006
00007
00008
00009 package com.sleepycat.db;
00010
00011 import com.sleepycat.db.internal.DbLock;
00012
00013 public class LockRequest {
00014 private DbLock lock;
00015 private LockRequestMode mode;
00016 private int modeFlag;
00017 private DatabaseEntry obj;
00018 private int op;
00019 private int timeout;
00020
00021 public LockRequest(final LockOperation op,
00022 final LockRequestMode mode,
00023 final DatabaseEntry obj,
00024 final Lock lock) {
00025
00026 this(op, mode, obj, lock, 0);
00027 }
00028
00029 public LockRequest(final LockOperation op,
00030 final LockRequestMode mode,
00031 final DatabaseEntry obj,
00032 final Lock lock,
00033 final int timeout) {
00034
00035 this.setOp(op);
00036 this.setMode(mode);
00037 this.setObj(obj);
00038 this.setLock(lock);
00039 this.setTimeout(timeout);
00040 }
00041
00042 public void setLock(final Lock lock) {
00043 this.lock = lock.unwrap();
00044 }
00045
00046 public void setMode(final LockRequestMode mode) {
00047 this.mode = mode;
00048 this.modeFlag = mode.getFlag();
00049 }
00050
00051 public void setObj(final DatabaseEntry obj) {
00052 this.obj = obj;
00053 }
00054
00055 public void setOp(final LockOperation op) {
00056 this.op = op.getFlag();
00057 }
00058
00059 public void setTimeout(final int timeout) {
00060 this.timeout = timeout;
00061 }
00062
00063 public Lock getLock() {
00064 return lock.wrapper;
00065 }
00066
00067 public LockRequestMode getMode() {
00068 return mode;
00069 }
00070
00071 public DatabaseEntry getObj() {
00072 return obj;
00073 }
00074
00075 public LockOperation getOp() {
00076 return LockOperation.fromFlag(op);
00077 }
00078
00079 public int getTimeout() {
00080 return timeout;
00081 }
00082 }