public class Lock extends Object
Lock class.
| Modifier and Type | Field and Description |
|---|---|
protected Thread |
lock |
protected String |
name |
protected boolean |
privacy |
| Constructor and Description |
|---|
Lock()
Constructor for Lock.
|
Lock(String name)
Constructor for Lock.
|
Lock(String name,
boolean privacy)
Constructor for Lock.
|
| Modifier and Type | Method and Description |
|---|---|
Thread |
getLocker()
getLocker.
|
String |
getName()
Getter for the field
name. |
boolean |
isLocked()
isLocked.
|
boolean |
isPrivacy()
isPrivacy.
|
void |
lock()
lock.
|
boolean |
lock(long timeout)
lock.
|
void |
lockWithException(long timeout)
lockWithException.
|
void |
setName(String name)
Setter for the field
name. |
String |
toString() |
void |
unlockHard()
unlockHard.
|
boolean |
unlockOwned()
unlockOwned.
|
void |
waitUntilUnlock()
waitUntilUnlock.
|
boolean |
waitUntilUnlock(long timeout)
waitUntilUnlock.
|
void |
waitWithException(long timeout)
waitWithException.
|
protected Thread lock
protected String name
protected boolean privacy
public Lock()
Constructor for Lock.
public Lock(String name, boolean privacy)
Constructor for Lock.
name - a String object.privacy - a boolean.public void lock()
lock.
public void lockWithException(long timeout)
lockWithException.
timeout - a long.public boolean lock(long timeout)
lock.
timeout - a long.public boolean unlockOwned()
unlockOwned.
public void unlockHard()
unlockHard.
public void waitUntilUnlock()
waitUntilUnlock.
public void waitWithException(long timeout)
waitWithException.
timeout - a long.public boolean waitUntilUnlock(long timeout)
waitUntilUnlock.
timeout - a long.public boolean isLocked()
isLocked.
public void setName(String name)
Setter for the field name.
name - a String object.public boolean isPrivacy()
isPrivacy.
Copyright © 2016. All Rights Reserved.