Skip to content

Disable URLConnection cache in CLI#180

Merged
mtdowling merged 1 commit intomasterfrom
no-jar-caches-in-cli
Oct 7, 2019
Merged

Disable URLConnection cache in CLI#180
mtdowling merged 1 commit intomasterfrom
no-jar-caches-in-cli

Conversation

@mtdowling
Copy link
Copy Markdown
Member

When running Smithy in a build tool like Gradle, Smithy is run multiple
times within a thread. Java's URLConnection has a cache built-in for
loading JARs, and when a JAR is updated during a Smithy build, it can
cause checksum exceptions when attempting to load that same JAR from a
subsequent run through the cache. This commit disables the cache when
running Smithy through the CLI to prevent this issue (Gradle runs Smithy
via the CLI in a thread).

(I couldn't find a way to test this other than manually test that it fixed the issues I was running into when using it with the Gradle plugin)

When running Smithy in a build tool like Gradle, Smithy is run multiple
times within a thread. Java's URLConnection has a cache built-in for
loading JARs, and when a JAR is updated during a Smithy build, it can
cause checksum exceptions when attempting to load that same JAR from a
subsequent run through the cache. This commit disables the cache when
running Smithy through the CLI to prevent this issue (Gradle runs Smithy
via the CLI in a thread).
validators.clear();
suppressions.clear();
documentNodes.clear();
properties.clear();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

These properties should have never of been cleared during a call to reset(). Reset should clear out transient state of the assembler, not configuration like properties.

@mtdowling mtdowling merged commit 961d8a5 into master Oct 7, 2019
@mtdowling mtdowling deleted the no-jar-caches-in-cli branch October 15, 2019 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants