hazelcast-client
Version:
Hazelcast - open source In-Memory Data Grid - client for NodeJS
53 lines • 2.7 kB
JavaScript
;
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var PartitionSpecificProxy_1 = require("./PartitionSpecificProxy");
var LockLockCodec_1 = require("../codec/LockLockCodec");
var LockGetRemainingLeaseTimeCodec_1 = require("../codec/LockGetRemainingLeaseTimeCodec");
var LockTryLockCodec_1 = require("../codec/LockTryLockCodec");
var LockUnlockCodec_1 = require("../codec/LockUnlockCodec");
var LockForceUnlockCodec_1 = require("../codec/LockForceUnlockCodec");
var LockIsLockedCodec_1 = require("../codec/LockIsLockedCodec");
var LockIsLockedByCurrentThreadCodec_1 = require("../codec/LockIsLockedByCurrentThreadCodec");
var LockGetLockCountCodec_1 = require("../codec/LockGetLockCountCodec");
var LockProxy = (function (_super) {
__extends(LockProxy, _super);
function LockProxy() {
return _super !== null && _super.apply(this, arguments) || this;
}
LockProxy.prototype.lock = function (leaseMillis) {
if (leaseMillis === void 0) { leaseMillis = -1; }
return this.encodeInvoke(LockLockCodec_1.LockLockCodec, leaseMillis, 1, 0);
};
LockProxy.prototype.tryLock = function (timeoutMillis, leaseMillis) {
if (timeoutMillis === void 0) { timeoutMillis = 0; }
if (leaseMillis === void 0) { leaseMillis = -1; }
return this.encodeInvoke(LockTryLockCodec_1.LockTryLockCodec, 1, leaseMillis, timeoutMillis, 0);
};
LockProxy.prototype.unlock = function () {
return this.encodeInvoke(LockUnlockCodec_1.LockUnlockCodec, 1, 0);
};
LockProxy.prototype.forceUnlock = function () {
return this.encodeInvoke(LockForceUnlockCodec_1.LockForceUnlockCodec, 0);
};
LockProxy.prototype.isLocked = function () {
return this.encodeInvoke(LockIsLockedCodec_1.LockIsLockedCodec);
};
LockProxy.prototype.isLockedByThisClient = function () {
return this.encodeInvoke(LockIsLockedByCurrentThreadCodec_1.LockIsLockedByCurrentThreadCodec, 1);
};
LockProxy.prototype.getLockCount = function () {
return this.encodeInvoke(LockGetLockCountCodec_1.LockGetLockCountCodec);
};
LockProxy.prototype.getRemainingLeaseTime = function () {
return this.encodeInvoke(LockGetRemainingLeaseTimeCodec_1.LockGetRemainingLeaseTimeCodec).then(function (long) {
return long.toNumber();
});
};
return LockProxy;
}(PartitionSpecificProxy_1.PartitionSpecificProxy));
exports.LockProxy = LockProxy;
//# sourceMappingURL=LockProxy.js.map