class Sidekiq::Processor::SharedWorkerState

jruby's Hash implementation is not threadsafe, so we wrap it in a mutex here

Public Class Methods

new() click to toggle source
# File lib/sidekiq/processor.rb, line 223
def initialize
  @worker_state = {}
  @lock = Mutex.new
end

Public Instance Methods

clear() click to toggle source
# File lib/sidekiq/processor.rb, line 244
def clear
  @lock.synchronize { @worker_state.clear }
end
delete(tid) click to toggle source
# File lib/sidekiq/processor.rb, line 232
def delete(tid)
  @lock.synchronize { @worker_state.delete(tid) }
end
dup() click to toggle source
# File lib/sidekiq/processor.rb, line 236
def dup
  @lock.synchronize { @worker_state.dup }
end
set(tid, hash) click to toggle source
# File lib/sidekiq/processor.rb, line 228
def set(tid, hash)
  @lock.synchronize { @worker_state[tid] = hash }
end
size() click to toggle source
# File lib/sidekiq/processor.rb, line 240
def size
  @lock.synchronize { @worker_state.size }
end