java.com.github.lolgab.scalanativecrypto.internal.CtxFinalizer.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scala-native-crypto_native0.5_2.12 Show documentation
Show all versions of scala-native-crypto_native0.5_2.12 Show documentation
Scala Native java.security implementation based on OpenSSL
The newest version!
package java.com.github.lolgab.scalanativecrypto.internal
import java.lang.ref.WeakReference
import java.lang.ref.WeakReferenceRegistry
final class CtxFinalizer[T](
weakRef: WeakReference[_],
private var ctx: T,
finalizationFunction: T => Unit
) {
WeakReferenceRegistry.addHandler(weakRef, apply)
def apply(): Unit = {
if (ctx != null) {
finalizationFunction(ctx)
ctx = null.asInstanceOf[T]
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy