Is it safe to pass context to multiple threads?

I am implementing a service that performs REST for multiple applications. The results of certain REST calls must be stored in the content provider.

I'm currently trying to use multiple threads that will execute an HTTP request, parse the result and store the data in a content provider. To do this, I must pass context to each of the threads. I am not sure if this is a good idea because I don’t know if a context can be passed to multiple threads due to its size, thread safety, etc. I think I'm just passing a reference to the Context object for each thread, so maybe it's not hard to pass it?

+3
source share
2 answers

, . , , , Context, .

, , HTTP- AsyncTask, onPreExecute onPostExecute , .

+4

Java , "".

, .

+3

All Articles