• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/db-4.7.25.NC/java/src/com/sleepycat/db/
1/*-
2 * See the file LICENSE for redistribution information.
3 *
4 * Copyright (c) 2002,2008 Oracle.  All rights reserved.
5 *
6 * $Id: LockRequestMode.java,v 12.7 2008/01/17 05:04:53 mjc Exp $
7 */
8
9package com.sleepycat.db;
10
11import com.sleepycat.db.internal.DbConstants;
12
13/**
14When using the default lock conflict matrix, the LockRequestMode class
15defines the set of possible lock modes.
16*/
17public final class LockRequestMode {
18    /**
19    Read (shared).
20    */
21    public static final LockRequestMode READ =
22        new LockRequestMode("READ", DbConstants.DB_LOCK_READ);
23    /**
24    Write (exclusive).
25    */
26    public static final LockRequestMode WRITE =
27        new LockRequestMode("WRITE", DbConstants.DB_LOCK_WRITE);
28    /**
29    Intention to write (shared).
30    */
31    public static final LockRequestMode IWRITE =
32        new LockRequestMode("IWRITE", DbConstants.DB_LOCK_IWRITE);
33    /**
34    Intention to read (shared).
35    */
36    public static final LockRequestMode IREAD =
37        new LockRequestMode("IREAD", DbConstants.DB_LOCK_IREAD);
38    /**
39    Intention to read and write (shared).
40    */
41    public static final LockRequestMode IWR =
42        new LockRequestMode("IWR", DbConstants.DB_LOCK_IWR);
43
44    /* package */
45    private final String operationName;
46    private final int flag;
47
48    /**
49    Construct a custom lock request mode.
50    <p>
51    @param operationName
52    Name used to display the mode
53    <p>
54    @param flag
55    Flag value used as an index into the lock conflict matrix
56    */
57    public LockRequestMode(final String operationName, final int flag) {
58        this.operationName = operationName;
59        this.flag = flag;
60    }
61
62    /** {@inheritDoc} */
63    public String toString() {
64        return "LockRequestMode." + operationName;
65    }
66
67    /* package */
68    int getFlag() {
69        return flag;
70    }
71}
72