I need to access an API using their SDK.
Access (well, anything I need to access) requires the use of a context object. The same one.
Context context;
It is running with the possiblity (well, certainty) that multiple threads will access this same context object to perform various operations (via the 'context' object)
So, is all that is needed for Thread-Safety is to refer to it only via a synchronized getter()
?
Example:
getContext().someOperation()
getContext().anotherOperation()
Definition:
public synchronized Context getContext() { return context; }