private long grantAndRespondToRequest(DLockRequestMessage request) {

      synchronized (request) {
        if (request.respondedNoSync()) {
          return -1;
        }

        Assert.assertTrue(request.getRemoteThread() != null);
        if (!grantor.dm.isCurrentMember(request.getSender())) {
          grantor.cleanupSuspendState(request);
          return -1;
        }

        if (isSuspendLockingToken()) {
          synchronized (grantor.suspendLock) {
            Assert.assertTrue(
                grantor.lockingSuspendedBy == null
                    || grantor.isLockingSuspendedBy(request.getRemoteThread()),
                "Locking is suspended by " + grantor.lockingSuspendedBy + " with lockId of "
                    + grantor.suspendedLockId + " instead of " + request.getRemoteThread()
                    + " with lockId of " + request.getLockId());
          } // suspendLock sync
        }

        long newLeaseExpireTime = calcLeaseExpireTime(request.getLeaseTime());

        grantLock(request.getSender(), newLeaseExpireTime, request.getLockId(),
            request.getRemoteThread());

        if (isSuspendLockingToken()) {
          synchronized (grantor.suspendLock) {
            // no-op if already suspend by this RemoteThread...
            grantor.suspendLocking(request.getRemoteThread(), request.getLockId());
            Assert.assertTrue(grantor.isLockingSuspendedBy(request.getRemoteThread()),
                "Locking should now be suspended by " + request.getRemoteThread()
                    + " with lockId of " + request.getLockId() + " instead of "
                    + grantor.lockingSuspendedBy + " with lockId of "
                    + grantor.suspendedLockId);
          } // suspendLock sync
        }

        // NOTE: if grantor is local and client interrupts the request, the
        // following will release the lock because the reply processor is gone
        request.respondWithGrant(newLeaseExpireTime);
        if (!isLeaseHeldBy(request.getSender(), request.getLockId())) {
          // lock request was local and interrupted then released
          return -1;
        }
        return newLeaseExpireTime;
      }
    }
Grants the lock to the specified request and sends a reply to the member that initiated the
request.
<p>
Caller must synchronize on this grant token.

@param request the request to grant the lock to
@return leaseExpireTime or -1 if failed to grant. guarded.By this
geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockGrantor.java