01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.object.config;
05:
06: /**
07: * Defines a lock. Locks may be either auto locks or named locks. Both types of locks have four locking
08: * levels: WRITE, READ, CONCURRENT, and SYNCHRONOUS_WRITE. Auto locks may also be auto-synchronized. The
09: * locking level and auto-synchronized flag are defined in the ConfigLockLevel.
10: */
11: public interface LockDefinition {
12:
13: /**
14: * Name to use with autolocks: "tc:autolock"
15: */
16: public static final String TC_AUTOLOCK_NAME = "tc:autolock";
17:
18: /**
19: * @param lockName Lock name
20: */
21: public void setLockName(String lockName);
22:
23: /**
24: * @return Lock name, {@link #TC_AUTOLOCK_NAME} for auto locks
25: */
26: public String getLockName();
27:
28: /**
29: * @param lt Lock level
30: */
31: public void setLockLevel(ConfigLockLevel lt);
32:
33: /**
34: * @return Lock level
35: */
36: public ConfigLockLevel getLockLevel();
37:
38: /**
39: * @return Lock level as code defining level
40: * @see ConfigLockLevel
41: */
42: public int getLockLevelAsInt();
43:
44: /**
45: * @return True if auto lock, false if named lock
46: */
47: public boolean isAutolock();
48:
49: /**
50: * Commit this definition, after which the definition cannot be changed.
51: */
52: public void commit();
53:
54: }
|