code: @Override
      protected void doLock(Connection con, final String lockContext) throws SQLException {
          logger.debug("Trying to acquire db lock for '{}'", lockContext);
          final int lockId = computeLockId(lockContext);
          PreparedStatement stmt = con.prepareStatement("SELECT pg_advisory_xact_lock (?)");
          stmt.setInt(1, lockId);
          try {
              stmt.executeQuery();
          } finally {
              JdbcUtils.closeStatement(stmt);
          }
      }
docs: ref: https://www.postgresql.org/docs/9.5/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS
  pg_advisory_lock locks an application-defined resource, which can be identified either by a single 64-bit key
  value or two 32-bit key values (note that these two key spaces do not overlap). If another session already holds
  a lock on the same resource identifier, this function will wait until the resource becomes available. The lock is
  exclusive. Multiple lock requests stack, so that if the same resource is locked three times it must then be
  unlocked three times to be released for other sessions' use.
  DO NOT USE IT WITHOUT finally { release_lock(lockContext)} or it will be deadlocked!!