# File lib/phusion_passenger/abstract_server_collection.rb, line 44 def initialize @collection = {} @lock = Mutex.new @cleanup_lock = Mutex.new @cond = ConditionVariable.new @done = false # The next time the cleaner thread should check for idle servers. # The value may be nil, in which case the value will be calculated # at the end of the #synchronized block. # # Invariant: # if value is not nil: # There exists an s in @collection with s.next_cleaning_time == value. # for all s in @collection: # if eligable_for_cleanup?(s): # s.next_cleaning_time <= value @next_cleaning_time = Time.now + 60 * 60 @next_cleaning_time_changed = false @cleaner_thread = Thread.new do begin @lock.synchronize do cleaner_thread_main end rescue Exception => e print_exception(self.class.to_s, e) end end end