Remove SharedLockException in favor of GlobalRefDbLockException

Both exceptions were basically aliases and such duplication should
not be required.

The GlobalRefDbLockException will be kept, since it is referenced
from public API methods.

Change-Id: Ifb27848965295d69f6f52750cb0347f149192564
diff --git a/src/main/java/com/gerritforge/gerrit/globalrefdb/GlobalRefDbLockException.java b/src/main/java/com/gerritforge/gerrit/globalrefdb/GlobalRefDbLockException.java
index e51e1f3..65b9cf1 100644
--- a/src/main/java/com/gerritforge/gerrit/globalrefdb/GlobalRefDbLockException.java
+++ b/src/main/java/com/gerritforge/gerrit/globalrefdb/GlobalRefDbLockException.java
@@ -14,13 +14,13 @@
 
 package com.gerritforge.gerrit.globalrefdb;
 
-import com.gerritforge.gerrit.globalrefdb.validation.dfsrefdb.SharedLockException;
+import com.google.gerrit.git.LockFailureException;
 
 /**
  * {@code GlobalRefDbLockException} is an exception that can be thrown when interacting with the
  * global-refdb to represent the inability to lock or acquire a resource.
  */
-public class GlobalRefDbLockException extends SharedLockException {
+public class GlobalRefDbLockException extends LockFailureException {
   private static final long serialVersionUID = 1L;
 
   /**
@@ -32,6 +32,6 @@
    * @param cause the cause of the locking failure
    */
   public GlobalRefDbLockException(String project, String refName, Exception cause) {
-    super(project, refName, cause);
+    super(String.format("Unable to lock ref %s on project %s", refName, project), cause);
   }
 }
diff --git a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java b/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java
index d955599..8823f3d 100644
--- a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java
+++ b/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java
@@ -14,12 +14,12 @@
 
 package com.gerritforge.gerrit.globalrefdb.validation;
 
+import com.gerritforge.gerrit.globalrefdb.GlobalRefDbLockException;
 import com.gerritforge.gerrit.globalrefdb.GlobalRefDbSystemError;
 import com.gerritforge.gerrit.globalrefdb.validation.dfsrefdb.CustomSharedRefEnforcementByProject;
 import com.gerritforge.gerrit.globalrefdb.validation.dfsrefdb.DefaultSharedRefEnforcement;
 import com.gerritforge.gerrit.globalrefdb.validation.dfsrefdb.OutOfSyncException;
 import com.gerritforge.gerrit.globalrefdb.validation.dfsrefdb.SharedDbSplitBrainException;
-import com.gerritforge.gerrit.globalrefdb.validation.dfsrefdb.SharedLockException;
 import com.gerritforge.gerrit.globalrefdb.validation.dfsrefdb.SharedRefEnforcement;
 import com.gerritforge.gerrit.globalrefdb.validation.dfsrefdb.SharedRefEnforcement.EnforcePolicy;
 import com.google.common.base.MoreObjects;
@@ -242,7 +242,7 @@
   }
 
   protected RefPair compareAndGetLatestLocalRef(RefPair refPair, CloseableSet<AutoCloseable> locks)
-      throws SharedLockException, OutOfSyncException, IOException {
+      throws GlobalRefDbLockException, OutOfSyncException, IOException {
     String refName = refPair.getName();
     EnforcePolicy refEnforcementPolicy = refEnforcement.getPolicy(projectName, refName);
     if (refEnforcementPolicy == EnforcePolicy.IGNORED) {
@@ -326,8 +326,8 @@
     }
 
     public void addResourceIfNotExist(
-        String key, ExceptionThrowingSupplier<T, SharedLockException> resourceFactory)
-        throws SharedLockException {
+        String key, ExceptionThrowingSupplier<T, GlobalRefDbLockException> resourceFactory)
+        throws GlobalRefDbLockException {
       if (!elements.containsKey(key)) {
         elements.put(key, resourceFactory.create());
       }
diff --git a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/dfsrefdb/SharedLockException.java b/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/dfsrefdb/SharedLockException.java
deleted file mode 100644
index 1286ed3..0000000
--- a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/dfsrefdb/SharedLockException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (C) 2020 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.gerritforge.gerrit.globalrefdb.validation.dfsrefdb;
-
-import com.google.gerrit.git.LockFailureException;
-
-/** Unable to lock a project/ref resource. */
-public class SharedLockException extends LockFailureException {
-  private static final long serialVersionUID = 1L;
-
-  /**
-   * Constructs a {@code SharedLockException} exception with the cause of failing to lock a
-   * project/ref resource
-   *
-   * @param project the project the lock is being acquired for
-   * @param refName the ref the project is being acquired for
-   * @param cause the cause of the failure
-   */
-  public SharedLockException(String project, String refName, Exception cause) {
-    super(String.format("Unable to lock ref %s on project %s", refName, project), cause);
-  }
-}