Code review comment: i think the issue would be if it is using the `WindmillServerBase` implementation of WindmillServerStub, which uses JNI  i will try to find a way around this

Code under review:
public static StreamingDataflowWorker fromOptions(DataflowWorkerHarnessOptions options) {
    long clientId = clientIdGenerator.nextLong();
    MemoryMonitor memoryMonitor = MemoryMonitor.fromOptions(options);
    ConcurrentMap<String, StageInfo> stageInfo = new ConcurrentHashMap<>();
    ConcurrentMap<String, String> stateNameMap = new ConcurrentHashMap<>();
    StreamingCounters streamingCounters = StreamingCounters.create();
    WorkUnitClient dataflowServiceClient = new DataflowWorkUnitClient(options, LOG);
    BoundedQueueExecutor workExecutor = createWorkUnitExecutor(options);
    AtomicInteger maxWorkItemCommitBytes = new AtomicInteger(Integer.MAX_VALUE);
    WindmillStateCache windmillStateCache =
        WindmillStateCache.ofSizeMbs(options.getWorkerCacheMb());
    Function<String, ScheduledExecutorService> executorSupplier =
        threadName ->
            Executors.newSingleThreadScheduledExecutor(
                new ThreadFactoryBuilder().setNameFormat(threadName).build());
    GrpcWindmillStreamFactory windmillStreamFactory =
        createWindmillStreamFactory(options, clientId);
    WindmillServerStub windmillServer = createWindmillServerStub(options, windmillStreamFactory);
    ComputationConfig.Fetcher configFetcher =
        options.isEnableStreamingEngine()
            ? StreamingEngineConfigFetcher.forTesting(
                true,
                options.getGlobalConfigRefreshPeriod().getMillis(),
                dataflowServiceClient,
                executorSupplier,
                FIX_MULTI_OUTPUT_INFOS_ON_PAR_DO_INSTRUCTIONS,
                config ->
                    onPipelineConfig(
                        config,
                        stateNameMap,
                        windmillServer::setWindmillServiceEndpoints,
                        maxWorkItemCommitBytes))
            : new StreamingApplianceConfigFetcher(
                windmillServer,
                config -> consumeUserStepToStateFamilyName(config, stateNameMap),
                FIX_MULTI_OUTPUT_INFOS_ON_PAR_DO_INSTRUCTIONS);
    ComputationStateCache computationStateCache =
        ComputationStateCache.create(
            configFetcher, workExecutor, windmillStateCache::forComputation);
    if (windmillServer instanceof GrpcWindmillServer) {
      ((GrpcWindmillServer) windmillServer)
          .setProcessHeartbeatResponses(
              new WorkHeartbeatResponseProcessor(computationStateCache::get));
    }

    FailureTracker failureTracker =
        options.isEnableStreamingEngine()
            ? StreamingEngineFailureTracker.create(
                MAX_FAILURES_TO_REPORT_IN_UPDATE, options.getMaxStackTraceDepthToReport())
            : StreamingApplianceFailureTracker.create(
                MAX_FAILURES_TO_REPORT_IN_UPDATE,
                options.getMaxStackTraceDepthToReport(),
                windmillServer::reportStats);

    Supplier<Instant> clock = Instant::now;
    WorkFailureProcessor workFailureProcessor =
        WorkFailureProcessor.create(
            workExecutor,
            failureTracker,
            () -> Optional.ofNullable(memoryMonitor.tryToDumpHeap()),
            clock);
    StreamingWorkerStatusReporter workerStatusReporter =
        StreamingWorkerStatusReporter.create(
            dataflowServiceClient,
            windmillServer::getAndResetThrottleTime,
            stageInfo::values,
            failureTracker,
            streamingCounters,
            memoryMonitor,
            workExecutor,
            options.getWindmillHarnessUpdateReportingPeriod().getMillis(),
            options.getPerWorkerMetricsUpdateReportingPeriodMillis());
    return new StreamingDataflowWorker(
        windmillServer,
        clientId,
        stateNameMap,
        configFetcher,
        computationStateCache,
        stageInfo,
        WindmillStateCache.ofSizeMbs(options.getWorkerCacheMb()),
        workExecutor,
        IntrinsicMapTaskExecutorFactory.defaultFactory(),
        options,
        new HotKeyLogger(),
        clock,
        workerStatusReporter,
        failureTracker,
        workFailureProcessor,
        streamingCounters,
        memoryMonitor,
        maxWorkItemCommitBytes,
        executorSupplier);
  }

