Class: DatawireQuarkCore::TLS
- Inherits:
-
Object
- Object
- DatawireQuarkCore::TLS
- Defined in:
- lib/datawire-quark-core.rb
Instance Method Summary collapse
- #getValue ⇒ Object
-
#initialize(initializer) ⇒ TLS
constructor
A new instance of TLS.
- #setValue(value) ⇒ Object
Constructor Details
#initialize(initializer) ⇒ TLS
Returns a new instance of TLS.
1090 1091 1092 1093 |
# File 'lib/datawire-quark-core.rb', line 1090 def initialize(initializer) @initializer = initializer @var = Concurrent::ThreadLocalVar.new UNINITIALIZED end |
Instance Method Details
#getValue ⇒ Object
1095 1096 1097 1098 1099 1100 1101 |
# File 'lib/datawire-quark-core.rb', line 1095 def getValue value = @var.value if UNINITIALIZED.equal?(value) @var.value = value = @initializer.getValue end value end |
#setValue(value) ⇒ Object
1103 1104 1105 |
# File 'lib/datawire-quark-core.rb', line 1103 def setValue(value) @var.value = value end |