Put ternary in setNewThreadKey.
Added timeout when saving object to redis.