code: public void backup(Path backupDir) {
          if (!backupInProgress.compareAndSet(false, true)) {
              throw new BitsyException(BitsyErrorCodes.BACKUP_IN_PROGRESS);
          } else {
              try {
                  File backupDirFile = backupDir.toFile();
  
                  if (!backupDirFile.isDirectory()) {
                      throw new BitsyException(BitsyErrorCodes.BAD_BACKUP_PATH, "Expecting " + backupDir + " to be a folder");
                  }
  
                  // Flush the transaction buffer
                  flushTxLog();
  
                  // Enqueue the backup task
                  BackupJob backupJob = new BackupJob(backupDir);
                  veReorgBuf.addAndExecuteWork(backupJob);
                  
                  // Wait for the response
                  try {
                      backupJob.getCountDownLatch().await();
                  } catch (InterruptedException e) {
                      BitsyException toThrow = new BitsyException(BitsyErrorCodes.BACKUP_INTERRUPTED, "Exception while waiting for a backup to be performed", e);
                      
                      log.error("Error while backing up the database", toThrow);
                      
                      throw toThrow;
                  }
                  
                  BitsyException toThrow = backupJob.getException();
                  if (toThrow != null) {
                      throw toThrow;
                  }
              } finally {
                  backupInProgress.set(false);
              }
          }
      }
docs: This method backs up the database while it is still operational. Only one backup can be in progress at a time.
  
  @param backupDir directory to which the database must be backed up.