class AsyncLocalStorage[T] extends asyncHooksMod.AsyncLocalStorage[T]
When having multiple instances of AsyncLocalStorage, they are independent
from each other. It is safe to instantiate this class multiple times.
- Annotations
- @JSType() @JSImport("node:async_hooks", "AsyncLocalStorage") @native()
- Source
- nodeAsyncHooksMod.scala
- Alphabetic
- By Inheritance
- AsyncLocalStorage
- AsyncLocalStorage
- StObject
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new AsyncLocalStorage()
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- def disable(): Unit
This method disables the instance of
AsyncLocalStorage.This method disables the instance of
AsyncLocalStorage. All subsequent calls toasyncLocalStorage.getStore()will returnundefineduntilasyncLocalStorage.run()is called again.When calling
asyncLocalStorage.disable(), all current contexts linked to the instance will be exited.Calling
asyncLocalStorage.disable()is required before theasyncLocalStoragecan be garbage collected. This does not apply to stores provided by theasyncLocalStorage, as those objects are garbage collected along with the corresponding async resources.This method is to be used when the
asyncLocalStorageis not in use anymore in the current process.- Definition Classes
- AsyncLocalStorage
- def enterWith(store: T): Unit
Calling
asyncLocalStorage.enterWith(store)will transition into the context for the remainder of the current synchronous execution and will persist through any following asynchronous calls.Calling
asyncLocalStorage.enterWith(store)will transition into the context for the remainder of the current synchronous execution and will persist through any following asynchronous calls.- Definition Classes
- AsyncLocalStorage
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def exit[R](callback: Function1[Any, R], args: Any*): R
This methods runs a function synchronously outside of a context and return its return value.
This methods runs a function synchronously outside of a context and return its return value. The store is not accessible within the callback function or the asynchronous operations created within the callback.
Optionally, arguments can be passed to the function. They will be passed to the callback function.
If the callback function throws an error, it will be thrown by
exittoo. The stacktrace will not be impacted by this call and the context will be re-entered.- Definition Classes
- AsyncLocalStorage
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def getStore(): UndefOr[T]
This method returns the current store.
This method returns the current store. If this method is called outside of an asynchronous context initialized by calling
asyncLocalStorage.run, it will returnundefined.- Definition Classes
- AsyncLocalStorage
- def hasOwnProperty(v: scala.Predef.String): Boolean
- Definition Classes
- Object
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- def propertyIsEnumerable(v: scala.Predef.String): Boolean
- Definition Classes
- Object
- def run[R](store: T, callback: Function1[Any, R], args: Any*): R
This methods runs a function synchronously within a context and return its return value.
This methods runs a function synchronously within a context and return its return value. The store is not accessible outside of the callback function or the asynchronous operations created within the callback.
Optionally, arguments can be passed to the function. They will be passed to the callback function.
I the callback function throws an error, it will be thrown by
runtoo. The stacktrace will not be impacted by this call and the context will be exited.- Definition Classes
- AsyncLocalStorage
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toLocaleString(): scala.Predef.String
- Definition Classes
- Object
- def toString(): java.lang.String
- Definition Classes
- AnyRef → Any
- def valueOf(): Any
- Definition Classes
- Object
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated