Use Duration instead of Long for the heart beat staleness

Change-Id: I02235bc10e37385a70096ab191673e771d7ab2e8
diff --git a/src/main/java/com/googlesource/gerrit/plugins/spannerrefdb/Lock.java b/src/main/java/com/googlesource/gerrit/plugins/spannerrefdb/Lock.java
index 0dde4ed..d8b7334 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/spannerrefdb/Lock.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/spannerrefdb/Lock.java
@@ -55,7 +55,7 @@
     Lock create(@Assisted("projectName") String projectName, @Assisted("refName") String refName);
   }
 
-  private static final Long SECONDS_FOR_STALE_HEARTBEAT = 30L;
+  private static final Duration DURATION_FOR_STALE_HEARTBEAT = Duration.ofSeconds(30);
   public static final Duration HEARTBEAT_INTERVAL = Duration.ofSeconds(2);
   private static final String RECLAIM_LOCK_PREFIX = "RECLAIM";
   private final DatabaseClient dbClient;
@@ -155,7 +155,8 @@
                           .bind("ref")
                           .to(refName)
                           .build());
-              if (resultSet.next() && resultSet.getLong("seconds") <= SECONDS_FOR_STALE_HEARTBEAT) {
+              if (resultSet.next()
+                  && resultSet.getLong("seconds") <= DURATION_FOR_STALE_HEARTBEAT.toSeconds()) {
                 // Check if the old lock is stale; if not, do nothing
                 return false;
               }