def run_jdk_command_on_pid(
    event: PodEvent,
    params: JavaParams,
    cmd: str,
    aggregation_key: str,
    retrigger_action: Callable,
):
    """
    A generic entrypoint function to run any jdk command via the java toolkit and creates a finding on it
    """
    pod = event.get_pod()
    if not pod:
        logging.info(f"{aggregation_key} - pod not found for event: {event}")
        return

    finding = Finding(
        title=f"{cmd} run on pid {params.pid} in pod {pod.metadata.name} in namespace {pod.metadata.namespace}:",
        source=FindingSource.MANUAL,
        aggregation_key=aggregation_key,
        subject=PodFindingSubject(pod),
        finding_type=FindingType.REPORT,
        failure=False,
    )

    if not params.pid:
        process_finder = ProcessFinder(pod, params, ProcessType.JAVA)
        process = process_finder.get_match_or_report_error(finding, cmd, retrigger_action, java_process_inspector)
        if process is None:
            event.add_finding(finding)
            return
        params.pid = process.pid

    jdk_cmd = f"{cmd} {params.pid}"
    try:
        jdk_output = run_java_toolkit_command(jdk_cmd, pod, params.jtk_image, custom_annotations=params.custom_annotations)
        finding.add_enrichment(
            [
                MarkdownBlock(f"{aggregation_key} ran on process {params.pid}"),
                FileBlock(f"{aggregation_key}_{params.pid}.txt", jdk_output.encode()),
            ]
        )
    except Exception:
        finding.add_enrichment([MarkdownBlock(f"```{traceback.format_exc()}```")])
    finally:
        event.add_finding(finding)

    A generic entrypoint function to run any jdk command via the java toolkit and creates a finding on it
    
playbooks/robusta_playbooks/java_pod_troubleshooting.py