Hazelcast C++ Client
Public Member Functions | Friends | List of all members
hazelcast::client::ILock Class Reference

Re-entrant Lock, Distributed client implementation of Lock. More...

#include <ILock.h>

+ Inheritance diagram for hazelcast::client::ILock:

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
 

Detailed Description

Re-entrant Lock, Distributed client implementation of Lock.

Member Function Documentation

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.

Returns
lock hold count.
long hazelcast::client::ILock::getRemainingLeaseTime ( )

Returns remaining lease time in milliseconds.

If the lock is not locked then -1 will be returned.

Returns
remaining lease time in milliseconds.
bool hazelcast::client::ILock::isLocked ( )
Returns
true if this lock is locked, false otherwise.
bool hazelcast::client::ILock::isLockedByCurrentThread ( )
Returns
true if this lock is locked by current thread, false otherwise.
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..

Parameters
leaseTimeInMillistime to wait before releasing the lock.
bool hazelcast::client::ILock::tryLock ( )

Tries to acquire the lock.

Returns immediately without blocking.

Returns
true if lock is get, false otherwise.
bool hazelcast::client::ILock::tryLock ( long  timeInMillis)

Tries to acquire the lock.

Returns after timeInMillis seconds

Parameters
timeInMillistime to wait
Returns
true if lock is get, false otherwise.

The documentation for this class was generated from the following files: