I have a class that serves as a delegate to another.
public class Delegate {
private AnotherClass ac;
public void delegateCall() {
this.ac.actualCall();
}
public void setAC(AnotherClass ac) {
this.ac = ac;
}
}
What are forks if I have many threads calling delegateCall()and another thread calling setAC()? My assumption is that some of the threads calling delegateCall()will gain access to the ac instance before it is installed, and some will gain access to it after it is installed. In my particular application, it does not matter which instance receives each thread.
My question is: is there any basic synchronization that can happen in the JVM that can lead to blocking threads that cause Call () delegation?