Skip to content

close() shuts down caller-provided executors #29

@nficano

Description

@nficano

Both ArcpRuntime and ArcpClient accept externally supplied schedulers or worker pools through their builders, but close() always shuts them down. ArcpRuntime.close calls scheduler.shutdownNow() and workerPool.shutdown() in arcp-runtime/src/main/java/dev/arcp/runtime/ArcpRuntime.java around line 197 even when those services came from Builder.scheduler or Builder.workerPool. ArcpClient.close calls scheduler.shutdownNow() in arcp-client/src/main/java/dev/arcp/client/ArcpClient.java around line 212 even when the scheduler came from Builder.scheduler. This violates the usual ownership expectation for injected executors and can break applications sharing a scheduler across multiple SDK objects.

Fix prompt: Track whether each executor or scheduler was created internally or supplied by the caller. Only shut down internally owned services in close(), and document the ownership rule in the builder Javadocs. For externally supplied services, cancel SDK-created tasks but leave the service running. Add tests that pass custom ExecutorService and ScheduledExecutorService instances into ArcpRuntime and ArcpClient, close the SDK objects, and assert the caller-owned services are not shut down.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingseverity:mediumMedium severity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions