Members
isReady :boolean
Indicates if there is currently no exclusive operation executedtrue
If no exclusive lock is hold
Type:
- boolean
- Source:
Methods
ready(doneCallbackopt, failCallbackopt) → {Promise.<this>}
Waits on the previously requested operation and calls the doneCallback if the operation is fulfilled
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
doneCallback |
util.Lockable~doneCallback |
<optional> |
The callback which will be invoked when the previously |
failCallback |
util.Lockable~failCallback |
<optional> |
When the lock can't be released caused by a none |
- Source:
Returns:
A promise which completes successfully, when the previously requested
operation completes
- Type
- Promise.<this>
(protected) withLock(callback, criticalopt) → {Promise.<T>}
Try to aquire an exclusive lock and executes the given callback.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
callback |
util.Lockable~callback | The exclusive operation to execute |
||
critical |
boolean |
<optional> |
false | Indicates if the operation is critical. If the operation is critical and the |
- Source:
Throws:
-
If the lock can't be aquired
- Type
- Error
Returns:
A promise
- Type
- Promise.<T>
Type Definitions
callback() → {Promise.<T>}
The operation callback is used by the util.Lockable#withLock
method,
to perform an exclusive operation on the
- Source:
Returns:
A Promise, which reflects the result of the operation
- Type
- Promise.<T>
doneCallback(entity) → {Promise.<*>|*}
The done callback is called, when the last operation on this object completes
Parameters:
Name | Type | Description |
---|---|---|
entity |
this | This entity instance |
- Source:
Returns:
A Promise, result or undefined
- Type
- Promise.<*> | *
failCallback(error) → {Promise.<*>|*}
The fail callback is called, when the last critical operation on this object fails
Parameters:
Name | Type | Description |
---|---|---|
error |
Error | The error which reject the operation |
- Source:
Returns:
A Promise, result or undefined
- Type
- Promise.<*> | *