@Override
  void performExpiryTimeout(ExpiryTask expiryTask) throws CacheException {
    boolean isEvictDestroy = isEntryEvictDestroyEnabled();
    // Fix for bug 43805 - get the primary lock before
    // synchronizing on pendingSecondaryExpires, to match the lock
    // ordering in other place (like acquiredPrimaryLock)
    lockPrimaryStateReadLock(false);
    try {
      // Why do we care if evict destroy is configured?
      // See bug 41096 for the answer.
      if (!getBucketAdvisor().isPrimary() && !isEvictDestroy) {
        synchronized (pendingSecondaryExpires) {
          if (expiryTask.isPending()) {
            Object key = expiryTask.getKey();
            if (key != null) {
              pendingSecondaryExpires.put(key, expiryTask);
            }
          }
        }
      } else {
        super.performExpiryTimeout(expiryTask);
      }
    } finally {
      doUnlockForPrimary();
    }
  }
Release the lock on the bucket that makes the bucket stay the primary during a write.
And release/remove the lockObject on the key(s)
geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java