Skip to content

Conversation

@LeMikaelF
Copy link
Collaborator

@LeMikaelF LeMikaelF commented Dec 26, 2025

Description

This PR removes TursoDBFactory, since its purpose was to cache instances of TursoDB, but they are not safe to share, because they implement AutoCloseable. See the associated issue for a discussion of this.

Description of AI Usage

I fed #2071 into Claude Code, and it wrote the code

Closes #2071

@seonWKim, if you want to review this please

@LeMikaelF LeMikaelF changed the title Remove TursoDB instance caching from TursoDBFactory Remove TursoDBFactory Dec 27, 2025
@LeMikaelF LeMikaelF force-pushed the java-caching-policy branch 2 times, most recently from b0278ce to dc737a4 Compare December 27, 2025 02:25
 The factory previously cached TursoDB instances by URL, but this was
 unsafe because TursoDB implements AutoCloseable. If one caller closed
 a cached instance, other callers sharing that instance would be left
 with an unusable reference.

 Each call to TursoDBFactory.open() now creates a new TursoDB instance,
 allowing callers to safely manage their own lifecycle.
@LeMikaelF LeMikaelF marked this pull request as ready for review December 27, 2025 02:49
@LeMikaelF LeMikaelF requested a review from penberg as a code owner December 27, 2025 02:49
Copy link

@turso-bot turso-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review @jussisaurio

Copy link
Contributor

@seonWKim seonWKim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bindings/java: Review unsafe caching policy of TursoDBFactory

3 participants