code: protected void createClusterMutex(final String mutexName) {
          this.executeIgnoreRollback(
                  new TransactionCallbackWithoutResult() {
                      @Override
                      protected void doInTransactionWithoutResult(TransactionStatus status) {
                          final EntityManager entityManager = getEntityManager();
                          final ClusterMutex clusterMutex = new ClusterMutex(mutexName);
                          entityManager.persist(clusterMutex);
                          try {
                              entityManager.flush();
                              logger.trace("Created {}", clusterMutex);
                          } catch (PersistenceException e) {
                              if (e.getCause() instanceof ConstraintViolationException) {
                                  // ignore, another thread beat us to creation
                                  logger.debug(
                                          "Failed to create mutex, it was likely created concurrently by another thread: "
                                                  + clusterMutex,
                                          e);
                                  return;
                              }
  
                              // re-throw exception with unhandled cause
                              throw e;
                          }
                      }
                  });
      }
docs: Creates a new ClusterMutex with the specified name. Returns the created mutex or null if the
  mutex already exists.