docs: @Override
      public IEntityLock newLock(
              Class entityType, String entityKey, int lockType, String owner, int durationSecs)
              throws LockingException {
          int expirationSecs = durationSecs;
          Date expires = getNewExpiration(expirationSecs);
          IEntityLock newLock =
                  new EntityLockImpl(entityType, entityKey, lockType, expires, owner, this);
  
          // retrieve potentially conflicting locks:
          IEntityLock[] locks = retrieveLocks(entityType, entityKey, null);
  
          if (lockType == WRITE_LOCK) {
              if (locks.length > 0) {
                  throw new LockingException("Could not create lock: entity already locked.");
              }
  
              getLockStore().add(newLock);
  
              locks = retrieveLocks(entityType, entityKey, null);
              if (locks.length > 1) // another lock snuck in
              {
                  release(newLock);
                  throw new LockingException("Could not create lock: entity already locked.");
              }
          } else // ( lockType == READ_LOCK )
          {
              for (int i = 0; i < locks.length; i++) {
                  if (locks[i].getLockType() == WRITE_LOCK) {
                      throw new LockingException(
                              "Could not create lock: entity already write locked.");
                  } else {
                      if (locks[i].equals(newLock)) {
                          // another read lock from the same owner; bump the expiration time.
                          expirationSecs++;
                          expires = getNewExpiration(expirationSecs);
                          newLock =
                                  new EntityLockImpl(
                                          entityType, entityKey, lockType, expires, owner, this);
                      }
                  }
              }
              getLockStore().add(newLock);
          }
          return newLock;
      }