public final class LockType extends java.lang.Object implements java.lang.Comparable<LockType>
Modifier and Type | Field and Description |
---|---|
static LockType |
EXCLUSIVE
Progress-style exclusive lock; request for this type may block
|
static LockType |
EXCLUSIVE_NO_WAIT
Progress-style exclusive lock; requests for this type never block
|
static int |
LT_EXCLUSIVE
Internal constant for lock type EXCLUSIVE, corresponds to 4GL internal value
|
static int |
LT_NO_WAIT
Internal constant for NO-WAIT, corresponds to 4GL internal value
|
static int |
LT_NONE
Internal constant for lock type NONE, corresponds to 4GL internal value
|
static int |
LT_SHARE
Internal constant for lock type SHARE, corresponds to 4GL internal value
|
static LockType |
NONE
The lack of a record lock
|
static LockType |
SHARE
Progress-style share lock; request for this type may block
|
static LockType |
SHARE_NO_WAIT
Progress-style share lock; requests for this type never block
|
private int |
type
Internal type
|
Modifier | Constructor and Description |
---|---|
private |
LockType(int type)
Private constructor to ensure the only instances of this class are the
public constants.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(LockType other)
Compare the restrictiveness of this lock type to another.
|
static LockType |
fromInt(int type)
Return the appropriate static "constant" instance of this class for the
given internal type.
|
static LockType |
fromLockNowait(long lock,
long nowait)
Return the appropriate static "constant" instance of this class for the
given internal lock and nowait.
|
static LockType |
fromString(java.lang.String str)
Obtain the locking type object from a string representation.
|
boolean |
isExclusive()
Indicate whether this lock type is an exclusive lock type, ignoring its
no-wait designation.
|
boolean |
isNoWait()
Indicate whether this is a "no-wait" lock type.
|
boolean |
isShare()
Indicate whether this lock type is a share lock type, ignoring its
no-wait designation.
|
static int |
toInt(LockType lockType)
Return the internal type of the lock as an integer.
|
LockType |
toNoWaitVariant()
Get the no-wait equivalent for this lock type.
|
java.lang.String |
toString()
Compose a string representation of this object for assistance in debugging and testing.
|
LockType |
toWaitVariant()
Get the waiting variant for this lock type.
|
public static final int LT_NONE
public static final int LT_SHARE
public static final int LT_EXCLUSIVE
public static final int LT_NO_WAIT
public static final LockType NONE
public static final LockType SHARE
public static final LockType EXCLUSIVE
public static final LockType SHARE_NO_WAIT
public static final LockType EXCLUSIVE_NO_WAIT
private final int type
private LockType(int type)
type
- Internal type, used for comparisons.public static int toInt(LockType lockType)
This is intended to support optimized network serialization and prevent propagation of multiple instances of this class for each lock type.
lockType
- Instance of this class for which the type is desired.lockType
.public static LockType fromInt(int type)
This is intended to support optimized network serialization and prevent propagation of multiple instances of this class for each lock type.
type
- Integer value representing one of the valid lock types.LockType
constant.java.lang.IllegalArgumentException
- if type
is not a valid internal lock type.public static LockType fromLockNowait(long lock, long nowait) throws LockTypeException
This is intended to support optimized network serialization and prevent propagation of multiple instances of this class for each lock type.
lock
- Integer value.nowait
- Integer value.LockType
constant.LockTypeException
- if arguments lock
and nowait
do not correspond
to a valid lock type.public boolean isNoWait()
true
if lock is no-wait type, else
false
.public boolean isShare()
true
if this type is one of the share variants,
else false
.public boolean isExclusive()
true
if this type is one of the exclusive
variants, else false
.public LockType toNoWaitVariant()
LockType
object with the same type as this object,
but with the no-wait flag set, or this object if it already
has the no-wait flag set or is type NONE
.public LockType toWaitVariant()
LockType
object with the same type as this object,
but with the no-wait flag unset, or this object if it already
has the no-wait flag unset or is type NONE
.public int compareTo(LockType other)
compareTo
in interface java.lang.Comparable<LockType>
other
- Another LockType
instance to compare with this one.other
;
< 0 if this lock type is less restrictive than other
;
0 if they are equally restrictive.public java.lang.String toString()
toString
in class java.lang.Object
public static LockType fromString(java.lang.String str)
str
- The string representation of a LockType object.