I have a method inside my controller class which is called everytime for each request for a specific operation (create in this case)
class DeployProvision
def self.create(data)
raise "Input JSON not received." unless data
# $logger.info input_data.inspect
failure = false
response_result = ""
response_status = "200"
@validator = SchemaValidate.new
validation = @validator.validate_create_workflow(data.to_json)
end
end
This method is called as (DeployProvision.create(data))
I am a little confused on how @validator class instance variable behaves when multiple requests come. Is it shared among multiple requests. Say @validator points to a1 address for the first request and a2 for the second request, will @validator point to a1 or a2 for the first request after the second request has also been triggered. Is it a good idea to declare this as class instance variable instead of a local variable if SchemaValidate maintains some state in terms of variables within itself ?