Class: OpenWFE::MonitorProvider
- Inherits:
-
Object
- Object
- OpenWFE::MonitorProvider
- Includes:
- MonitorMixin, Logging
- Defined in:
- lib/openwfe/expool/expressionpool.rb
Overview
a small help class for storing monitors provided on demand to expressions that need them
Constant Summary collapse
- MAX_MONITORS =
10000
Instance Method Summary collapse
- #[](key) ⇒ Object
- #delete(key) ⇒ Object
-
#initialize(application_context = nil) ⇒ MonitorProvider
constructor
A new instance of MonitorProvider.
Methods included from Logging
#ldebug, #ldebug_callstack, #lerror, #lfatal, #linfo, #llog, #lunknown, #lwarn
Constructor Details
#initialize(application_context = nil) ⇒ MonitorProvider
Returns a new instance of MonitorProvider.
1086 1087 1088 1089 1090 |
# File 'lib/openwfe/expool/expressionpool.rb', line 1086 def initialize (application_context=nil) super() @application_context = application_context @monitors = LruHash.new(MAX_MONITORS) end |
Instance Method Details
#[](key) ⇒ Object
1092 1093 1094 1095 1096 1097 |
# File 'lib/openwfe/expool/expressionpool.rb', line 1092 def [] (key) synchronize do (@monitors[key] ||= Monitor.new) end end |
#delete(key) ⇒ Object
1099 1100 1101 1102 1103 1104 |
# File 'lib/openwfe/expool/expressionpool.rb', line 1099 def delete (key) synchronize do #ldebug { "delete() removing Monitor for #{key}" } @monitors.delete(key) end end |