  public isLockedAsync(context: any) {
    return new Promise(resolve => {
      const checkLock = () => {
        if (!this.isLocked(context)) {
          return resolve();
        }
        setTimeout(() => checkLock(), 0);
      };
      checkLock();
    });
  }

  public isLocked(context: any) {
    return _.some(this.locks, lock => _.isEqual(lock, context));