private void pollForUnassignedJob() {
    UUID jobId = store.findFirst(JobAuthorization.State.CREDS_AVAILABLE);
    monitor.debug(() -> "Polling for a job in state CREDS_AVAILABLE");
    if (jobId == null) {
      monitor.debug(() -> "Did not find job after polling");
      return;
    }
    monitor.debug(() -> format("Found job %s", jobId));
    Preconditions.checkState(!JobMetadata.isInitialized());
    WorkerKeyPair keyPair = transferKeyGenerator.generate();
    // TODO: Back up private key (keyPair.getPrivate()) in case this transfer worker dies mid-copy,
    // so we don't have to make the user start from scratch. Some options are to manage this key
    // pair within our hosting platform's key management system rather than generating here, or to
    // encrypt and store the private key on the client.
    // Note: tryToClaimJob may fail if another transfer worker beat us to it. That's ok -- this
    // transfer
    // worker will keep polling until it can claim a job.
    boolean claimed = tryToClaimJob(jobId, keyPair);
    if (claimed) {
      monitor.debug(
          () ->
              format(
                  "Updated job %s to CREDS_ENCRYPTION_KEY_GENERATED, publicKey length: %s",
                  jobId, keyPair.getEncodedPublicKey().length));
      stopwatch.start();
    }
  }
Polls for an unassigned job, and once found, initializes the global singleton job metadata
object for this running instance of the transfer worker.
portability-transfer/src/main/java/org/datatransferproject/transfer/JobPollingService.java