Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry picks "Use LazyThreadSafteyMode.PUBLICATION instead of NONE (#433)" for v0.1.7 release #442

Merged
merged 1 commit into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lang/src/org/partiql/lang/eval/Bindings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ enum class BindingCase {
* Encapsulates the data necessary to perform a binding lookup.
*/
data class BindingName(val name: String, val bindingCase: BindingCase) {
val loweredName: String by lazy(LazyThreadSafetyMode.NONE) { name.toLowerCase() }
val loweredName: String by lazy(LazyThreadSafetyMode.PUBLICATION) { name.toLowerCase() }
/**
* Compares [name] to [otherName] using the rules specified by [bindingCase].
*/
Expand Down
4 changes: 2 additions & 2 deletions lang/src/org/partiql/lang/eval/ExprValueFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ private abstract class ScalarExprValue : BaseExprValue(), Scalar {

abstract fun ionValueFun(): IonValue

// LazyThreadSafetyMode.NONE is ok here because the worst that can happen is that [ionValueFun] is invoked
// LazyThreadSafetyMode.PUBLICATION is ok here because the worst that can happen is that [ionValueFun] is invoked
// from multiple threads. This should be ok because [IonSystem] is thread-safe.
override val ionValue by lazy(LazyThreadSafetyMode.NONE) { ionValueFun().seal() }
override val ionValue by lazy(LazyThreadSafetyMode.PUBLICATION) { ionValueFun().seal() }
}

/** A base class for the `true` boolean value, intended to be memoized. */
Expand Down
2 changes: 1 addition & 1 deletion testscript/src/org/partiql/testscript/compiler/Compiler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class Compiler(val ion: IonSystem) {
val dirPath = File(node.scriptLocation.inputName).parent
val file = File("$dirPath/${node.environmentRelativeFilePath}")

val lazyDatagram = lazy(LazyThreadSafetyMode.NONE) { ion.loader.load(file) }
val lazyDatagram = lazy(LazyThreadSafetyMode.PUBLICATION) { ion.loader.load(file) }

when {
!file.exists() -> {
Expand Down