class Sidekiq::Processor::SharedWorkState

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

def clear

def clear
  @lock.synchronize { @work_state.clear }
end

def delete(tid)

def delete(tid)
  @lock.synchronize { @work_state.delete(tid) }
end

def dup

def dup
  @lock.synchronize { @work_state.dup }
end

def initialize

def initialize
  @work_state = {}
  @lock = Mutex.new
end

def set(tid, hash)

def set(tid, hash)
  @lock.synchronize { @work_state[tid] = hash }
end

def size

def size
  @lock.synchronize { @work_state.size }
end