Class: Contrast::Agent::WorkerThread
- Includes:
- Components::Logger::InstanceMethods
- Defined in:
- lib/contrast/agent/thread/worker_thread.rb
Overview
Base class for threads that do async processing
Direct Known Subclasses
Protect::WorthWatchingInputAnalyzer, Reporter, ReportingWorkers::ApplicationServerWorker, ReportingWorkers::ReporterHeartbeat, ReportingWorkers::ServerSettingsWorker, Telemetry::Base, Utils::HeapDumpUtil
Instance Method Summary collapse
-
#attempt_to_start? ⇒ Boolean
Most threads, we always want to start.
- #clean_properties ⇒ Object
-
#initialize ⇒ WorkerThread
constructor
A new instance of WorkerThread.
- #running? ⇒ Boolean
- #stop! ⇒ Object
Methods included from Components::Logger::InstanceMethods
Constructor Details
#initialize ⇒ WorkerThread
Returns a new instance of WorkerThread.
12 13 14 |
# File 'lib/contrast/agent/thread/worker_thread.rb', line 12 def initialize @_thread = nil end |
Instance Method Details
#attempt_to_start? ⇒ Boolean
Most threads, we always want to start. Some may be controlled by feature guards though, so we need to check.
31 32 33 |
# File 'lib/contrast/agent/thread/worker_thread.rb', line 31 def attempt_to_start? Contrast::AGENT.enabled? end |
#clean_properties ⇒ Object
35 36 37 38 39 |
# File 'lib/contrast/agent/thread/worker_thread.rb', line 35 def clean_properties logger.debug("Cleaning PROPERTIES_HASH size: #{ Contrast::Agent::Assess::Tracker::PROPERTIES_HASH.size }") Contrast::Agent::Assess::Tracker.cleanup! logger.debug("Cleaned PROPERTIES_HASH size: #{ Contrast::Agent::Assess::Tracker::PROPERTIES_HASH.size }") end |
#running? ⇒ Boolean
16 17 18 |
# File 'lib/contrast/agent/thread/worker_thread.rb', line 16 def running? !!@_thread&.alive? end |