RdContext

abstract class RdContext<T : Any>(val key: String, val heavy: Boolean, val serializer: IMarshaller<T>)

Describes a context and provides access to value associated with this context. The associated value is thread-local and synchronized between send/advise pairs on IWire. The associated value will be the same in handler method in IWire.advise as it was in IWire.send. Instances of this class with the same key will share the associated value. Best practice is to declare contexts in toplevel entities in protocol model using Toplevel.threadLocalContext. Manual declaration is also possible.

Parameters

key

textual name of this context. This is used to match this with protocol counterparts

heavy

Whether this context is heavy. A heavy context maintains a value set and interns values. A light context sends values as-is and does not maintain a value set.

serializer

Serializer to be used with this context.

See also

com.jetbrains.rd.generator.nova.Toplevel.threadLocalContext

Inheritors

Constructors

Link copied to clipboard
constructor(key: String, heavy: Boolean, serializer: IMarshaller<T>)

Types

Link copied to clipboard

Properties

Link copied to clipboard
Link copied to clipboard
val key: String
Link copied to clipboard
Link copied to clipboard
abstract val value: T?

The current value for this context

Link copied to clipboard

Value which is used as a key inside per-context entities like RdPerContextMap

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
abstract fun updateValue(newValue: T?): AutoCloseable

Changes current value to newValue and returns a cookie which should restore old value on closing