public class LockMap extends Object
Modifier and Type | Field and Description |
---|---|
static int |
OWNER_ANY |
static int |
OWNER_READ |
static int |
OWNER_WRITE |
Constructor and Description |
---|
LockMap() |
LockMap(Collection<Object> readOwners)
This constructor is made available for testing with different collection types for the readOwners collection.
|
Modifier and Type | Method and Description |
---|---|
void |
addReader(Object owner)
Adding a reader owner.
|
boolean |
isOwner(Object caller,
int ownership)
Check whether this owner has reader or writer ownership.
|
boolean |
isReadLocked() |
String |
printInfo()
Debugging information.
|
Collection<Object> |
readerOwners()
Returns an unmodifiable set of reader owner objects.
|
void |
releaseReaderOwners(LockStrategy lock) |
void |
removeAll()
Remove all ownership.
|
void |
removeReader(Object owner)
Remove reader ownership.
|
void |
removeWriter()
Remove writer ownership.
|
void |
setWriterIfNotNull(Object owner)
Adding a writer owner.
|
boolean |
upgrade(Object owner)
Upgrading current reader ownership to writer one.
|
Object |
writerOwner() |
public static final int OWNER_ANY
public static final int OWNER_READ
public static final int OWNER_WRITE
public LockMap()
public LockMap(Collection<Object> readOwners)
readOwners
- public boolean isOwner(Object caller, int ownership)
caller
- the potential owner. Cannot be null
.ownership
- Either OWNER_ANY
, OWNER_READ
,
or OWNER_WRITE
.NullPointerException
- if caller
is null
.public void addReader(Object owner)
owner
- public void setWriterIfNotNull(Object owner)
owner
- public boolean upgrade(Object owner) throws OwnerNotExistedException
owner
- OwnerNotExistedException
public Collection<Object> readerOwners()
public void releaseReaderOwners(LockStrategy lock)
public Object writerOwner()
public void removeReader(Object owner)
public void removeWriter()
public void removeAll()
public String printInfo()
public boolean isReadLocked()
Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.