Line commented on: if (windmillServer instanceof GrpcWindmillServer) {

Revised code:
public static StreamingDataflowWorker fromOptions(DataflowWorkerHarnessOptions options) {
    long clientId = clientIdGenerator.nextLong();
    MemoryMonitor memoryMonitor = MemoryMonitor.fromOptions(options);
    ConcurrentMap<String, StageInfo> stageInfo = new ConcurrentHashMap<>();
    StreamingCounters streamingCounters = StreamingCounters.create();
    WorkUnitClient dataflowServiceClient = new DataflowWorkUnitClient(options, LOG);
    BoundedQueueExecutor workExecutor = createWorkUnitExecutor(options);
    AtomicInteger maxWorkItemCommitBytes = new AtomicInteger(Integer.MAX_VALUE);
    WindmillStateCache windmillStateCache =
        WindmillStateCache.ofSizeMbs(options.getWorkerCacheMb());
    Function<String, ScheduledExecutorService> executorSupplier =
        threadName ->
            Executors.newSingleThreadScheduledExecutor(
                new ThreadFactoryBuilder().setNameFormat(threadName).build());
    GrpcWindmillStreamFactory windmillStreamFactory =
        createWindmillStreamFactory(options, clientId);
    GrpcDispatcherClient dispatcherClient = GrpcDispatcherClient.create(createStubFactory(options));

    
    
    Pair<ComputationConfig.Fetcher, Optional<WindmillServerStub>> configFetcherAndWindmillClient =
        createConfigFetcherAndWindmillClient(
            options,
            dataflowServiceClient,
            dispatcherClient,
            maxWorkItemCommitBytes,
            windmillStreamFactory);

    ComputationStateCache computationStateCache =
        ComputationStateCache.create(
            configFetcherAndWindmillClient.getLeft(),
            workExecutor,
            windmillStateCache::forComputation,
            ID_GENERATOR);

    
    
    WindmillServerStub windmillServer =
        configFetcherAndWindmillClient
            .getRight()
            .orElseGet(
                () ->
                    GrpcWindmillServer.create(
                        options,
                        windmillStreamFactory,
                        dispatcherClient,
                        new WorkHeartbeatResponseProcessor(computationStateCache::get)));

    FailureTracker failureTracker =
        options.isEnableStreamingEngine()
            ? StreamingEngineFailureTracker.create(
                MAX_FAILURES_TO_REPORT_IN_UPDATE, options.getMaxStackTraceDepthToReport())
            : StreamingApplianceFailureTracker.create(
                MAX_FAILURES_TO_REPORT_IN_UPDATE,
                options.getMaxStackTraceDepthToReport(),
                windmillServer::reportStats);

    Supplier<Instant> clock = Instant::now;
    WorkFailureProcessor workFailureProcessor =
        WorkFailureProcessor.create(
            workExecutor,
            failureTracker,
            () -> Optional.ofNullable(memoryMonitor.tryToDumpHeap()),
            clock);
    StreamingWorkerStatusReporter workerStatusReporter =
        StreamingWorkerStatusReporter.create(
            dataflowServiceClient,
            windmillServer::getAndResetThrottleTime,
            stageInfo::values,
            failureTracker,
            streamingCounters,
            memoryMonitor,
            workExecutor,
            options.getWindmillHarnessUpdateReportingPeriod().getMillis(),
            options.getPerWorkerMetricsUpdateReportingPeriodMillis());
    return new StreamingDataflowWorker(
        windmillServer,
        clientId,
        configFetcherAndWindmillClient.getLeft(),
        computationStateCache,
        stageInfo,
        WindmillStateCache.ofSizeMbs(options.getWorkerCacheMb()),
        workExecutor,
        IntrinsicMapTaskExecutorFactory.defaultFactory(),
        options,
        new HotKeyLogger(),
        clock,
        workerStatusReporter,
        failureTracker,
        workFailureProcessor,
        streamingCounters,
        memoryMonitor,
        maxWorkItemCommitBytes,
        windmillStreamFactory,
        executorSupplier);
  }