Re-entrant Lock, Distributed client implementation of Lock. More...
#include <ILock.h>
Public Member Functions | |
void | lock () |
Acquires the lock. More... | |
void | lock (long leaseTimeInMillis) |
Gets the lock for the specified lease time. More... | |
void | unlock () |
Releases the lock. | |
void | forceUnlock () |
Releases the lock regardless of the lock owner. More... | |
bool | isLocked () |
bool | isLockedByCurrentThread () |
int | getLockCount () |
Returns re-entrant lock hold count, regardless of lock ownership. More... | |
long | getRemainingLeaseTime () |
Returns remaining lease time in milliseconds. More... | |
bool | tryLock () |
Tries to acquire the lock. More... | |
bool | tryLock (long timeInMillis) |
Tries to acquire the lock. More... | |
Friends | |
class | HazelcastClient |
Re-entrant Lock, Distributed client implementation of Lock.
void hazelcast::client::ILock::forceUnlock | ( | ) |
Releases the lock regardless of the lock owner.
It always successfully unlocks, never blocks and returns immediately.
int hazelcast::client::ILock::getLockCount | ( | ) |
Returns re-entrant lock hold count, regardless of lock ownership.
long hazelcast::client::ILock::getRemainingLeaseTime | ( | ) |
Returns remaining lease time in milliseconds.
If the lock is not locked then -1 will be returned.
bool hazelcast::client::ILock::isLocked | ( | ) |
bool hazelcast::client::ILock::isLockedByCurrentThread | ( | ) |
void hazelcast::client::ILock::lock | ( | ) |
Acquires the lock.
If lock is not available waits for unlock indefinitely
void hazelcast::client::ILock::lock | ( | long | leaseTimeInMillis | ) |
Gets the lock for the specified lease time.
After lease time, lock will be released..
leaseTimeInMillis | time to wait before releasing the lock. |
bool hazelcast::client::ILock::tryLock | ( | ) |
Tries to acquire the lock.
Returns immediately without blocking.
bool hazelcast::client::ILock::tryLock | ( | long | timeInMillis | ) |
Tries to acquire the lock.
Returns after timeInMillis seconds
timeInMillis | time to wait |